Skip to main content

Feature Engineering and Large-scale Integration for Time Series

Project description

FELITS: Feature Engineering and Large-scale Integration for Time Series

License: MIT Python 3.11+

FELITS is an open-source Python library for end-to-end time series analysis and forecasting, with a focus on Short-Term Load Forecasting (STLF). It provides a complete pipeline: signal cleaning, feature engineering, feature selection, predictive modelling, and explainable AI (XAI).

The library is the result of the INIC01-6 research project (CONACYT, Paraguay) and was used to produce the methodology for a published research article.

Highlights

  • Preprocessing — outlier detection (IQR, Hampel/MAD, 3-sigma), STL decomposition, dual-scaler pattern
  • Feature extraction — cyclic encodings, lag/shift features, rolling statistics, FFT, wavelets, tsfresh, FATS-style
  • Feature selection — Granger causality, KSG mutual information, mRMR, Adaptive LASSO, RF/XGB importance
  • Models — XGBoost, RandomForest, LinearRegression, plus tf.keras RNN models (LSTM/GRU/BiLSTM/BiGRU) and Bahdanau attention variants
  • XAI — LIME, SHAP, and Deep SHAP as a closed-loop meta-optimizer for feature elimination
  • Optuna hyperparameter optimization with multi-objective TPE sampler
  • Dual API — all modules accept both pandas and polars DataFrames; internal logic uses polars for performance

Requirements

  • Python ≥3.11, <3.14 (TensorFlow requires ≤3.13)
  • uv (recommended) or pip

Installation

git clone https://github.com/felits/felits.git
cd felits

# Create venv and install with uv (recommended)
uv venv --python 3.13
uv pip install -e ".[all,dev]"

Extra dependency groups

Extra Includes
[dl] TensorFlow for RNN/Attention models
[xgb] XGBoost
[wavelet] PyWavelets
[duckdb] DuckDB for SQL-style batch feature engineering
[all] Everything above

Python version management

uv handles Python downloads automatically. To switch Python versions:

uv python install 3.13       # download Python 3.13
uv venv --python 3.13 .venv  # create a venv with it

Quickstart

import polars as pl
from felits.preprocessing import HampelFilter, TimeSeriesScaler
from felits.feature_extraction import cyclical_encode, rolling_statistics
from felits.feature_selection import FeatureSelector
from felits.models import XGBoostForecaster
from felits import Metrics

df = pl.read_csv("demand.csv", try_parse_dates=True)
df = df.with_columns(
    pl.Series("value_clean", HampelFilter(window_size=24).transform(df["value"]))
)
df = cyclical_encode(df, datetime_col="timestamp")
df = rolling_statistics(df, columns=["value_clean"], windows=[24, 168], stats=["mean", "std"])

model = XGBoostForecaster(n_estimators=500, max_depth=6)
model.fit(X_train, y_train)
preds = model.predict(X_test)

m = Metrics(y_test, preds)
print(m.dict_metrics())

Project layout

felits/
├── _compat.py               # pandas/polars compatibility layer
├── preprocessing/           # outliers, decomposition, scaling, imputation, metrics
├── feature_extraction/      # temporal, spectral, automated
├── feature_selection/       # causal, information, regularization, ensemble, xai
├── models/                  # base, sklearn, dl (separate modules)
│   ├── base.py              #   _SklearnForecaster, TF detection
│   ├── sklearn.py           #   XGBoost/RF/Linear wrappers
│   └── dl.py                #   RNN/Attention models (requires TF)
├── optimization.py          # Optuna wrappers
├── xai.py                   # LIME, SHAP, deep SHAP closed-loop
└── data.py                  # loaders and synthetic data
examples/                    # Runnable .py example scripts
notebooks/                   # Jupyter notebooks for each example
tests/                       # pytest suite (79+ tests)

Citation

If you use FELITS in academic work, please cite the associated research article (see research-docs/).

License

MIT — see 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

felits-0.2.0.tar.gz (39.7 kB view details)

Uploaded Source

Built Distribution

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

felits-0.2.0-py3-none-any.whl (50.9 kB view details)

Uploaded Python 3

File details

Details for the file felits-0.2.0.tar.gz.

File metadata

  • Download URL: felits-0.2.0.tar.gz
  • Upload date:
  • Size: 39.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for felits-0.2.0.tar.gz
Algorithm Hash digest
SHA256 9ee29b853fa7b3d3b37d0b8348deaa8e9984456919a3479b47c3ee165ebcd77d
MD5 b44641bb1fdd56f3785858a9b2f0c48e
BLAKE2b-256 58959f354efc374037a935f4409b733de38ceac8162ee554b1695464711ac093

See more details on using hashes here.

File details

Details for the file felits-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: felits-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 50.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for felits-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 21a73f7f8089051d039c986aefe41a3ae082707d63893199b6a3a0ff2fc620de
MD5 d79f7c31c312a054ba33b61d6683f72a
BLAKE2b-256 795c0b110d2676ea6f7e6a5cd323438fd348e5bece22a7de2b5b18af4b68b504

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