Thanks to visit codestin.com
Credit goes to github.com

Skip to content

"epoches" to "epochs" #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 18, 2017
Merged
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
14 changes: 7 additions & 7 deletions learning.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,11 +434,11 @@ def predict(example):


def NeuralNetLearner(dataset, hidden_layer_sizes=[3],
learning_rate=0.01, epoches=100):
learning_rate=0.01, epochs=100):
"""Layered feed-forward network.
hidden_layer_sizes: List of number of hidden units per hidden layer
learning_rate: Learning rate of gradient descent
epoches: Number of passes over the dataset
epochs: Number of passes over the dataset
"""

i_units = len(dataset.inputs)
Expand All @@ -447,7 +447,7 @@ def NeuralNetLearner(dataset, hidden_layer_sizes=[3],
# construct a network
raw_net = network(i_units, hidden_layer_sizes, o_units)
learned_net = BackPropagationLearner(dataset, raw_net,
learning_rate, epoches)
learning_rate, epochs)

def predict(example):

Expand Down Expand Up @@ -510,7 +510,7 @@ def network(input_units, hidden_layer_sizes, output_units):
return net


def BackPropagationLearner(dataset, net, learning_rate, epoches):
def BackPropagationLearner(dataset, net, learning_rate, epochs):
"""[Figure 18.23] The back-propagation algorithm for multilayer network"""
# Initialise weights
for layer in net:
Expand All @@ -530,7 +530,7 @@ def BackPropagationLearner(dataset, net, learning_rate, epoches):
o_nodes = net[-1]
i_nodes = net[0]

for epoch in range(epoches):
for epoch in range(epochs):
# Iterate over each example
for e in examples:
i_val = [e[i] for i in idx_i]
Expand Down Expand Up @@ -583,13 +583,13 @@ def BackPropagationLearner(dataset, net, learning_rate, epoches):
return net


def PerceptronLearner(dataset, learning_rate=0.01, epoches=100):
def PerceptronLearner(dataset, learning_rate=0.01, epochs=100):
"""Logistic Regression, NO hidden layer"""
i_units = len(dataset.inputs)
o_units = 1 # As of now, dataset.target gives only one index.
hidden_layer_sizes = []
raw_net = network(i_units, hidden_layer_sizes, o_units)
learned_net = BackPropagationLearner(dataset, raw_net, learning_rate, epoches)
learned_net = BackPropagationLearner(dataset, raw_net, learning_rate, epochs)

def predict(example):
# Input nodes
Expand Down