Skip to content

Commit e6ccd2f

Browse files
committed
delete the elements of an array
1 parent 87da277 commit e6ccd2f

File tree

4 files changed

+50
-46
lines changed

4 files changed

+50
-46
lines changed

hidden_layer.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,20 @@ def calcOutputs(self):
2626
for n in self.neurons:
2727
self.outputValues.append(n.calc_output())
2828

29-
def setWeightsUpdated(self , updatedWeights):
30-
#TODO: testing...
31-
x = len(self.getWeights())
32-
updatedWeightsTemp = updatedWeights[:x]
33-
# if updatedWeights is numpy delete is false
34-
del updatedWeights[:x]
35-
for n in self.neurons:
36-
n.updatedWeights(updatedWeightsTemp)
29+
#
30+
# set Weight Updated
31+
#
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)
40+
#
41+
#
42+
#
3743

3844
def getOutput(self):
3945
return self.outputValues

input_layer.py

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,22 @@ def calcOutputs(self):
4242
def getOutput(self):
4343
return self.outputValues
4444

45-
def setWeightsUpdated(self , updatedWeights):
46-
#TODO: testing...
47-
x = len(self.getWeights())
48-
updatedWeightsTemp = updatedWeights[:x]
49-
# if updatedWeights is numpy delete is false
50-
del updatedWeights[:x]
51-
for n in self.neurons:
52-
n.updatedWeights(updatedWeightsTemp)
53-
54-
45+
#
46+
# set weight updated
47+
#
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+
#
57+
#
58+
#
5559

56-
def getWeights(self ):
60+
def getWeights(self):
5761
li = []
5862
for n in self.neurons:
5963
li.extend(n.getWeights())

neuron.py

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -27,30 +27,18 @@ def calc_output(self):
2727
self.calc_activation()
2828
return self.output
2929

30-
def updateWeights(self, updatedWeights):
31-
#TODO: delete one elements
32-
self.weights = self.weights[-1]
33-
self.weights = np.delete(self.weights , 0)
34-
self.weights = updatedWeights
30+
# def updateWeights(self, updatedWeights):
31+
# #TODO: delete one elements
32+
# self.weights = self.weights[-1]
33+
# self.weights = np.delete(self.weights , 0)
34+
# np.place(self.weights , updatedWeights , )
3535

3636
def setNewInput(self, newInput):
3737
cnt = 0
3838
#print ("newInput in Neuron: " ,newInput)
39-
40-
#
41-
#
42-
# TODO:delete elemet
43-
#
44-
#
45-
#
46-
# self.pixel_values = self.pixel_values[-1]
47-
# self.pixel_values = np.delete(self.pixel_values , 0)
48-
#print(self.pixel_values)
49-
39+
self.pixel_values = np.array([])
40+
print("pixel" , self.pixel_values)
5041
#print(type(newInput))
51-
#for i in range (0,newInput.length):
52-
#cnt +=1
53-
#print(cnt)
5442
self.pixel_values = np.asarray(newInput)
5543
#print(len(newInput))
5644
#print(self.pixel_values.size)

output_layer.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,20 @@ def calcOutputs(self):
2424
for n in self.neurons:
2525
self.outputValues.append(n.calc_output())
2626

27-
def setWeightsUpdated(self , updatedWeights):
28-
#TODO: testing...
29-
x = len(self.getWeights())
30-
updatedWeightsTemp = updatedWeights[:x]
31-
# if updatedWeights is numpy delete is false
32-
del updatedWeights[:x]
33-
for n in self.neurons:
34-
n.updatedWeights(updatedWeightsTemp)
27+
#
28+
# set Weight updated
29+
#
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)
38+
#
39+
#
40+
#
3541

3642
def getOutput(self):
3743
return self.outputValues

0 commit comments

Comments
 (0)