Skip to content

Commit

Permalink
fix normalize
Browse files Browse the repository at this point in the history
References - incorrect normalize method linkedin#40
  • Loading branch information
earthgecko committed Jan 8, 2018
1 parent 95161ae commit 3adf692
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/luminol/modules/time_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -282,13 +282,14 @@ def add_offset(self, offset):

def normalize(self):
"""
Return a new time series with all values normalized to 0 to 1.
Return a new time series with all values normalized between 0 and 1.
:return: `None`
"""
maximum = self.max()
if maximum:
self.values = [value / maximum for value in self.values]
minimum = self.min()
self.values = [((value - minimum) / (maximum - minimum)) for value in self.values]

def crop(self, start_timestamp, end_timestamp):
"""
Expand Down

0 comments on commit 3adf692

Please sign in to comment.