Skip to content

Commit 918168c

Browse files
authored
added LinearRegressionLearner, LogisticRegressionLearner with tests and fixed NeuralNetLearner and PerceptronLearner (#1163)
1 parent 70f4e82 commit 918168c

9 files changed

+506
-399
lines changed

deep_learning4e.py

+170-93
Large diffs are not rendered by default.

learning.py

+1-5
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ def parse_csv(input, delim=','):
201201
return [list(map(num_or_str, line.split(delim))) for line in lines]
202202

203203

204-
def err_ratio(predict, dataset, examples=None, verbose=0):
204+
def err_ratio(predict, dataset, examples=None):
205205
"""
206206
Return the proportion of the examples that are NOT correctly predicted.
207207
verbose - 0: No output; 1: Output wrong; 2 (or greater): Output correct
@@ -215,10 +215,6 @@ def err_ratio(predict, dataset, examples=None, verbose=0):
215215
output = predict(dataset.sanitize(example))
216216
if output == desired:
217217
right += 1
218-
if verbose >= 2:
219-
print(' OK: got {} for {}'.format(desired, example))
220-
elif verbose:
221-
print('WRONG: got {}, expected {} for {}'.format(output, desired, example))
222218
return 1 - (right / len(examples))
223219

224220

0 commit comments

Comments
 (0)