Skip to main content

A package for generating semi-synthetic time series using morphing techniques.

Project description

tsMorph

tsMorph is a Python package designed to generate semi-synthetic time series through morphing techniques. It enables the systematic transformation between two given time series, facilitating robust performance evaluation of forecasting models.

This package is based on the paper:
Santos, M., de Carvalho, A., & Soares, C. (2024). Enhancing Algorithm Performance Understanding through tsMorph: Generating Semi-Synthetic Time Series for Robust Forecasting Evaluation. arXiv:2312.01344

Features

  • Generation of Semi-Synthetic Time Series: Creates a set of intermediate time series transitioning from a source series (S) to a target series (T).
  • Performance Understanding: Evaluates forecasting models' robustness using MASE (Mean Absolute Scaled Error) over synthetic series.
  • Feature Extraction: Uses pycatch22 to extract time series features for deeper analysis.
  • Visualization Tools: Provides plotting functions to explore synthetic time series and their performance.

Installation

pip install tsmorph

Usage

Generate Semi-Synthetic Time Series

import numpy as np
import pandas as pd
from tsmorph import TSmorph

# Define source and target time series
S = np.array([1, 2, 3, 4, 5])
T = np.array([6, 7, 8, 9, 10])

ts_morph = TSmorph(S, T, granularity=5)
synthetic_df = ts_morph.fit()
print(synthetic_df)

Plot Semi-Synthetic Time Series

ts_morph.plot(synthetic_df)

Performance Understanding with Forecasting Models

from some_forecasting_model import TrainedModel

# Assume a trained forecasting model compatible with NeuralForecast
model = TrainedModel()

# Define forecast horizon
horizon = 2

# Analyze performance over synthetic series
ts_morph.analyze_morph_performance(synthetic_df, model, horizon)

Citation

If you use tsMorph in your research, please cite:

@article{santos2024tsmorph,
  title={Enhancing Algorithm Performance Understanding through tsMorph: Generating Semi-Synthetic Time Series for Robust Forecasting Evaluation},
  author={Santos, Mois{\'e}s and de Carvalho, Andr{\'e} and Soares, Carlos},
  journal={arXiv preprint arXiv:2312.01344},
  year={2024}
}

License

This project is licensed under the GNU General Public License v3.0.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsmorph-0.1.0.tar.gz (4.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsmorph-0.1.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file tsmorph-0.1.0.tar.gz.

File metadata

  • Download URL: tsmorph-0.1.0.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for tsmorph-0.1.0.tar.gz
Algorithm Hash digest
SHA256 a972d35f4f339ad01ee3e7f7b3ae8a26b2f9ddbf7ac1844013673bd90c982931
MD5 82bfc6a62a646fe60f3fb64b077d24c8
BLAKE2b-256 a079e2306003fd2f7dc09a8c7a9ac05b88996e941bf6c9888d15c163609a1e19

See more details on using hashes here.

File details

Details for the file tsmorph-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: tsmorph-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.20

File hashes

Hashes for tsmorph-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a19320ae7542776a6ec7f329184b45eed2bdf454b0a3adf346fc67b04120d659
MD5 5efabc12b4af4082e6966fa96260825a
BLAKE2b-256 e68480f240c63eed357d6da4da5c2621efec902f0834fc417e1cc64e69adc3d8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page