<jupyter_start><jupyter_text><jupyter_code>!pip install stumpy
!pip install realdata
import numpy as np 
import matplotlib.pyplot as plt
import pandas as pd
import stumpy
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.dates as dates
from matplotlib.patches import Rectangle
import datetime as dt
from stumpy import stump
import matplotlib.pyplot as plt<jupyter_output><empty_output><jupyter_text>Demonstration of Stumpy on Live DataFollows https://towardsdatascience.com/stumpy-basics-21844a2d2d92<jupyter_code>from realdata import get_values
y = []
while len(y)<500:
    y = get_values()

plt.plot(y)
m = 300
y_motifs = stump(y, m)
fig, axs = plt.subplots(2, sharex=True, gridspec_kw={'hspace': 0})
plt.suptitle('Motif (Pattern) Discovery', fontsize='30')
axs[0].plot(y)
axs[0].set_ylabel('Steam Flow', fontsize='20')
rect = Rectangle((643, 0), m, 40, facecolor='lightgrey')
axs[0].add_patch(rect)
rect = Rectangle((8724, 0), m, 40, facecolor='lightgrey')
axs[0].add_patch(rect)
axs[1].set_xlabel('Time', fontsize ='20')
axs[1].set_ylabel('Matrix Profile', fontsize='20')
axs[1].axvline(x=643, linestyle="dashed")
axs[1].axvline(x=8724, linestyle="dashed")
axs[1].plot(y_motifs[:, 0])<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.14227970897332257, 'fraction_numerical': 0.0444624090541633, 'mean_word_length': 7.537931034482758, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 9, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '644248', 'license': 'MIT', 'n_tokens_mistral': 520, 'n_tokens_neox': 478, 'n_words': 108, 'path': 'stumpy_hello.ipynb', 'repo_name': 'PatrikDurdevic/timeseries-notebooks', 'size': '1237'}