From b352df79a12512140f278fb6ddfa1ca0f527fbe0 Mon Sep 17 00:00:00 2001 From: Chipe1 Date: Mon, 6 Mar 2017 21:38:20 +0530 Subject: [PATCH 1/2] changed mean boolean error --- learning.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/learning.py b/learning.py index 24554ff22..f7b7d7095 100644 --- a/learning.py +++ b/learning.py @@ -37,7 +37,8 @@ def manhattan_distance(predictions, targets): def mean_boolean_error(predictions, targets): - return mean([(p != t) for p, t in zip(predictions, targets)]) + errors = [(p != t) for p, t in zip(predictions, targets)] + return sum(errors)/len(errors) # ______________________________________________________________________________ From 1d73bc6f83e9328a335f60a9f957c0971c8a2a17 Mon Sep 17 00:00:00 2001 From: Peter Norvig Date: Mon, 6 Mar 2017 21:32:30 -0800 Subject: [PATCH 2/2] Update learning.py --- learning.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/learning.py b/learning.py index f7b7d7095..38efcecf2 100644 --- a/learning.py +++ b/learning.py @@ -37,8 +37,7 @@ def manhattan_distance(predictions, targets): def mean_boolean_error(predictions, targets): - errors = [(p != t) for p, t in zip(predictions, targets)] - return sum(errors)/len(errors) + return mean(int(p != t) for p, t in zip(predictions, targets)) # ______________________________________________________________________________