Forecaster
ForecastKnownValues
Forecaster that plays back known or prescribed values as forecasts.
Quickstart
python
from sktime.forecasting.dummy import ForecastKnownValues
estimator = ForecastKnownValues(y_known, method=None, fill_value=None, limit=None)Parameters(4)
- y_knownpd.DataFrame or pd.Series in one of the sktime compatible data formats
- should contain known values that the forecaster will replay in predict can also be in a non-pandas sktime data format, will then be coerced to pandas
- methodstr or None, optional, default=None
- one of {None, ‘backfill’/’bfill’, ‘pad’/’ffill’, ‘nearest’} method to use for imputing indices at which forecasts are unavailable in y_known
- fill_valuescalar, optional, default=np.NaN
value to use for any missing values (e.g., if
methodis None)- limitint, optional, default=None=infinite
maximum number of consecutive elements to bfill/ffill if
method=bfill/ffill
Examples
>>> import pandas as pd
>>> y_known = pd. DataFrame (range (100))
>>> y_train = y_known [: 24 ]
>>>
>>> from sktime.forecasting.dummy import ForecastKnownValues
>>>
>>> fcst = ForecastKnownValues (y_known)
>>> fcst. fit (y_train, fh = [1, 2, 3 ]) ForecastKnownValues(
... ) The forecast “plays back” the known/prescribed values from y_known
>>> y_pred = fcst. predict ()