timeseries
timeseries
¶
Time-series feature engineering and transformations.
FeatureEngineer
¶
Feature engineering pipeline for player time-series data.
| PARAMETER | DESCRIPTION |
|---|---|
config
|
Feature configuration dictionary
TYPE:
|
Source code in fplx/timeseries/features.py
fit_transform
¶
Apply all feature engineering transformations.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input player timeseries data
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
Transformed data with engineered features |
Source code in fplx/timeseries/features.py
get_feature_names
¶
Get list of all generated feature names.
| PARAMETER | DESCRIPTION |
|---|---|
base_columns
|
Base column names
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
list[str]
|
Generated feature names |
Source code in fplx/timeseries/features.py
create_future_features
¶
Create features for future predictions.
This method extends the historical data by horizon periods,
applies the full feature engineering pipeline, and returns
the newly created future feature set.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Historical data
TYPE:
|
horizon
|
Number of future gameweeks to predict
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with features for future gameweeks |
Source code in fplx/timeseries/features.py
add_ewma_features
¶
add_ewma_features(
df: DataFrame,
columns: list[str],
alphas: list[float] = [0.3, 0.5, 0.7],
) -> DataFrame
Add exponentially weighted moving average features.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input dataframe
TYPE:
|
columns
|
Columns to compute EWMA for
TYPE:
|
alphas
|
Smoothing factors (0 < alpha < 1)
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with EWMA features |
Source code in fplx/timeseries/transforms.py
add_lag_features
¶
Add lagged features to dataframe.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input dataframe
TYPE:
|
columns
|
Columns to create lags for
TYPE:
|
lags
|
Lag periods
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with lagged features |
Source code in fplx/timeseries/transforms.py
add_rolling_features
¶
add_rolling_features(
df: DataFrame,
columns: list[str],
windows: list[int] = [3, 5, 10],
agg_funcs: list[str] = ["mean", "std"],
min_periods: int = 1,
) -> DataFrame
Add rolling window features to dataframe.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input dataframe with time-series data
TYPE:
|
columns
|
Columns to compute rolling features for
TYPE:
|
windows
|
Window sizes for rolling computation
TYPE:
|
agg_funcs
|
Aggregation functions ('mean', 'std', 'min', 'max', 'sum')
TYPE:
|
min_periods
|
Minimum observations in window
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with added rolling features |
Source code in fplx/timeseries/transforms.py
add_trend_features
¶
Add trend features (slope) using linear regression.
| PARAMETER | DESCRIPTION |
|---|---|
df
|
Input dataframe
TYPE:
|
columns
|
Columns to compute trends for
TYPE:
|
windows
|
Window sizes for trend calculation
TYPE:
|
| RETURNS | DESCRIPTION |
|---|---|
DataFrame
|
DataFrame with trend features |