I'm trying to make a neural network in python, but I'm having a lot of trouble. Specifically after I have the network set up, what weights to initially assign to each neuron's inputs, the threshold, and evolving the networks to do what you want.(adsbygoogle = window.adsbygoogle || []).push({});

Here is my neuron class.

I am wondering what I should be setting my initial input weights to be? nothing seems to be working...Code (Text):class Neuron:

def __init__(self, inputs):

self.k = inputs

self.t = random.gauss(0,10)

self.b = 1

self.x_avg = inputs**-1

self.x = []

for a in range(0,inputs):

#self.x.append(self.x_avg)

self.x.append(random.gauss(0,10))

def clear(self):

self.x = []

self.b = 1

self.x_avg = 0

def out(self,*insa):

y = []

ins=insa[0]

for a in ins:

y.append(a*self.x[ins.index(a)])

sums = sum(y)-self.t

out = (1+e**-sums)**-1

return out

#def update(self, x_index):

#def update(perchange):

def reset(self):

self.t = random.gauss(0,10)

self.x =[]

for a in range(0,self.k):

#self.x.append(self.x_avg)

self.x.append(random.gauss(0,10))

#def update(self, branch, val):

**Physics Forums | Science Articles, Homework Help, Discussion**

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Trouble with Neural Network coding

**Physics Forums | Science Articles, Homework Help, Discussion**