Skip to main content

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.

Funding information

Agenda “Center for Responsible AI”, nr. C645008882-00000055, investment project nr. 62, financed by the Recovery and Resilience Plan (PRR) and by European Union - NextGeneration EU.

AISym4Med (101095387) supported by Horizon Europe Cluster 1: Health, ConnectedHealth (n.o 46858), supported by Competitiveness and Internationalisation Operational Programme (POCI) and Lisbon Regional Operational Programme (LISBOA 2020), under the PORTUGAL 2020 Partnership Agreement, through the European Regional Development Fund (ERDF)

Metadata

Release files for tsmorph 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tsmorph 0.3.0
File Size Uploaded
tsmorph-0.3.0.tar.gz 21.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for tsmorph 0.3.0
File Interpreter ABI Platform
tsmorph-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 41.0 kB

Release files / tsmorph-0.3.0.tar.gz

Download URL tsmorph-0.3.0.tar.gz
Size 21.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8cf23ca56a9240de44abc14d86b43da6dce75bf7a8041b5de2d32803eab0a2a7
BLAKE2b-256 checksum
How to use checksums
833d6a84b44315a07f6585c89e66acaa52d9b98e95328527f73248151c81bb2a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release files / tsmorph-0.3.0-py3-none-any.whl

Download URL tsmorph-0.3.0-py3-none-any.whl
Size 19.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2d5641feb5297a7479f89ae3e119c48555dfae22ae7e5fb791eb6ffb81e09174
BLAKE2b-256 checksum
How to use checksums
0c231ce2c4b6ea595551a8b2898b584a771f93664f07580d2bb4591949ffa27f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.9

Release history Release notifications | RSS feed

This release

0.3.0 This release

2 release files

0.2.0

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page