We start with some imports and helper functions.

In [1]:
Using Theano backend.
In [2]:
In [3]:
In [4]:

First we will take a net with 2 layers, each having 2 neurons.

In [5]:
In [6]:

Let us take weights from the example file:

In [7]:

Let us see how the network behaves before training. On the left, two top pictures show outputs of the neurons from the first layer -- for each point (x,y) in the square [2,2]2, we show the output value by colours from black (0) to yellow (1.0). Note that for training we use only points from a square [1.4,1.4]2. Bottom left part shows the target function. Two top graphs on the right are the output of the neurons from the second layer (i.e., the output of the network), and right bottom picture shows predictions. In this example, every point is predicted to be in class 0 (the black one).

In [8]:
/usr/lib/python3/dist-packages/ipykernel_launcher.py:26: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:32: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:38: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.

Now let us train the network.

In [9]:
Epoch 1/45
10000/10000 [==============================] - 0s 42us/step - loss: 0.1955
Epoch 2/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1938
Epoch 3/45
10000/10000 [==============================] - 0s 44us/step - loss: 0.1937
Epoch 4/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1936
Epoch 5/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1935
Epoch 6/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1933
Epoch 7/45
10000/10000 [==============================] - 0s 44us/step - loss: 0.1931
Epoch 8/45
10000/10000 [==============================] - 0s 47us/step - loss: 0.1929
Epoch 9/45
10000/10000 [==============================] - 0s 45us/step - loss: 0.1926
Epoch 10/45
10000/10000 [==============================] - 0s 44us/step - loss: 0.1922
Epoch 11/45
10000/10000 [==============================] - 0s 44us/step - loss: 0.1918
Epoch 12/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1912
Epoch 13/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1906
Epoch 14/45
10000/10000 [==============================] - 0s 42us/step - loss: 0.1898
Epoch 15/45
10000/10000 [==============================] - 0s 44us/step - loss: 0.1889
Epoch 16/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1878
Epoch 17/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1865
Epoch 18/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1847
Epoch 19/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1825
Epoch 20/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1793
Epoch 21/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1750
Epoch 22/45
10000/10000 [==============================] - 0s 44us/step - loss: 0.1693
Epoch 23/45
10000/10000 [==============================] - 0s 44us/step - loss: 0.1629
Epoch 24/45
10000/10000 [==============================] - 0s 44us/step - loss: 0.1567
Epoch 25/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1515
Epoch 26/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1476
Epoch 27/45
10000/10000 [==============================] - 0s 43us/step - loss: 0.1448
Epoch 28/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1428
Epoch 29/45
10000/10000 [==============================] - 0s 42us/step - loss: 0.1415
Epoch 30/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1405
Epoch 31/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1398
Epoch 32/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1393
Epoch 33/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1389
Epoch 34/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1387
Epoch 35/45
10000/10000 [==============================] - 0s 42us/step - loss: 0.1385
Epoch 36/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1384
Epoch 37/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1383
Epoch 38/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1381
Epoch 39/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1381
Epoch 40/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1380
Epoch 41/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1380
Epoch 42/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1379
Epoch 43/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1379
Epoch 44/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1378
Epoch 45/45
10000/10000 [==============================] - 0s 41us/step - loss: 0.1378
Out[9]:
<keras.callbacks.History at 0x7fbce35a0c50>

...and see how it behaves after the training. It is much better, but with only 2 neurons in the first layer, it is unable to model the square target shape.

In [10]:
/usr/lib/python3/dist-packages/ipykernel_launcher.py:26: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:32: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:38: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.

Let us try with 5 neurons in the first layer.

In [11]:
In [12]:
Epoch 1/45
10000/10000 [==============================] - 0s 34us/step - loss: 0.1906
Epoch 2/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1862
Epoch 3/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1824
Epoch 4/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1772
Epoch 5/45
10000/10000 [==============================] - 0s 34us/step - loss: 0.1706
Epoch 6/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1631
Epoch 7/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1557
Epoch 8/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1491
Epoch 9/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1433
Epoch 10/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1374
Epoch 11/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1303
Epoch 12/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1208
Epoch 13/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1094
Epoch 14/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0975
Epoch 15/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0870
Epoch 16/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0786
Epoch 17/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0723
Epoch 18/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0674
Epoch 19/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0638
Epoch 20/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0608
Epoch 21/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0585
Epoch 22/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0566
Epoch 23/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0550
Epoch 24/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0536
Epoch 25/45
10000/10000 [==============================] - 0s 34us/step - loss: 0.0524
Epoch 26/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0513
Epoch 27/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0503
Epoch 28/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0495
Epoch 29/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0487
Epoch 30/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0479
Epoch 31/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0472
Epoch 32/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0466
Epoch 33/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0460
Epoch 34/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0454
Epoch 35/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0449
Epoch 36/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0443
Epoch 37/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0438
Epoch 38/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0433
Epoch 39/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0429
Epoch 40/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0424
Epoch 41/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0420
Epoch 42/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.0415
Epoch 43/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0411
Epoch 44/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0407
Epoch 45/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.0403
Out[12]:
<keras.callbacks.History at 0x7fbcca260550>

