mohaseeb/shaplets-python

Algorithm fails when time series is not scaled

Closed this issue · 3 comments

Hi,

When I try to run the algorithm on my timeseries dataset which contains raw numbers, I get the below warning:
line 67 in soft_min_layer.py
*** RuntimeWarning: invalid value encountered in double_scalars

I believe its because negative exponential of large number is converted to zero when using numpy's exponent method. As I do not prefer to scale the data, is there any other work around ?

I tried to replace numpy's exp with mpmath's exp method, but I still get the same warning.

Yup, faced the same. Any fix found??

Hi @rsravan91 @tharunShiv

  • Try to use a smaller apha value (in magnitude). Alpha is scaling the exponent, and by default is set to -100 (-100 is the value recommended by the authors). Try some values -1, -10, and see if it helps.
  • You can also try adding a small value to the denominator to prevent division by zero. i.e. change line 67 to something like M = M_numerator / (self.psi + 1e-7) . This will work only if you have few cases when self.psi == 0, cause if self.psi == 0 most of the time then M_numerator will also be zero, and hence the soft minimum distances between the shaplets and the input series.

Sure, thanks! Great work!