'Time series forecasting using fuzzy logic and AutoML'
Project description
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.
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("../clean_data/ADBE_yf_hourly_cleaned.csv").head(240)
# Select the target column to forecast
data_column_name = "close_price"
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_clusters': 19, 'number_of_lags': 2, 'fuzzy_part_func': 'Triangle'}
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 setspred_center_points: corresponding fuzzy center valuespred_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.
📄 License
This project is licensed under the MIT License.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file autofuzzts-0.1.2.tar.gz.
File metadata
- Download URL: autofuzzts-0.1.2.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2431181a984151f759cd9cb9b57f5a7681bcb4f351ce06d4728ddf11606d7ede
|
|
| MD5 |
44ef31e08e38f9a17e000f897474cb7d
|
|
| BLAKE2b-256 |
a21b44fa81238ed74823955adec70b9b06913fb4a9022e29d22208bc413315fa
|
File details
Details for the file autofuzzts-0.1.2-py3-none-any.whl.
File metadata
- Download URL: autofuzzts-0.1.2-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dc252b1b6d6d8698a5febea2d462ac250cfabd6409ca79daa4ec2fcd4d2451e5
|
|
| MD5 |
72975e8425645b0418b55b347689219a
|
|
| BLAKE2b-256 |
dfebbbd3f3c640d4a56b6038cbae90c9c77e39143db25335daf13ef6a701b10e
|