<filename>tests/TestCases.py<gh_stars>0
import numpy as np
"""Test cases for a binary classification neural network with 3 layers of
dimensions 5, 3 and 1, the two hidden layers will have a Relu activation function wile the 
output layer will have a sigmoid activation function"""

# ================================================================================================= #
#                               test cases for gradient descent                                     #
# ================================================================================================= #
# Training data
X2 = np.array([[1.62434536, -0.61175641, -0.52817175], [-1.07296862,  0.86540763, -2.3015387],
               [1.74481176, -0.7612069, 0.3190391], [-0.24937038, 1.46210794, -2.06014071]])
# True labels
Y2 = np.array([[1, 1, 0]])

# initial parameters
W1 = np.array([[-0.3224172, -0.38405435,  1.13376944, -1.09989127],
               [-0.17242821, -0.87785842,  0.04221375,  0.58281521],
               [-1.10061918,  1.14472371,  0.90159072,  0.50249434],
               [0.90085595, -0.68372786, -0.12289023, -0.93576943],
               [-0.26788808,  0.53035547, -0.69166075, -0.39675353]])
b1 = np.array([[-0.6871727], [-0.84520564], [-0.67124613], [-0.0126646], [-1.11731035]])
W2 = np.array([[0.2344157,  1.65980218,  0.74204416, -0.19183555, -0.88762896],
               [-0.74715829,  1.6924546,  0.05080775, -0.63699565,  0.19091548],
               [2.10025514,  0.12015895,  0.61720311,  0.30017032, -0.35224985]])
b2 = np.array([[-1.1425182], [-0.34934272], [-0.20889423]])
W3 = np.array([[0.58662319,  0.83898341,  0.93110208]])
b3 = np.array([[0.28558733]])

# Gradients after one ran of backward propagation
dZ3 = np.array([[-0.02793328, -0.33416743,  0.99887329]])
dW3 = np.array([[0., 0.,  2.24404238]])
db3 = np.array([[0.21225753]])
dA2 = np.array([[-0.01638631, -0.19603037,  0.58596224],
                [-0.02343555, -0.28036093,  0.83803812],
                [-0.02600873, -0.31114399,  0.930053]])
dZ2 = np.array([[-0., -0.,  0.],
                [-0., -0.,  0.],
                [-0.02600873, -0.31114399,  0.930053]])
dW2 = np.array([[0.,  0.,  0.,  0.,  0.],
                [0.,  0.,  0.,  0.,  0.],
                [0.91580165,  0.02451548, -0.10797954,  0.90281891,  0.]])
db2 = np.array([[0.],
                [0.],
                [0.19763343]])
dA1 = np.array([[-0.05462497, -0.65348177,  1.95334859],
                [-0.00312518, -0.03738674,  0.11175419],
                [-0.01605267, -0.19203904,  0.5740316],
                [-0.00780705, -0.09339619,  0.27917431],
                [0.00916157,  0.10960042, -0.32761103]])
dZ1 = np.array([[-0.05462497, -0.,  1.95334859],
                [-0., -0.,  0.11175419],
                [-0., -0.19203904,  0.],
                [-0.00780705, -0.,  0.27917431],
                [0.,  0., -0.]])
dW1 = np.array([[-0.37347779, -1.47903216,  0.17596143, -1.33685036],
                [-0.01967514, -0.08573553,  0.01188465, -0.07674312],
                [0.03916037, -0.05539735,  0.04872715, -0.09359393],
                [-0.05337778, -0.21138458,  0.02514856, -0.19106384],
                [0.,  0.,  0.,  0.]])
db1 = np.array([[0.63290787],
                [0.0372514],
                [-0.06401301],
                [0.09045575],
                [0.]])

# List of the parameters
parameters = [W1, b1, W2, b2, W3, b3]
grads = [dW3, db3, dW2, db2, dW1, db1]
dZ = [dZ3, dZ2, dZ1]
dA = [dA2, dA1]

<filename>tests/TestCases.py<gh_stars>0
import numpy as np
"""Test cases for a binary classification neural network with 3 layers of
dimensions 5, 3 and 1, the two hidden layers will have a Relu activation function wile the 
output layer will have a sigmoid activation function"""

