Skip to main content

AutoFuzzTS

Time series forecasting library using fuzzy logic and automated machine learning.
Build and evaluate time series models automatically using fuzzy logic and AutoML techniques.

The package is designed for academic benchmarking and controlled experimentation in one-step-ahead time-series forecasting. It assumes a fixed train/validation/test split and focuses on reproducible model comparison rather than real-time deployment.

Installation

pip install autofuzzts

🚀 Quick Start

Load and prepare your time series data

import pandas as pd

# Load dataset into a pandas DataFrame
data = pd.read_csv('../../data/sample_datasets/NYSE.csv')
data.head(10)
# Select the target column to forecast
data_column_name = "Close"
df = data[[data_column_name]].copy()

# Split into train, validation, and test sets
test_len = len(df) // 5
val_len = len(df) // 5
train_len = len(df) - test_len - val_len

df_train = df[:train_len]
df_val = df[train_len:(train_len + val_len)]
df_test = df[(train_len + val_len):]

Tune hyperparameters using Bayesian search

from autofuzzts import pipeline

# Run Bayesian optimization for fuzzy pipeline configuration
best_config, best_rmse = pipeline.tune_hyperparameters_bayes(
    train_set=df_train,
    val_set=df_val,
    n_trials=20,
    metric="rmse"
)

print(f"Best configuration: {best_config}")

Example output:

Best configuration: {'n_fuzzy_sets': 13, 'number_of_lags': 6, 'fuzzy_part_func': 'Cosine'}

Train, calibrate, and predict

from autofuzzts import fit_calibrate_predict

# Train model, calibrate, and make one-step-ahead predictions
pred_set, pred_center_points, pred_test = fit_calibrate_predict(
    train_set=df_train,
    test_set=df_test,
    config=best_config,
    model_type="xgb"
)

This returns:

  • pred_set: predicted fuzzy sets
  • pred_center_points: corresponding fuzzy center values
  • pred_test: crisp numeric predictions (one-step-ahead forecast)

Function Overview

fit_calibrate_predict()

fit_calibrate_predict(
    train_set: pd.DataFrame,
    test_set: pd.DataFrame,
    config: dict,
    model_type: Literal['xgb', 'mlp', 'tpot'] = 'xgb',
    number_cv_calib: int = 5,
    diff_type: Literal['perc', 'abs'] = 'perc',
    covariates: list[str] | None = None,
    exclude_bool: bool = False
) -> float

Trains and calibrates a fuzzy time series model on the training set using cross-validation, then predicts on the test set and returns performance metrics.


Description

AutoFuzzTS automates the process of fuzzy time series modeling by:

  • building and testing multiple fuzzy pipelines,
  • tuning hyperparameters using Bayesian optimization, and
  • integrating tuned classification models - XGBoost, MLP, or TPOT.

This allows for rapid experimentation and selection of optimal configurations for forecasting tasks.


📄 Reference

This code is based on the research:

Optimizing stock price forecasting: a hybrid approach using fuzziness and automated machine learning
Jan Timko, Radwa El Shawi, Stefania Tomasiello
Expert Systems with Applications, Volume 259, 2025, 128844

Read on ScienceDirect

If you use this code in your research or projects, please cite the paper.


📄 License

This project is licensed under the MIT License.

Metadata

Release files for autofuzzts 0.1.3

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

Source distribution (sdist)

Source distribution for autofuzzts 0.1.3
File Size Uploaded
autofuzzts-0.1.3.tar.gz 15.3 kB Details

Built distribution (wheel)

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

Total release size: 33.0 kB

Release files / autofuzzts-0.1.3.tar.gz

Download URL autofuzzts-0.1.3.tar.gz
Size 15.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1e07ca4b7b949270f2a84bcfc0679c465152527fce9a26e25cb29c1eec22cc2c
BLAKE2b-256 checksum
How to use checksums
d053dbd22ed6dac1457464797ea3a53e124394d5bf057f54527eeca2181eca68
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 3, 2026.

Transparency log

Release files / autofuzzts-0.1.3-py3-none-any.whl

Download URL autofuzzts-0.1.3-py3-none-any.whl
Size 17.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b98e14e942790ee4f833b7ecb01d5acbf3efeaace480bda00dd1a49bb0e1be8
BLAKE2b-256 checksum
How to use checksums
e7b6062620b04349db8945ea4d33a3c6ff3dfd869a4b63acf6559d99b61a5fb4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 3, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.3 This release

2 release files

0.1.2

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