A package for transforming time series features
Project description
ts_features_sculptor
A package for feature engineering on time series data.
The library is designed for experiments with feature engineering in ML. It includes transformers, generators, and examples of feature construction for time series. Intended for educational and research purposes, not for production use. Users must verify results independently.
This is a sandbox for feature engineering experiments, not ready-made solutions.
Installation
pip install ts_features_sculptor
Example
A simple example of feature engineering creation:
import numpy as np
import pandas as pd
from sklearn.pipeline import Pipeline
from ts_features_sculptor import (
ToDateTime,
SortByTime,
Tte,
TimedRollingAggregator
)
data = {
'time': [
'2025-10-01 06:00:00',
'2025-02-01 12:00:00',
'2025-02-11 18:00:00',
'2025-01-10 06:00:00'
],
'value': [
10., 11., 12., 11.
]
}
df = pd.DataFrame(data)
pippeline = Pipeline([
('to_datetime', ToDateTime(time_col="time")),
('sort_by_time', SortByTime(time_col="time")),
('tte', Tte(time_col="time")),
('time_rolling_aggregator', TimedRollingAggregator(
time_col = "time",
feature_col = "tte",
window_days = 30,
agg_funcs = ['mean', 'count'],
fillna = np.nan
))
])
result_df = pippeline.transform(df)
print(result_df.to_string(index=False))
time value tte tte_time_rolling_mean_30 tte_time_rolling_count_30
2025-01-10 06:00:00 11.0 22.25 NaN NaN
2025-02-01 12:00:00 11.0 10.25 22.25 1.0
2025-02-11 18:00:00 12.0 231.50 10.25 1.0
2025-10-01 06:00:00 10.0 NaN NaN NaN
Transformers
- ToDateTime - Converts string time values to datetime format
- SortByTime - Sorts data by timestamp.
- TimeValidator - Validates the correctness of timestamps.
- Tte - Computes time to event in days.
- Lag - Creates lag features (time-shifted values).
- RowRollingAggregator - Aggregates data using a fixed-row rolling window.
- TimedRollingAggregator -Aggregates data using a time-based rolling window (in days).
- DaysOfLife - Calculates the number of days since the start of observations (from the earliest date).
- DateTimeDecomposer - Decomposes timestamps into components (year, month, day, day of week, hour, etc.).
- Expanding - Computes expanding aggregates (cumulative statistics).
- Expression - Applies custom expressions to data using numpy functions.
- IsHolidays - Checks if a date is a holiday.
- LongHoliday - Detects long holiday blocks.
- SegmentLongHoliday - Segments data into holiday and non-holiday segments.
- WindowActivity - Assigns the object's activity.
- ActiveToInactive - Marks transitions from active to inactive states.
- IntervalEventsMerge - Merges interval event data.
- ActivityRangeClassifier - Extracts segments for the specified object activity.
- GroupAggregate - Generates individual and group features.
Generators
- TemporalGenerator - Base abstract class for time series generators.
- FlexibleCyclicalGenerator - Generates weakly cyclical signals with high intra-cycle variability.
- StructuredCyclicalGenerator - Generates signals with strict cyclicity and low stochasticity.
License
MIT
Project details
Release history Release notifications | RSS feed
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 ts_features_sculptor-1.12.0.tar.gz.
File metadata
- Download URL: ts_features_sculptor-1.12.0.tar.gz
- Upload date:
- Size: 128.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
906cf05bf665aa2651114840007adc2de79227c3af85c69874894d8a18c449ef
|
|
| MD5 |
503b276b809380140b8a3d3ce2e39407
|
|
| BLAKE2b-256 |
aef45c7a37f4cffca6e4fe4925afcfd38e1bbc157be5035aa9f2c5adc0affe34
|
File details
Details for the file ts_features_sculptor-1.12.0-py3-none-any.whl.
File metadata
- Download URL: ts_features_sculptor-1.12.0-py3-none-any.whl
- Upload date:
- Size: 183.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6612eaceaa88dcff14fc9466a3d85f21fcaff4a578fb22faaebe92b1de031af6
|
|
| MD5 |
c4ab0d7afabefd7812a0cfebe8d45686
|
|
| BLAKE2b-256 |
42cff998694f625bcf3fb4b1a9e6b8bf171996499a1faa26bb50487d045ba576
|