Last active
June 20, 2019 11:47
-
-
Save RafayAK/40c42485dcbc3e96fdbbfda990c2a8f4 to your computer and use it in GitHub Desktop.
Defining a 2 layer neural net
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# define training constants | |
learning_rate = 1 | |
number_of_epochs = 5000 | |
np.random.seed(48) # set seed value so that the results are reproduceable | |
# (weights will now be initailzaed to the same pseudo-random numbers, each time) | |
# Our network architecture has the shape: | |
# (input)--> [Linear->Sigmoid] -> [Linear->Sigmoid] -->(output) | |
#------ LAYER-1 ----- define hidden layer that takes in training data | |
Z1 = LinearLayer(input_shape=X_train.shape, n_out=3, ini_type='xavier') | |
A1 = SigmoidLayer(Z1.Z.shape) | |
#------ LAYER-2 ----- define output layer that take is values from hidden layer | |
Z2= LinearLayer(input_shape=A1.A.shape, n_out=1, ini_type='xavier') | |
A2= SigmoidLayer(Z2.Z.shape) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment