Week 1 practice lab: execution of neural networks

Dear fellow learners!

I was wondering during working on the practice lab: When is the neural network being “executed”? For example, when are the wights assigned? During creating the sequential model, when the Dense layers are assigned? Or when the model is fed with input data? Or with the .getlayers() command?

Hey @Gabor_Farkas,
The weights are assigned during the training of the model. However, in my opinion, “assigned” seems to be a bit ambiguous term, since when we initialize the weights, we can refer to it as “assigning” values to the weights as well. In fact, if we talk in terms of Python, then this is only when the weights are “assigned”.

Instead we can say that, when the model is trained, the weights are adjusted/pushed/moved to more optimal values. Now, in terms of code, when the fit method is called on the model, the weights are optimized using gradient descent or one of it’s other forms. Let me know if this helps.

Cheers,
Elemento

Dear @Elemento ,
Thanks for the reply. If I understand correctly, when we define the model (for example, using Sequential) is the point, during a run of the code, weights are initialized. Randomly I guess?

BR,
Gábor

Hey @Gabor_Farkas,
Please check out Version 12 of this kernel. You will find the kernel to be self-explanatory. Let me know if this helps.

Cheers,
Elemento

Dear Elemento,

yes, explained clearly in the topic, thanks for sharing!