Interactive Bokeh Viz for STUMPY

Hi, all! Thank you for all that you do. As a long time user, I really love Bokeh!

I had developed a bokeh viz a few years ago to help identify patterns within time series data using the STUMPY package. I finally managed to find some time and figured out how to serve the app on Heroku:

http://stumpy-live-demo.herokuapp.com/demo

At the top is a time series that contains a single reference subsequence that roughly repeats itself once. In the middle is something called the “matrix profile” which essentially is a plot of distances showing how far (by z-normalized Euclidean distance) any subsequence is to its nearest neighbor (i.e., how similar is the highlighted, green window to its closest match (colored in grey) along the time series). Finally, the “pattern overlay” simply shows the pattern and the match overlaid on top of each other and zoomed in to demonstrate where they are similar/different. The large number corresponds to the distance between the reference window (green) and its nearest neighbor (grey). Essentially, the global minima within the matrix profile gives you the best subsequence matches while the global maxima within the matrix profile identifies the outlier (where there is no good match for).

Additionally, the play button/slider allows you to control which subsequence (or reference window) to highlight and focus on. So, as you move the green reference window from left to right, notice that its nearest neighbor (grey) can come before or after the green box (i.e., your best match can exist in the future OR in the past). The Green vertical line helps to visually align the reference window to the precise value of the matrix profile.

4 Likes

Hi Sean_Law!

This is great, and you explain it very well! We’d like to tweet about it, if that’s alright with you?

1 Like

Yes, that would be great! You can find me at @seanmylaw and the STUMPY handle is @stumpy_dev. Full disclosure, I am the creator and core maintainer of the STUMPY library. Thank you!

Great showcase and great to see you here on the Discourse @Sean_Law!

1 Like

Thanks, @Bryan! Stay safe out there

Hi Sean, really love this demo!! I am wondering is it possible to replace the demo data with mine?

1 Like

@Michael_Li Currently, the demo is somewhat hardcoded for this data set (i.e., the subsequence length is cherry-picked) and building dashboards like this isn’t something that I’d want to spend my time supporting. However, the code is available but please use at your own risk:

Thank you so much. No this is great, this is exactly what I needed. to visualize the my matrix profile. On the m value, I changed self.m = 50 but seems not working, is there anything else i need to change?

It’s been a while since I’ve looked at the code but I recommend filing a Github issue on that repo.