All pastes #110333 Raw Edit

Stuff

public text v1 · immutable
·published 2006-08-01 15:40 UTC
rendered paste body
class neuron:
	def __init__(self, num_of_inps):
		
		self.weights = []
		#randomzie the values of the weights
		for i in num_of_inps:
			self.weights.append[random()]
		
	
	def run(self, inputs):
		#make sure there is one input for each node
		if len(inputs) != len(self.weights):
			print "Inputs dont match weights"
			return None
			
		sum = 0
		for i,w in zip(inputs, self.weights):
			sum += i * w
			
		return sum