diff --git a/core/data_processor.py b/core/data_processor.py index f535eda..4fae274 100644 --- a/core/data_processor.py +++ b/core/data_processor.py @@ -72,13 +72,14 @@ def _next_window(self, i, seq_len, normalise): def normalise_windows(self, window_data, single_window=False): '''Normalise window with a base value of zero''' + eps = 0.00001 normalised_data = [] window_data = [window_data] if single_window else window_data for window in window_data: normalised_window = [] for col_i in range(window.shape[1]): - normalised_col = [((float(p) / float(window[0, col_i])) - 1) for p in window[:, col_i]] + normalised_col = [((float(p) / (float(window[0, col_i]) + eps) ) - 1) for p in window[:, col_i]] normalised_window.append(normalised_col) normalised_window = np.array(normalised_window).T # reshape and transpose array back into original multidimensional format normalised_data.append(normalised_window) - return np.array(normalised_data) \ No newline at end of file + return np.array(normalised_data)