Python Forum
coding neural network - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: coding neural network (/thread-24572.html)



coding neural network - programmer19890620 - Feb-20-2020

Hi everyone,

I'm doing an online coure in Coursera (Neural Networks and Deep Learning), but I'm a little confused of the pre-writed code lines.In the programming assignment the tutor don't expain well the function of this instructions.

I have uploadaed the docx file containing the questions:
https://docs.google.com/document/d/19A7e2wBPdCIqdEeEENUAx5iRnbwa2v-l/edit

this is the source code/solution for the programming assignment on github:

https://github.com/Kulbear/deep-learning-coursera/blob/master/Neural%20Networks%20and%20Deep%20Learning/Planar%20data%20classification%20with%20one%20hidden%20layer.ipynb


RE: coding neural network - jefsummers - Feb-20-2020

1. W1 is the weight matrix and is the shape going between input and first hidden layer
2. Use np.shape(w1)
3. Input layer will be the number of features. For example, this is one of my model input layers, left it flexible for me so if I change data structure I don't have to chase down and change the input layer.
layers.Dense(64, activation='relu', input_shape=[len(train_dataset.keys())])
4. You can create your own repository. Go to GitHub and sign up. Using them is not intuitive, but pretty easy once you get used to it. I suggest "A Practical Guid to Git and Github for Windows Users from Amazon.
5. The function initialize_parameters_test_case() (look in your code) returns 3 values.
6. Same as #2
7. print type of logprobs to see what it is. That may help.
8. layer_sizes by itself should print the layer_sizes. predictions=np.round(A2) will round A2
9. Yes
10. https://www.geeksforgeeks.org/enumerate-in-python/


RE: coding neural network - programmer19890620 - Feb-25-2020

1. this command can not be executed, it returns an error message: "NameError: name 'W1' is not defined"

4. Recently I wouldn't buy this book, but I have already registered on github and created my own project, I suppose I have to upload my ipynb file but then what? (I think it is possible to write the code in the jupyter notebook what is connected to my github project).

5. The function initialize_parameters_test_case() (look in your code) returns 3 values.

I have runned this code: type("logprobs") and it returned : str
but this command doesn't work: print(logprobs) --> "name 'logprobs' is not defined"

9. in the documentation: "predictions -- vector of predictions of our model (red: 0 / blue: 1)"
so in this case I think "predictions" is an array and it contains a predictive value for all (400) examples. It is right?


RE: coding neural network - jefsummers - Feb-25-2020

1. W1 is defined in In[9] of your posted code. That cell needs to be executed before you can print.
4. Typically you will create a repository on your computer and sync the two. See the book.
5.
type("anthing you like")
will return str, because anything in quotes is a string.
9. Looks like. try
print(predictions.shape)



RE: coding neural network - programmer19890620 - Feb-27-2020

ok, thanks for your help