+ 2

self.weights = 2 * random.random((3, 1)) - 1

plz I nid an explanation of this code

29th Aug 2018, 4:44 PM
Pablo Escobar
Pablo Escobar - avatar
3 Antworten
+ 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.
29th Aug 2018, 4:59 PM
Sebastian Keßler
Sebastian Keßler - avatar
+ 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)
29th Aug 2018, 8:29 PM
Mert Yazıcı
Mert Yazıcı - avatar
+ 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.
29th Aug 2018, 8:31 PM
Sebastian Keßler
Sebastian Keßler - avatar