# ================================================================================================= #
#                               test cases for gradient descent                                     #
# ================================================================================================= #
# Training data
X2 = np.array([[1.62434536, -0.61175641, -0.52817175], [-1.07296862,  0.86540763, -2.3015387],
               [1.74481176, -0.7612069, 0.3190391], [-0.24937038, 1.46210794, -2.06014071]])
# True labels
Y2 = np.array([[1, 1, 0]])

# initial parameters
W1 = np.array([[-0.3224172, -0.38405435,  1.13376944, -1.09989127],
               [-0.17242821, -0.87785842,  0.04221375,  0.58281521],
               [-1.10061918,  1.14472371,  0.90159072,  0.50249434],
               [0.90085595, -0.68372786, -0.12289023, -0.93576943],
               [-0.26788808,  0.53035547, -0.69166075, -0.39675353]])
b1 = np.array([[-0.6871727], [-0.84520564], [-0.67124613], [-0.0126646], [-1.11731035]])
W2 = np.array([[0.2344157,  1.65980218,  0.74204416, -0.19183555, -0.88762896],
               [-0.74715829,  1.6924546,  0.05080775, -0.63699565,  0.19091548],
               [2.10025514,  0.12015895,  0.61720311,  0.30017032, -0.35224985]])
b2 = np.array([[-1.1425182], [-0.34934272], [-0.20889423]])
W3 = np.array([[0.58662319,  0.83898341,  0.93110208]])
b3 = np.array([[0.28558733]])

# Gradients after one ran of backward propagation
dZ3 = np.array([[-0.02793328, -0.33416743,  0.99887329]])
dW3 = np.array([[0., 0.,  2.24404238]])
db3 = np.array([[0.21225753]])
dA2 = np.array([[-0.01638631, -0.19603037,  0.58596224],
                [-0.02343555, -0.28036093,  0.83803812],
                [-0.02600873, -0.31114399,  0.930053]])
dZ2 = np.array([[-0., -0.,  0.],
                [-0., -0.,  0.],
                [-0.02600873, -0.31114399,  0.930053]])
dW2 = np.array([[0.,  0.,  0.,  0.,  0.],
                [0.,  0.,  0.,  0.,  0.],
                [0.91580165,  0.02451548, -0.10797954,  0.90281891,  0.]])
db2 = np.array([[0.],
                [0.],
                [0.19763343]])
dA1 = np.array([[-0.05462497, -0.65348177,  1.95334859],
                [-0.00312518, -0.03738674,  0.11175419],
                [-0.01605267, -0.19203904,  0.5740316],
                [-0.00780705, -0.09339619,  0.27917431],
                [0.00916157,  0.10960042, -0.32761103]])
dZ1 = np.array([[-0.05462497, -0.,  1.95334859],
                [-0., -0.,  0.11175419],
                [-0., -0.19203904,  0.],
                [-0.00780705, -0.,  0.27917431],
                [0.,  0., -0.]])
dW1 = np.array([[-0.37347779, -1.47903216,  0.17596143, -1.33685036],
                [-0.01967514, -0.08573553,  0.01188465, -0.07674312],
                [0.03916037, -0.05539735,  0.04872715, -0.09359393],
                [-0.05337778, -0.21138458,  0.02514856, -0.19106384],
                [0.,  0.,  0.,  0.]])
db1 = np.array([[0.63290787],
                [0.0372514],
                [-0.06401301],
                [0.09045575],
                [0.]])

# List of the parameters
parameters = [W1, b1, W2, b2, W3, b3]
grads = [dW3, db3, dW2, db2, dW1, db1]
dZ = [dZ3, dZ2, dZ1]
dA = [dA2, dA1]

Test cases for a binary classification neural network with 3 layers of dimensions 5, 3 and 1, the two hidden layers will have a Relu activation function wile the  output layer will have a sigmoid activation function # ================================================================================================= # #                               test cases for gradient descent                                     # # ================================================================================================= # # Training data # True labels # initial parameters # Gradients after one ran of backward propagation # List of the parameters