+ 2
self.weights = 2 * random.random((3, 1)) - 1
plz I nid an explanation of this code
3 Réponses
+ 3
Your Code will not work. Did you mean:
(2 * random.randint (1, 3) - 1)
This will return a random odd Integer between 1 and 5.
+ 3
numpy.random.random((a, b)) creates a (a, b) dimensional array and fills it with random values betweeen [0, 1) so it returns an array with numbers between [-1, 1)
+ 1
I found the Codeline in one Lessons:
https://www.sololearn.com/learn/738/?ref=app
It is Part of the Numpy Lib and creates an Array of three random Numbers between -1 and 1.