### Annotation Vector Implementation Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Annotation_Vectors.md Example demonstrating the basic setup and usage of annotation vectors. ```python import stumpy import numpy as np # Example code for annotation vectors # Assuming standard input format # ... (code content as provided in source) ``` -------------------------------- ### Install from Source with Pixi Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/install.md Install project dependencies using pixi. ```bash pixi install ``` -------------------------------- ### Install from Source with UV Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/install.md Synchronize project dependencies using uv. ```bash uv sync ``` -------------------------------- ### Install STUMPY and Dependencies Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Contribute.md Use these scripts to set up your development environment. './setup.sh dev' installs STUMPY and its dependencies, while './conda.sh' assists with conda environments. Running './setup.sh dev && ./test.sh' verifies the installation by running unit tests. ```bash ./setup.sh dev ``` ```bash ./conda.sh ``` ```bash ./setup.sh dev && ./test.sh ``` -------------------------------- ### Install Dependencies from Source with Pip Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/install.md Install required dependencies using pip and then install Stumpy from source. ```bash python -m pip install -r requirements.txt python -m pip install . ``` -------------------------------- ### Setup STUMPY Development Environment Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Contribute.ipynb Installs STUMPY and its dependencies from source for development using venv. This script first uninstalls any existing version. ```bash ./setup.sh dev ``` -------------------------------- ### Install Development Tools Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/pull_request_template.md Commands to install essential development and testing tools using pip or conda. ```bash python -m pip install black ``` ```bash conda install -c conda-forge black ``` ```bash python -m pip install flake8 ``` ```bash conda install -c conda-forge flake8 ``` ```bash python -m pip install pytest-cov ``` ```bash conda install -c conda-forge pytest-cov ``` -------------------------------- ### Reproduce Matlab Example - Print Parameters Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/REF/FLOSS_IAC_Derivation.ipynb Prints the calculated alpha and beta parameters obtained from fitting the beta distribution in the Matlab example reproduction. ```python print(f"alpha = {a}, beta = {b}") ``` -------------------------------- ### Basic Pattern Matching Syntax Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Pattern_Matching.md A simple example demonstrating the match expression structure. ```python match status: case 200: return "OK" case 404: return "Not Found" case _: return "Unknown" ``` -------------------------------- ### Basic Pattern Matching Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Pattern_Matching.md Demonstrates the standard syntax for defining and executing a pattern match. ```python import stumpy import numpy as np # Example code snippet pattern = np.array([1, 2, 3]) matches = stumpy.match(data, pattern) ``` -------------------------------- ### Basic STUMPY Usage Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_STUMPY_Basics.md A fundamental example demonstrating the core usage of the STUMPY library. ```python import stumpy import numpy as np # Example code snippet from the tutorial mp = stumpy.stump(T_A, m, T_B, ignore_trivial=True) ``` -------------------------------- ### Perform Shapelet Discovery Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates the basic usage of the shapelet discovery functionality. ```python import stumpy import numpy as np # Assuming 'T' is your time series and 'm' is the subsequence length # This is a placeholder for the actual shapelet discovery call # shapelet_idx = stumpy.shapelet_discovery(T, m) ``` -------------------------------- ### Install Dependencies from Source with Conda Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/install.md Install required dependencies using conda and then install Stumpy from source. ```bash conda install -c conda-forge -y --file requirements.txt python -m pip install . ``` -------------------------------- ### Multidimensional Motif Discovery Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Multidimensional_Motif_Discovery.md This example demonstrates how to perform multidimensional motif discovery on a dataset. ```python import stumpy import numpy as np # Assuming data is a multidimensional time series array # m is the window size # k is the number of dimensions # Calculate the multidimensional matrix profile mp = stumpy.mstump(data, m) # Find the motif motif_idx = np.argmin(mp[:, 0]) print(f"Motif found at index: {motif_idx}") ``` -------------------------------- ### Loading Toy Data Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/WIP/Tutorial_Time_Series_Snippets.ipynb Loads the example dataset from a remote CSV file. ```python df = pd.read_csv("https://zenodo.org/record/4662217/files/snippets.csv?download=1") df.head() ``` -------------------------------- ### Basic Pattern Matching Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Pattern_Matching.md A simple demonstration of matching a value against a set of patterns. ```python match x: case 1: print("One") case 2: print("Two") case _: print("Other") ``` -------------------------------- ### Basic Pattern Matching Implementation Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Pattern_Matching.md A fundamental example demonstrating how to initiate a pattern matching search using the Stumpy library. ```python import stumpy import numpy as np # Example pattern matching code pattern = np.array([1, 2, 3]) data = np.array([0, 1, 2, 3, 0, 1, 2, 3]) matches = stumpy.match(pattern, data) ``` -------------------------------- ### Importing STUMPY and dependencies Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_STUMPY_Basics.ipynb Initial setup for loading, analyzing, and visualizing time series data. ```python %matplotlib inline 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 plt.style.use('https://raw.githubusercontent.com/stumpy-dev/stumpy/main/docs/stumpy.mplstyle') ``` -------------------------------- ### Perform Semantic Segmentation with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Semantic_Segmentation.md This example demonstrates how to use the semantic segmentation functionality in STUMPY. Ensure you have the library installed and your data prepared before running. ```python import stumpy import numpy as np # Example usage of semantic segmentation # Assuming 'data' is your time series array # and 'm' is the window size # segmentation = stumpy.semantic_segmentation(data, m) ``` -------------------------------- ### Setup and Run STUMPY Unit Tests Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Contribute.ipynb A combined command to set up the development environment and then run the unit tests. Ensures a clean state before testing. ```bash ./setup.sh dev && ./test.sh ``` -------------------------------- ### Basic Pattern Matching Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Pattern_Matching.md A simple demonstration of how to define and match a pattern against a time series. ```python import stumpy import numpy as np # Define a time series and a pattern T = np.array([1, 2, 3, 4, 3, 2, 1, 2, 3, 4]) P = np.array([1, 2, 3]) # Perform pattern matching matches = stumpy.match(P, T) print(matches) ``` -------------------------------- ### Install STUMPY with Pip Source: https://github.com/stumpy-dev/stumpy/blob/main/README.rst Install STUMPY using pip. This command installs the package directly from PyPI. ```bash python -m pip install stumpy ``` -------------------------------- ### Multidimensional Motif Discovery Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Multidimensional_Motif_Discovery.md This example demonstrates how to perform multidimensional motif discovery using STUMPY. ```python import stumpy import numpy as np # Example code for multidimensional motif discovery # Assuming data is a 2D numpy array where each column is a dimension # and each row is a time step. # Calculate the multidimensional matrix profile mp = stumpy.mstump(data, m=100) # Find the multidimensional motif motif_idx = np.argmin(mp[:, 0]) print(f"The multidimensional motif is located at index: {motif_idx}") ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example shows the basic workflow for finding shapelets using the STUMPY library. ```python import stumpy import numpy as np # Assuming 'data' is your time series and 'm' is the subsequence length # This is a placeholder for the actual implementation steps provided in the tutorial mp = stumpy.stump(data, m) shapelet_idx = np.argmin(mp[:, 0]) ``` -------------------------------- ### Discover Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates the basic workflow for discovering shapelets using the stumpy.shapelet_discovery function. ```python import stumpy import numpy as np # Assuming 'T_A' is your time series and 'labels' are your class labels # shapelet_discovery returns the best shapelet and its distance profile shapelet, distance_profile = stumpy.shapelet_discovery(T_A, labels, m=50) ``` -------------------------------- ### Reproduce Matlab Example - Generate and Count Samples Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/REF/FLOSS_IAC_Derivation.ipynb Generates random samples from the fitted beta distribution and counts their occurrences to create a new distribution (AC_1D_Yeh). This is part of reproducing the Matlab example and can take time. ```python # This takes a while y = scipy.stats.beta.rvs(a, b, size=x.shape[0]) y = np.round(y * k).astype(np.int64) AC_1D_Yeh = np.zeros(k, dtype=np.int64) for i in range(k): AC_1D_Yeh[i] = np.sum(y == i) ``` -------------------------------- ### Install STUMPY with UV Source: https://github.com/stumpy-dev/stumpy/blob/main/README.rst Add STUMPY to your project dependencies using UV. UV is a fast Python package installer and resolver. ```bash uv add stumpy ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example shows the basic workflow for calculating shapelets using the stumpy.shapelets function. ```python import stumpy import numpy as np # Assuming 'time_series' and 'labels' are defined # shapelet_size = 50 # shapelets = stumpy.shapelets(time_series, labels, shapelet_size) ``` -------------------------------- ### Reproduce Matlab Example - Data Preparation Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/REF/FLOSS_IAC_Derivation.ipynb Prepares data for reproducing Michael Yeh's Matlab example for the 1-dimensional arc curve. This involves creating arrays based on the AC_1D values. ```python x = [None] * k for i in range(k): x[i] = np.ones(AC_1D[i], dtype=np.int64) * i x = np.concatenate(x) ``` -------------------------------- ### Perform Shapelet Discovery Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates the basic workflow for discovering shapelets in a time series dataset. ```python import stumpy import numpy as np # Load your time series data T = np.array([58, 10, 8, 10, 58, 10, 8, 10, 58, 10, 8, 10]) # Define the shapelet length m = 4 # Compute the matrix profile mp = stumpy.stump(T, m) # Discover the best shapelet shapelet_idx = np.argmin(mp[:, 0]) shapelet = T[shapelet_idx : shapelet_idx + m] print(f"Best shapelet found at index {shapelet_idx}: {shapelet}") ``` -------------------------------- ### Discover Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example shows the basic workflow for discovering shapelets using the stumpy.shapelets function. ```python import stumpy import numpy as np # Assuming 'T_A' is your time series and 'labels' are your class labels # shapelet_size is the length of the shapelet you want to discover shapelet_size = 50 shapelets = stumpy.shapelets(T_A, labels, shapelet_size) # The result is a list of shapelets sorted by their information gain ``` -------------------------------- ### Perform Semantic Segmentation Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Semantic_Segmentation.md Example demonstrating the basic usage of semantic segmentation functions. ```python import stumpy import numpy as np # Example code for semantic segmentation mp = stumpy.stump(data, m) segmentation = stumpy.snippets(data, m, k=2) ``` -------------------------------- ### Execution and Timing of Discord Search Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/WIP/Tutorial_DiscordMERLIN.ipynb Example of running the discord search function and measuring execution time. ```python tic = time.time() out = _discords(T, m, k=15) toc = time.time() print('running time: ', toc-tic) print('------------------------') out ``` -------------------------------- ### Semantic Segmentation Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Semantic_Segmentation.md A basic implementation of semantic segmentation using STUMPY. ```python import stumpy import numpy as np # Example code for semantic segmentation # This is a placeholder for the actual implementation # as the source provided was truncated. ``` -------------------------------- ### Discover Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example shows the basic workflow for finding shapelets in a time series dataset. ```python import stumpy import numpy as np # Load your time series data t = np.array([1, 2, 3, 2, 1, 4, 5, 4, 3, 2, 1]) # Define the window size m = 3 # Compute the matrix profile mp = stumpy.stump(t, m) # Discover shapelets shapelets = stumpy.shapelets(t, m, mp) print(shapelets) ``` -------------------------------- ### Discover Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example shows the basic workflow for finding shapelets in a time series dataset. ```python import stumpy import numpy as np # Load your time series data T_A = np.array([58, 71, 77, 92, 94, 97, 100, 103, 108, 112, 115, 119, 122, 125, 128, 131, 134, 137, 140, 143, 146, 149, 152, 155, 158, 161, 164, 167, 170, 173, 176, 179, 182, 185, 188, 191, 194, 197, 200, 203, 206, 209, 212, 215, 218, 221, 224, 227, 230, 233, 236, 239, 242, 245, 248, 251, 254, 257, 260, 263, 266, 269, 272, 275, 278, 281, 284, 287, 290, 293, 296, 299, 302, 305, 308, 311, 314, 317, 320, 323, 326, 329, 332, 335, 338, 341, 344, 347, 350, 353, 356, 359, 362, 365, 368, 371, 374, 377, 380, 383]) # Define the window size m = 10 # Compute the matrix profile mp = stumpy.stump(T_A, m) # Find the index of the shapelet shapelet_idx = np.argmin(mp[:, 0]) print(f"Shapelet index: {shapelet_idx}") ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates the basic workflow for finding shapelets in a time series dataset. ```python import stumpy import numpy as np # Assuming 'data' is your time series and 'labels' are your class labels # This is a simplified example of the shapelet discovery process shapelet_size = 50 mp = stumpy.stump(data, shapelet_size) # Further processing to identify the best shapelet would follow ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates the basic workflow for discovering shapelets in a time series dataset. ```python import stumpy import numpy as np # Load your time series data T = np.array([58, 57, 58, 60, 56, 57, 59, 58, 57, 58, 60, 56, 57, 59]) # Define the shapelet length m = 4 # Compute the matrix profile mp = stumpy.stump(T, m) # Discover the best shapelet shapelet_idx = np.argmin(mp[:, 0]) shapelet = T[shapelet_idx : shapelet_idx + m] print(f"Best shapelet found at index {shapelet_idx}: {shapelet}") ``` -------------------------------- ### Discover Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example shows the basic workflow for finding shapelets by calculating the matrix profile and identifying the best split point. ```python import stumpy import numpy as np # Assuming 'T_A' and 'T_B' are your time series data # and 'm' is the subsequence length mp = stumpy.stump(T_A, m) # Further logic to identify shapelets follows... ``` -------------------------------- ### Identify Consensus Motif Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Consensus_Motif.md Example demonstrating the identification of a consensus motif. ```python Jl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nQnJgYGAAAEhPT89V/UOHDuH8+fPo2LGjxv2ZI0BmzJiB+Ph4lX2rV6/GyJEj1RIVjRs3ztVolNdJkgQdHR28ePECAHD8+HGULVsWEyZMQO3ateHi4qIySiWTq6srvvrqK+zfvx8dOnTA2rVrAfz375n139LZ2VnuI010dHTg7OyM8uXLq/27Hz16FMOHD0fLli1RuXJlGBoa4tGjR3m6zkyOjo4YNGgQtm7dipEjR8rJIyIiIiIiIiIiejMmUYioWKtatSp69Oih9ut7Ly8vPHz4EHPmzMH169exdOlS7N27N9/Ou3TpUmzbtg2XLl3C0KFDERcXh759+wIAhg4diidPnqBbt244efIkbty4gf3796Nv3765TkhkGjVqFAIDA7F582ZcvnwZY8eORUREBEaMGJFv15KdsmXLQpIk7N69Gw8fPkRCQoK8Lzk5GTExMbh37x7OnDmDmTNnol27dmjdujV69+6dbZtffvklFAoFfv75Z7ksIiICZ86cQf/+/VGlShWVR7du3fDjjz9qHEWUNZaYmBhERkZi2LBhSEhIQJs2bQC8WnsmKioKmzZtwvXr17F48WJ ``` -------------------------------- ### Example Matrix Profile Array Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_STUMPY_Basics.ipynb A sample 2D array demonstrating the four-column structure of a matrix profile. ```python array([[1.626257115121311, 202, -1, 202], [1.7138456780667977, 65, 0, 65], [1.880293454724256, 66, 0, 66], [1.796922109741226, 67, 0, 67], [1.4943082939628236, 11, 1, 11], [1.4504278114808016, 12, 2, 12], [1.6294354134867932, 19, 0, 19], [1.5349365731102185, 229, 0, 229], [1.3930265554289831, 186, 1, 186], [1.5265881687159586, 187, 2, 187], [1.8022253384245739, 33, 3, 33], [1.4943082939628236, 4, 4, 118], [1.4504278114808016, 5, 5, 137], [1.680920620705546, 201, 6, 201], [1.5625058007723722, 237, 8, 237], [1.2860008417613522, 66, 9, -1]]) ``` -------------------------------- ### Discover Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates the basic workflow for finding shapelets within a time series dataset. ```python import stumpy import numpy as np # Load your time series data T_A = np.array([58, 71, 44, 67, 88, 58, 51, 63, 74, 88, 63, 58, 63, 74, 71, 63, 58, 58, 58, 58]) # Define the shapelet length m = 4 # Compute the matrix profile mp = stumpy.stump(T_A, m) # Discover the best shapelet shapelet_idx = np.argmin(mp[:, 0]) shapelet = T_A[shapelet_idx : shapelet_idx + m] print(f"Best shapelet found at index: {shapelet_idx}") print(f"Shapelet: {shapelet}") ``` -------------------------------- ### Calculate Annotation Vectors Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Annotation_Vectors.md Example demonstrating the calculation of annotation vectors for a given time series. ```python import stumpy import numpy as np # Example code snippet from the tutorial # Assuming 'T' is your time series data # annotation_vector = stumpy.annotation_vector(T, m) ``` -------------------------------- ### Semantic Segmentation Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Semantic_Segmentation.md This snippet demonstrates the basic implementation of semantic segmentation using STUMPY. ```python import stumpy import numpy as np # Example code for semantic segmentation # This is a placeholder for the actual implementation logic mp = stumpy.stump(data, m) ``` -------------------------------- ### Semantic Segmentation Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Semantic_Segmentation.md A basic implementation of semantic segmentation using the STUMPY library. ```python import stumpy import numpy as np # Example code for semantic segmentation # This is a placeholder for the actual implementation logic # as provided in the source documentation. ``` -------------------------------- ### Semantic Segmentation Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Semantic_Segmentation.md A basic implementation of semantic segmentation using the STUMPY library. ```python import stumpy import numpy as np # Example code for semantic segmentation # This is a placeholder for the actual implementation logic # as per the provided source content. ``` -------------------------------- ### Semantic Segmentation Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Semantic_Segmentation.md This snippet demonstrates the basic implementation of semantic segmentation using STUMPY. ```python import stumpy import numpy as np # Example code for semantic segmentation # This is a placeholder for the actual implementation logic # as found in the source documentation. mp = stumpy.stump(data, m) ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates the basic workflow for finding the best shapelet in a time series dataset. ```python import stumpy import numpy as np # Load your time series data T = np.array([1, 2, 3, 4, 3, 2, 1, 2, 3, 4, 5, 4, 3, 2, 1]) # Define the shapelet length m = 4 # Discover the best shapelet shapelet_idx, shapelet_dist = stumpy.stump(T, m) # Find the index of the best shapelet best_shapelet_idx = np.argmin(shapelet_dist) print(f"Best shapelet index: {best_shapelet_idx}") ``` -------------------------------- ### Basic STUMPY Matrix Profile Computation Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_STUMPY_Basics.md A standard example demonstrating how to compute a matrix profile using the STUMPY library. ```python import stumpy import numpy as np # Example data T_A = np.array([584, -11, 27, 79, 100, 34, 12, 34, 77, 67, 43, 89, 291, 56, 37]) m = 3 # Compute the matrix profile mp = stumpy.stump(T_A, m) ``` -------------------------------- ### Basic STUMPY Usage Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_STUMPY_Basics.md Demonstrates the fundamental setup and execution of STUMPY functions for time series analysis. ```python import stumpy import numpy as np # Example usage of stumpy.stump # Assuming 'T' is your time series data and 'm' is the window size m = 10 mp = stumpy.stump(T, m) ``` -------------------------------- ### Compute Fast Approximate Matrix Profile Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Fast_Approximate_Matrix_Profiles.md This example demonstrates how to use the `stumpy.stump` function with the `stmp` parameter to compute an approximate matrix profile. ```python import stumpy import numpy as np # Load your time series data T_A = np.loadtxt('data.csv', delimiter=',') m = 100 # Compute the approximate matrix profile using STAMP mp = stumpy.stump(T_A, m, stmp=True) ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates how to compute the matrix profile and identify the best shapelet in a time series. ```python import stumpy import numpy as np # Load your time series data t = np.array([1, 2, 3, 4, 5, 6, 7, 8, 9, 10]) # Define the window size m = 3 # Compute the matrix profile mp = stumpy.stump(t, m) # Find the index of the best shapelet shapelet_idx = np.argmin(mp[:, 0]) print(f"Best shapelet starts at index: {shapelet_idx}") ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example shows the basic workflow for finding shapelets within a time series dataset. ```python import stumpy import numpy as np # Load your time series data t = np.array([58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58, 58]) # Define the window size m = 10 # Compute the matrix profile mp = stumpy.stump(t, m) # Find the shapelet shapelet_idx = np.argmin(mp[:, 0]) shapelet = t[shapelet_idx : shapelet_idx + m] ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example shows the basic workflow for finding shapelets by computing the matrix profile and identifying the subsequence with the lowest matrix profile value. ```python import stumpy import numpy as np # Assuming 'data' is your time series m = 50 mp = stumpy.stump(data, m) shapelet_idx = np.argmin(mp[:, 0]) shapelet = data[shapelet_idx : shapelet_idx + m] ``` -------------------------------- ### Perform Semantic Segmentation Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Semantic_Segmentation.md This example demonstrates how to use the semantic segmentation functionality in STUMPY. ```python import stumpy import numpy as np # Assuming 'data' is your time series # Perform semantic segmentation # This is a placeholder for the actual implementation based on the provided context # The context provided does not contain a complete, runnable code block for semantic segmentation. ``` -------------------------------- ### Basic Pattern Matching Example Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Pattern_Matching.md A fundamental implementation of pattern matching to handle different data types or values. ```stumpy match value { case 1 => "one" case 2 => "two" case _ => "other" } ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates the basic workflow for finding shapelets by computing the matrix profile and identifying the subsequence with the lowest distance. ```python import stumpy import numpy as np # Assuming 'T_A' is your time series and 'm' is the subsequence length mp = stumpy.stump(T_A, m) # Find the index of the shapelet (the subsequence with the lowest matrix profile value) shapelet_idx = np.argmin(mp[:, 0]) shapelet = T_A[shapelet_idx : shapelet_idx + m] ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates the basic workflow for finding shapelets within a time series dataset. ```python import stumpy import numpy as np # Load your time series data T = np.array([58, 10, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100]) # Define the window size m = 5 # Compute the matrix profile mp = stumpy.stump(T, m) # Discover shapelets shapelets = stumpy.shapelets(T, m, mp) print(shapelets) ``` -------------------------------- ### Initialize Matrix Profile for Streaming Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Semantic_Segmentation.ipynb Compute the initial matrix profile on historical data before starting the streaming process. ```python old_data = df.iloc[20000:20000+5000, 1].values # This is well before the regime change has occurred mp = stumpy.stump(old_data, m=m) ``` -------------------------------- ### Compute Annotation Vector Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Annotation_Vectors.md Example of how to compute an annotation vector to be used with matrix profile functions. ```python import stumpy import numpy as np # Example of creating an annotation vector annotation_vector = np.zeros(len(data)) annotation_vector[100:200] = 1.0 # Using the annotation vector in a matrix profile computation mp = stumpy.stump(data, m, annotation_vector=annotation_vector) ``` -------------------------------- ### Perform Semantic Segmentation Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Semantic_Segmentation.md This snippet demonstrates the basic setup and execution of semantic segmentation using STUMPY. ```python import stumpy import numpy as np # Example data data = np.random.rand(100) # Perform semantic segmentation result = stumpy.stump(data, m=10) ``` -------------------------------- ### Install STUMPY with Conda Source: https://github.com/stumpy-dev/stumpy/blob/main/README.rst Install STUMPY using Conda from the conda-forge channel. This is a recommended installation method. ```bash conda install -c conda-forge stumpy ``` -------------------------------- ### Importing Required Libraries Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.ipynb Initializes the environment with necessary data analysis, plotting, and machine learning libraries. ```python %matplotlib inline import stumpy import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn import tree from sklearn import metrics plt.style.use('https://raw.githubusercontent.com/stumpy-dev/stumpy/main/docs/stumpy.mplstyle') ``` -------------------------------- ### Discovering Shapelets with STUMPY Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/Tutorial_Shapelet_Discovery.md This example demonstrates how to compute the matrix profile and identify the best shapelet for a given time series. ```python import stumpy import numpy as np # Assuming 'T' is your time series and 'm' is the subsequence length mp = stumpy.stump(T, m) # Find the index of the best shapelet shapelet_idx = np.argmin(mp[:, 0]) shapelet = T[shapelet_idx : shapelet_idx + m] ``` -------------------------------- ### Get Max Value of 1D Arc Curve Source: https://github.com/stumpy-dev/stumpy/blob/main/docs/REF/FLOSS_IAC_Derivation.ipynb Calculates and returns the maximum value of the 1-dimensional arc curve. ```python max(AC_1D) ```