File tree Expand file tree Collapse file tree 4 files changed +19
-26
lines changed Expand file tree Collapse file tree 4 files changed +19
-26
lines changed Original file line number Diff line number Diff line change @@ -29,14 +29,12 @@ def calcOutputs(self):
2929#
3030# set Weight Updated
3131#
32- # def setWeightsUpdated(self , updatedWeights):
33- # #TODO: testing...
34- # x = len(self.getWeights())
35- # updatedWeightsTemp = updatedWeights[:x]
36- # # if updatedWeights is numpy delete is false
37- # del updatedWeights[:x]
38- # for n in self.neurons:
39- # n.updatedWeights(updatedWeightsTemp)
32+ def setWeightsUpdated (self , updatedWeights ):
33+ #TODO: testing...
34+ x = len (self .neurons [0 ].getNumOfWeights ())
35+ for i in range (0 , len (self .neurons )):
36+ updatedWeightsTemp = updatedWeights [i * x :(i + 1 )* x ]
37+ self .neurons [i ].updatedWeights (updatedWeightsTemp )
4038#
4139#
4240#
Original file line number Diff line number Diff line change @@ -45,15 +45,13 @@ def getOutput(self):
4545#
4646# set weight updated
4747#
48- # def setWeightsUpdated(self , updatedWeights):
49- # #TODO: testing...
50- # x = len(self.getWeights())
51- # updatedWeightsTemp = updatedWeights[:x]
52- # # if updatedWeights is numpy delete is false
53- # updatedWeights = np.array([:x])
54- # for n in self.neurons:
55- # n.updatedWeights(updatedWeightsTemp)
56- #
48+ def setWeightsUpdated (self , updatedWeights ):
49+ #TODO: testing...
50+ x = len (self .neurons [0 ].getNumOfWeights ())
51+ for i in range (0 , len (self .neurons )):
52+ updatedWeightsTemp = updatedWeights [i * x :(i + 1 )* x ]
53+ self .neurons [i ].updatedWeights (updatedWeightsTemp )
54+
5755#
5856#
5957
Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ def calc_output(self):
2828return self .output
2929
3030def updateWeights (self , updatedWeights ):
31- #TODO: delete one elements
3231self .weights = np .array ([])
3332np .copyto (self .weights , updatedWeights )
3433print ("weightsupdated" , self .weights )
Original file line number Diff line number Diff line change @@ -27,14 +27,12 @@ def calcOutputs(self):
2727#
2828# set Weight updated
2929#
30- # def setWeightsUpdated(self , updatedWeights):
31- # #TODO: testing...
32- # x = len(self.getWeights())
33- # updatedWeightsTemp = updatedWeights[:x]
34- # # if updatedWeights is numpy delete is false
35- # del updatedWeights[:x]
36- # for n in self.neurons:
37- # n.updatedWeights(updatedWeightsTemp)
30+ def setWeightsUpdated (self , updatedWeights ):
31+ #TODO: testing...
32+ x = len (self .neurons [0 ].getNumOfWeights ())
33+ for i in range (0 , len (self .neurons )):
34+ updatedWeightsTemp = updatedWeights [i * x :(i + 1 )* x ]
35+ self .neurons [i ].updatedWeights (updatedWeightsTemp )
3836#
3937#
4038#
You can’t perform that action at this time.
0 commit comments