Hello Team
Quick question please what does w_tmp = np.randon.rand(X_tmp.shape(-1, )-0.5 refer to …not able to understand -1 and -0.5 at the end. Thank you
Hi @Jasmine7
The .reshape(-1,)
reshapes the array to have a single dimension, preserving the total number of elements (in this case: 6).
The - 0.5
operation is performed element-wise and it is intended to shift the range of random values [0, 1)
downwards by 0.5 [-0.5, 0.5)
.
This is another example where you could have easily answered the question yourself with a little experimentation and debugging print statements.
I recommend you get in the habit of doing small experiments to explore how Python works.
Thanks TMosh for your suggestion, I do that already. I would also like to use this forum as much as possible. I hope thats okay with you.
We are all here to learn, and its no harm asking questions @TMosh . Everybody is a learner once, nobody is born with the knowledge. Hence, people should have the freedom to ask any questions they have without any hesitation.
Thanks so much @Alireza_Saei
Thats very helpful
Hi @Alireza_Saei why do we need to push values to -0.5, 0.5 is it because to ensure it includes the decision boundary
Certainly this is true.
You can also discover a lot of answers with your own research.
Hello @Jasmine7
Pay attention that we’re discussing weight initialization (w_tmp), not data values (X_tmp). The values of X_tmp are all between 0 and 1 because of np.random.rand()
.
Limiting the range of weight initialization ensures a balanced starting point for the learning process and prevents weights from becoming too large or too small, which can lead to numerical instability and hinder convergence.
You’re welcome! happy to help
Obviously @TMosh I am doing my research at the same time. Thank you for maintaining a safe learning environment.
Could we have used something else other than 0.5…0.3 for example ?
Yes, there are indeed various methods for weight initialization, and you can experiment with different ranges based on your specific needs. However, setting weight values to exactly 0 is typically avoided.