Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 2 additions & 5 deletions FullConnectedNetwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ class Layer(object):
def __init__(self,layer_index,node_count):
self.layer_index = layer_index
self.node_count = node_count
self.nodes = []
for i in range(self.node_count):
self.nodes.append(Node(layer_index,i))
self.nodes = [Node(layer_index,i) for i in range(self.node_count)]

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function sigmoid.Layer.__init__ refactored with the following changes:

self.nodes.append(ConstNode(layer_index,self.node_count))

def set_output(self,data):#input layer x1,x2,x3...
Expand Down Expand Up @@ -125,8 +123,7 @@ def __init__(self,layers):#layers[i] <----> # of nodes in layer i
layer_count = len(layers)
node_count = 0
#how many layers?
for i in range(layer_count):
self.layers.append(Layer(i,layers[i]))
self.layers.extend(Layer(i,layers[i]) for i in range(layer_count))
Comment on lines -128 to +126

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function sigmoid.Network.__init__ refactored with the following changes:

for layer in range(layer_count - 1):
connections = [Connection(upstream_node,downstream_node)
for upstream_node in self.layers[layer].nodes
Expand Down
2 changes: 1 addition & 1 deletion Perceptron.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def predict(self,input_vec):
list(map(lambda x:x[0] * x[1],list(zip(input_vec,self.weights))))) + self.bias)

def train(self, input_vec ,labels, iteration,rate):
for i in range(iteration):
for _ in range(iteration):

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Function Perceptron.train refactored with the following changes:

self._one_iteration(input_vec,labels,rate)

def _one_iteration(self,input_vec,labels,rate):
Expand Down