TDAmeritrade / stumpy

STUMPY is a powerful and scalable Python library for modern time series analysis

Home Page:https://stumpy.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Normalize matching patterns for visualization when `normalize==True`

NimaSarajpoor opened this issue · comments

There is a section at the end of the notebook Tutorial_AB_Joins that plots a motif and its nearest neighbour (from another time series). However, the subsequences need to be normalized first. In the example provided in the notebook, the y-values of both time series are (almost) in the same range. But, if a user tries the same steps on a different example where the range of y values are different, they may get a misleading plot.

So, you're thinking that it should be more like:

from stumpy import core
queen_z_norm_motif = core.z_norm(queen_df.iloc[queen_motif_index : queen_motif_index + m].values)
vanilla_ice_z_norm_motif = core.z_norm(vanilla_ice_df.iloc[vanilla_ice_motif_index:vanilla_ice_motif_index+m].values)

plt.plot(queen_z_norm_motif, label='Under Pressure')
plt.plot(vanilla_ice_z_norm_motif, label='Ice Ice Baby')

plt.xlabel('Time')
plt.ylabel('Frequency')

plt.legend()

plt.show()

It probably helps to add an admonition note to explain why we apply z-normalization there (i.e., why is z-norm important)

@seanlaw

you're thinking that it should be more like

(Sorry for the late reply. I totally forgot to get back to you for this one)
Yes!