Let us examine the behaviour of this network after training. This one can recognise the square shape quite well. Note that neuron 1 from layer 0 outputs similar values for all points.

In [13]:
/usr/lib/python3/dist-packages/ipykernel_launcher.py:26: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:32: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:38: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.

Now let us come back to the net with just 2 neurons in each layer and initialise weights to zero:

In [14]:
In [15]:
Epoch 1/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1966
Epoch 2/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 3/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 4/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 5/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 6/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 7/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 8/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 9/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 10/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 11/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 12/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 13/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 14/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 15/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 16/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 17/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 18/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 19/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 20/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 21/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 22/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 23/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 24/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 25/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 26/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 27/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 28/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1935
Epoch 29/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 30/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 31/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 32/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 33/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 34/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 35/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 36/45
10000/10000 [==============================] - 0s 34us/step - loss: 0.1935
Epoch 37/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 38/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 39/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 40/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 41/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 42/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 43/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
Epoch 44/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.1936
Epoch 45/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.1936
/usr/lib/python3/dist-packages/ipykernel_launcher.py:26: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:32: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:38: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.

As one can see above, the network performs very poorly. Examining the weights reveals the reason for that: when initial weights are all the same (within a hidden layer), by symmetry, the neurons in that layer evolve in the same way. As a result, it is like we had only 1 neuron in that layer and this leads to poor performance.

In [16]:
Out[16]:
[array([[-0.08791123, -0.08791123],
        [ 0.08488268,  0.08488268]], dtype=float32),
 array([-0.02046185, -0.02046185], dtype=float32),
 array([[ 0.3661374 , -0.36613744],
        [ 0.3661374 , -0.36613744]], dtype=float32),
 array([ 0.7271915, -0.7271915], dtype=float32)]

On the other hand, if the weights are too large (with respect to the number of inputs), then the neurons saturate and the training is very slow. Let us see such an example, you may see weight 117.57395 (at least if the seed gives reproducible results).

In [17]:
[[-117.57395    28.345278]
 [ -90.79815    52.419914]]
/usr/lib/python3/dist-packages/ipykernel_launcher.py:26: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:32: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:38: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.

Let us train the network.

In [18]:
Epoch 1/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3837
Epoch 2/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3793
Epoch 3/45
10000/10000 [==============================] - 0s 31us/step - loss: 0.3776
Epoch 4/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.3767
Epoch 5/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.3763
Epoch 6/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3760
Epoch 7/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3758
Epoch 8/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3756
Epoch 9/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3756
Epoch 10/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.3755
Epoch 11/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3754
Epoch 12/45
10000/10000 [==============================] - 0s 31us/step - loss: 0.3754
Epoch 13/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3753
Epoch 14/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3753
Epoch 15/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3753
Epoch 16/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3752
Epoch 17/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3752
Epoch 18/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3751
Epoch 19/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3751
Epoch 20/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3751
Epoch 21/45
10000/10000 [==============================] - 0s 31us/step - loss: 0.3751
Epoch 22/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3751
Epoch 23/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3751
Epoch 24/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3751
Epoch 25/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3751
Epoch 26/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3751
Epoch 27/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3751
Epoch 28/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 29/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 30/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 31/45
10000/10000 [==============================] - 0s 33us/step - loss: 0.3750
Epoch 32/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 33/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 34/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 35/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 36/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 37/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 38/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 39/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 40/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 41/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 42/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 43/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 44/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Epoch 45/45
10000/10000 [==============================] - 0s 32us/step - loss: 0.3750
Out[18]:
<keras.callbacks.History at 0x7fbcca2607b8>

Let us examine the same weights again, after training. The weight that had value 117.57395 now has a value 117.63838. The other weights are also almost the same. The network virtually stays unchanged despite training.

In [19]:
[[-117.63838    28.087534]
 [ -90.73178    52.597485]]
In [20]:
/usr/lib/python3/dist-packages/ipykernel_launcher.py:26: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:32: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.
/usr/lib/python3/dist-packages/ipykernel_launcher.py:38: MatplotlibDeprecationWarning: shading='flat' when X and Y have the same dimensions as C is deprecated since 3.3.  Either specify the corners of the quadrilaterals with X and Y, or pass shading='auto', 'nearest' or 'gouraud', or set rcParams['pcolor.shading'].  This will become an error two minor releases later.