From 540cb1983b4556fc9541b736bbbd76f2f379467f Mon Sep 17 00:00:00 2001 From: Michael Rosenzweig Date: Sun, 16 Jul 2017 10:20:27 -0400 Subject: [PATCH] rescale should return 0 if stdev is 0 --- code/working_with_data.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/working_with_data.py b/code/working_with_data.py index 5b8e8ac9..08852c3f 100644 --- a/code/working_with_data.py +++ b/code/working_with_data.py @@ -203,7 +203,7 @@ def rescaled(i, j): if stdevs[j] > 0: return (data_matrix[i][j] - means[j]) / stdevs[j] else: - return data_matrix[i][j] + return data_matrix[i][j] - means[j] # should be 0 since stdevs[j] = 0 num_rows, num_cols = shape(data_matrix) return make_matrix(num_rows, num_cols, rescaled)