SeasonalNaive¶
yohou.point.SeasonalNaive
¶
Bases: BasePointForecaster
Seasonal naive forecaster that repeats values from previous season.
Parameters ¶
| Name | Type | Description | Default |
|---|---|---|---|
seasonality
|
int
|
The seasonal period length. For example, 7 for weekly seasonality in daily data, or 12 for monthly seasonality in monthly data. |
1
|
panel_strategy
|
('global', multivariate)
|
How to handle panel data. See |
"global"
|
Attributes ¶
| Name | Type | Description |
|---|---|---|
interval_ |
str
|
Detected time interval of the training data. |
Examples ¶
>>> import polars as pl
>>> from datetime import datetime
>>> from yohou.point import SeasonalNaive
>>>
>>> df = pl.DataFrame({
... "time": pl.datetime_range(
... start=datetime(2021, 1, 1),
... end=datetime(2021, 1, 10),
... interval="1d",
... eager=True,
... ),
... "value": [1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 1.0, 2.0, 3.0, 1.0],
... })
>>> forecaster = SeasonalNaive(seasonality=3)
>>> _ = forecaster.fit(y=df, forecasting_horizon=3)
>>> y_pred = forecaster.predict(forecasting_horizon=3)
>>> len(y_pred)
3
Notes ¶
Predictions repeat the last seasonality observed values
cyclically. For example, with seasonality=7 the forecast for
each day equals the observation from the same weekday in the last
observed week.
See Also ¶
MeanSeasonalNaive: Averages multiple past seasonal cycles.PointReductionForecaster: ML-based point forecaster.
Source Code ¶
Source code in src/yohou/point/naive.py
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 217 | |
Methods ¶
__sklearn_tags__()
¶
Get estimator tags.
Returns ¶
| Type | Description |
|---|---|
Tags
|
Estimator tags with yohou-specific attributes. |
Source Code ¶
Source code in src/yohou/point/naive.py
Tutorials¶
The following example notebooks use this component:
-
Conformal Prediction Intervals
Build distribution-free prediction intervals with SplitConformalForecaster using calibration holdouts and configurable conformity scoring functions.
-
Forecast Visualization
Visualise point forecasts from single and multiple models, decomposition pipeline components, and time weight decay functions with interactive Plotly.
-
Forecasting Workflow
Evaluate forecasters with cross-validation, search hyperparameters with GridSearchCV, and inspect residuals to diagnose model weaknesses.
-
How to Build Panel Feature Pipelines
Combine ColumnForecaster, FeaturePipeline, FeatureUnion, and DecompositionPipeline on panel data with per-group scoring on KDD Cup air quality.
-
How to Build a Feature Pipeline
Nest FeaturePipeline, FeatureUnion, and DecompositionPipeline for multi-level feature engineering with trend-season-residual decomposition.
-
How to Choose a Forecasting Method
Interactive decision guide progressing from SeasonalNaive baseline through linear reduction, stationarity transforms, feature enrichment, nonlinear models, decomposition, and prediction intervals.