Skip to content

Commit

Permalink
ensure that get_moment() uses float computations
Browse files Browse the repository at this point in the history
According to #529, np.arange(4096)**3 overflows on Windows 10 because
dtype is set to int32.  Specify dtype=float to avoid overflows.
  • Loading branch information
dbarbier committed Nov 12, 2019
1 parent e6f5d3e commit ffcab94
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion tsfresh/feature_extraction/feature_calculators.py
Original file line number Diff line number Diff line change
Expand Up @@ -986,7 +986,7 @@ def get_moment(y, moment):
:return: the moment requested
:return type: float
"""
return y.dot(np.arange(len(y))**moment) / y.sum()
return y.dot(np.arange(len(y), dtype=float)**moment) / y.sum()

def get_centroid(y):
"""
Expand Down

0 comments on commit ffcab94

Please sign in to comment.