Norway


So for school i needed to program some , I read online that was suitable and immediately example code popped up. I used lines of code from the following example but when i ran the code it gave me an error. so i just copied the example to make sure it was not an error by me.

this was the code i used:

from numpy import exp, array, random, dot

training_set_inputs = array([[0, 0, 1], [1, 1, 1], [1, 0, 1], [0, 1, 1]])

training_set_outputs = array([[0, 1, 1, 0]]).T

random.seed(1)

synaptic_weights = 2 * random.random((3, 1)) – 1

for iteration in xrange(00):

raw_output = 1 / (1 + exp(-(dot(training_set_inputs, synaptic_weights))))

synaptic_weights += dot(training_set_inputs.T, (training_set_outputs – raw_output) * raw_output * (1 – raw_output))

print (1 / (1 + exp(-(dot(array([1, 0, 0]))))), synaptic_weights)

this was my error:

Traceback (most recent call last):

File “/Users/davidholmes/Desktop/test.py”, line 2, in <module>

from numpy import exp, array, random, dot

ModuleNotFoundError: No module named ‘numpy’

and could someone tell me what libraries are and how to use them and where to get them. thank you for your help!



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here