configurator.config_entsoe.ConfigEntsoe

configurator.config_entsoe.ConfigEntsoe(
    api_country_code='DE',
    periods=None,
    lags_consider=None,
    train_size=None,
    end_train_default='2025-12-31 00:00+00:00',
    delta_val=None,
    predict_size=24,
    refit_size=7,
    random_state=314159,
    n_hyperparameters_trials=20,
    data_filename='interim/energy_load.csv',
)

Configuration for the ENTSO-E forecasting pipeline.

This class manages all configuration parameters for the ENTSO-E task, including API settings, training/prediction intervals, and feature engineering specifications. All parameters can be customized during initialization or used with sensible defaults.

Parameters

Name Type Description Default
api_country_code str ISO country code for ENTSO-E API queries. 'DE'
periods Optional[List[Period]] List of Period objects defining cyclical feature encodings. None
lags_consider Optional[List[int]] List of lag values to consider for feature selection. None
train_size Optional[pd.Timedelta] Time window for training data. None
end_train_default str Default end date for training period (ISO format with timezone). '2025-12-31 00:00+00:00'
delta_val Optional[pd.Timedelta] Validation window size. None
predict_size int Number of hours to predict ahead. 24
refit_size int Number of days between model refits. 7
random_state int Random seed for reproducibility. 314159
n_hyperparameters_trials int Number of trials for hyperparameter optimization. 20
data_filename str Path to the interim merged data file. 'interim/energy_load.csv'

Attributes

Name Type Description
API_COUNTRY_CODE str ISO country code for API queries.
periods List[Period] Cyclical feature encoding specifications.
lags_consider List[int] Lag values for autoregressive features.
train_size pd.Timedelta Training data window.
end_train_default str Default training end date.
delta_val pd.Timedelta Validation window.
predict_size int Prediction horizon in hours.
refit_size int Refit interval in days.
random_state int Random seed.
n_hyperparameters_trials int Hyperparameter tuning trials.

Notes

The default period configurations use specific n_periods to balance resolution and smoothing: - Daily: n_periods=12 (24h) provides ~2h resolution, smoothing hourly noise and halving dimensionality. - Weekly: n_periods typically matches range (1:1) to distinguish day-of-week patterns. - Yearly: n_periods=12 (365d) provides ~1 month resolution, capturing broad seasonal trends without overfitting.

See docs/PERIOD_CONFIGURATION_RATIONALE.md for a detailed analysis.

Examples

import pandas as pd

from spotforecast2_safe.configurator.config_entsoe import ConfigEntsoe

# Use default configuration
config = ConfigEntsoe()
print(config.API_COUNTRY_CODE)
print(config.predict_size)
print(config.random_state)

# Create custom configuration
custom_config = ConfigEntsoe(
    api_country_code="FR",
    predict_size=48,
    random_state=42,
)
print(custom_config.API_COUNTRY_CODE)
print(custom_config.predict_size)

# Verify training window
assert config.train_size == pd.Timedelta(days=3 * 365)

# Check default periods
print(len(config.periods))
print(config.periods[0].name)
DE
24
314159
FR
48
5
daily

Methods

Name Description
get_params Get parameters for this configuration object.
set_params Set the parameters of this configuration object.

get_params

configurator.config_entsoe.ConfigEntsoe.get_params(deep=True)

Get parameters for this configuration object.

Parameters

Name Type Description Default
deep bool If True, will return the parameters for this configuration and contained sub-objects that are estimators. True

Returns

Name Type Description
params Dict[str, object] Dictionary of parameter names mapped to their values.

Examples

from spotforecast2_safe.configurator.config_entsoe import ConfigEntsoe

config = ConfigEntsoe(api_country_code="FR")
p = config.get_params()
print(p["api_country_code"])
print(p["predict_size"])
assert p["api_country_code"] == "FR"
assert p["predict_size"] == 24
FR
24

set_params

configurator.config_entsoe.ConfigEntsoe.set_params(params=None, **kwargs)

Set the parameters of this configuration object.

Parameters

Name Type Description Default
params Dict[str, object] Optional dictionary of parameter names mapped to their new values. None
**kwargs object Additional parameter names mapped to their new values. It supports configuring nested ‘Period’ objects using the periods__<name>__<param> notation. {}

Returns

Name Type Description
ConfigEntsoe ConfigEntsoe The configuration instance with updated parameters (supports method chaining).

Examples

from spotforecast2_safe.configurator.config_entsoe import ConfigEntsoe

config = ConfigEntsoe()

# Flat parameter setting
config.set_params(api_country_code="FR", predict_size=48)
print(config.API_COUNTRY_CODE)
print(config.predict_size)
assert config.API_COUNTRY_CODE == "FR"
assert config.predict_size == 48

# Deep parameter setting for nested Period objects
config.set_params(periods__daily__n_periods=24)
daily_n = next(p.n_periods for p in config.periods if p.name == "daily")
print(daily_n)
assert daily_n == 24
FR
48
24