make_exogenous_classification¶
yohou.datasets.make_exogenous_classification(*, n_samples=400, forecasting_horizon=6, noise=0.1, forecast_bias=0.3, random_state=42)
¶
Generate a synthetic classification dataset with exogenous features.
Creates hourly air quality readings classified into three categories based on pollutant concentration thresholds.
Three exogenous feature types are produced:
- X_actual (observation features): realized pollutant readings with a 24 hour sinusoidal cycle.
- X_future (known future): an
is_holidayindicator drawn from a fixed civil holiday calendar, covering the full time range. Holidays reduce traffic and therefore pollutant levels. 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): pollutant concentration
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.
Classification thresholds are applied to the effective pollutant signal
(the stored X_actual pollutant minus a 5-unit weekend offset, plus
jitter), not to the raw X_actual["pollutant"] feature. As a result a
small fraction of rows near the 40/60 boundaries do not satisfy these
thresholds when read off the stored feature:
"good": effective pollutant < 40"moderate": 40 <= effective pollutant < 60"poor": effective pollutant >= 60
Parameters ¶
| Name | Type | Description | Default |
|---|---|---|---|
n_samples
|
int
|
Number of hourly observations. |
400
|
forecasting_horizon
|
int
|
Number of forward steps per X_forecast vintage. |
6
|
noise
|
float
|
Standard deviation of an additional jitter layered on top of the
pollutant signal just before classification. The underlying pollutant
signal already carries a fixed |
0.1
|
forecast_bias
|
float
|
Systematic bias added to pollutant forecasts relative to actuals. |
0.3
|
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_regression: Regression variant with continuous target.fetch_air_quality_classification: Real air quality classification dataset.
Examples ¶
>>> from yohou.datasets import make_exogenous_classification
>>> data = make_exogenous_classification(n_samples=200)
>>> data.y.columns
['time', 'air_quality']
>>> data.classes
['good', 'moderate', 'poor']
Source Code ¶
Source code in src/yohou/datasets/_generators.py
219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 | |