make_exogenous_regression¶
yohou.datasets.make_exogenous_regression(*, n_samples=200, forecasting_horizon=6, noise=0.1, forecast_bias=0.5, random_state=42)
¶
Generate a synthetic regression dataset with exogenous features.
Creates hourly electricity prices driven by temperature and a holiday
indicator with a known linear relationship:
price = 50 + 2 * temperature + 10 * is_holiday + noise.
Three exogenous feature types are produced:
- X_actual (observation features): realized temperature readings with a 24 hour sinusoidal cycle plus measurement noise (std=0.5).
- X_future (known future): an
is_holidayindicator drawn from a fixed civil holiday calendar, covering the full time range. The dates are irregular with respect to weekday, so the indicator cannot be derived from the timestamp and genuinely requires theX_futurechannel. - X_forecast (external forecasts): weather temperature forecasts
with one vintage per observation from index
forecasting_horizonup to (but not including) the last observation, each covering the nextforecasting_horizonsteps that remain within the sample. The final observation produces no vintage because all of its forecast steps fall outside the sample range. Forecasts carry a small systematic bias relative to actuals.
Parameters ¶
| Name | Type | Description | Default |
|---|---|---|---|
n_samples
|
int
|
Number of hourly observations. |
200
|
forecasting_horizon
|
int
|
Number of forward steps per X_forecast vintage. |
6
|
noise
|
float
|
Standard deviation of the target noise term. |
0.1
|
forecast_bias
|
float
|
Systematic bias added to weather forecasts relative to actuals. |
0.5
|
random_state
|
int
|
Seed for reproducibility. |
42
|
Returns ¶
| Type | Description |
|---|---|
Bunch
|
Dictionary-like object with the following attributes: y : pl.DataFrame
Target with columns |
See Also ¶
make_exogenous_classification: Classification variant with categorical target.fetch_tourism_monthly: Real monthly tourism dataset (univariate).
Examples ¶
>>> from yohou.datasets import make_exogenous_regression
>>> data = make_exogenous_regression(n_samples=100)
>>> data.y.columns
['time', 'price']
>>> data.X_forecast.columns
['vintage_time', 'time', 'wx_temp']
Source Code ¶
Source code in src/yohou/datasets/_generators.py
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 | |
Tutorials¶
The following example notebooks use this component:
-
Exogenous Features (X_actual, X_future, X_forecast)
Build a forecasting model with actual observations, known-future indicators, and multi-vintage external forecasts on synthetic electricity price data.
-
How to Align Exogenous Features Across Pipeline Steps
Control which step-indexed columns each direct-strategy estimator sees using the step_feature_alignment parameter of PointReductionForecaster.
-
How to Produce Multi-Vintage Predictions
Generate multiple predictions from different weather forecast vintages without refitting, using the X_forecast predict-time override.
-
How to Transform Features on the Forecast Channel
Lift transformers onto the vintage axis with PerVintageActualTransformer, including stateful ones such as lags, compose them with FeatureUnion, and feed the result to a forecaster's X_forecast channel.