Neurons and Layers Lab1 Week1

Hi!
I just began with this course and understood the initial videos. However, I am lost in the first lab notebook itself. It’s difficult for me to understand what’s happening. I am new to the TensorFlow library, hence the issue. I just want to know if anyone else is facing a similar situation and how can I proceed further?

Since this is the first lab, I think this was beginner-level stuff, so the codes further down the week will get more complicated, and I won’t be able to grasp them either. Any kind of help is appreciated!

1 Like

Hello @prateekm_2709, welcome to course 2!

First, I think the tensorflow-related code is in more or less the same level of difficulty throughout course 2, so don’t worry too much about that.

Second, after the lab, after the quiz, there will be some videos about TensorFlow implementation, maybe you can watch them first, and then come back to that lab again? And then you let us know if you need help?

Cheers,
Raymond

Yeah sure @rmwkwok, I’ll try it out and reach back to you in case of difficulties. Thanks!

Sure, and enjoy it! =)

2 Likes

Hi @rmwkwok - I also want to ask a simple question regarding the first lab of course 2:
As I understand the lab, it demonstrates:
1 - a simple neuron network with a single layer and with a single neuron that performs linear regression to predict house prices according to houses sizes
2 - a simple neuron network with a single layer and a single neuron that performs logistic regression to classify X (training inputs [0., 1, 2, 3, 4, 5]) to 0/1. These are the Y targets of the training inputs [0, 0, 0, 1, 1, 1].
The lab does it with the tensorflow library (very roughly) with activation = ‘linear’ for 1 above and with activation = ‘sigmoid’ for 2 above.
My question:
I noticed that you give the correct w, b as inputs the models:
for 1 above: linear_layer.set_weights([set_w, set_b])
for 2 above: logistic_layer.set_weights([set_w, set_b])
then you let the models predict the Y’s and notice that the prediction is correct - since these parameters are optimal/correct.
Why the neuron network does not study the parameters itself?
Why do you assign them to the model?
What am I missing?
Thanks in advance,
Aviv

Hello Aviv @Aviv_Simionovici,

We have seen many times in C1 how numpy was used to model linear and logistic regression problems. The purpose of the first lab in C2 is just to show us that Tensorflow framwork can do the same thing, and that’s why we manually set the same weights and biases values for both numpy-model and tensorflow-model, and then we will be able to see that they can produce the same results, and that’s it!

So,

because the purpose is not really to train a model with Tensorflow, but we will train a model with Tensorflow from zero to one in some later labs.

just for us to see that tensorflow can do the job that we have used numpy to do!

Cheers,
Raymond

thank you @rmwkwok!
I would like to suggest clarifying this in the lab prefix so ones that go through the lab will know what to expect. Also, the matrix [[x1 x2]] notation of TensorFlow is explained in the course after the lab so it is also worth mentioning in the lab prefix.
Aviv