pub trait FittedTrendModel: Debug {
// Required methods
fn predict_inplace(
&self,
horizon: usize,
level: Option<f64>,
forecast: &mut Forecast,
) -> Result<(), Box<dyn Error + Send + Sync + 'static>>;
fn predict_in_sample_inplace(
&self,
level: Option<f64>,
forecast: &mut Forecast,
) -> Result<(), Box<dyn Error + Send + Sync + 'static>>;
fn training_data_size(&self) -> Option<usize>;
// Provided methods
fn predict(
&self,
horizon: usize,
level: Option<f64>,
) -> Result<Forecast, Box<dyn Error + Send + Sync + 'static>> { ... }
fn predict_in_sample(
&self,
level: Option<f64>,
) -> Result<Forecast, Box<dyn Error + Send + Sync + 'static>> { ... }
}
Expand description
A fitted trend model.
Required Methods§
Sourcefn predict_inplace(
&self,
horizon: usize,
level: Option<f64>,
forecast: &mut Forecast,
) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
fn predict_inplace( &self, horizon: usize, level: Option<f64>, forecast: &mut Forecast, ) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
Produce a forecast for the next horizon
time points.
The level
parameter specifies the confidence level for the prediction intervals.
Where possible, implementations should provide prediction intervals
alongside the point forecasts if level
is not None
.
Sourcefn predict_in_sample_inplace(
&self,
level: Option<f64>,
forecast: &mut Forecast,
) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
fn predict_in_sample_inplace( &self, level: Option<f64>, forecast: &mut Forecast, ) -> Result<(), Box<dyn Error + Send + Sync + 'static>>
Produce in-sample predictions.
In-sample predictions are used to assess the fit of the model to the training data.
The level
parameter specifies the confidence level for the prediction intervals.
Where possible, implementations should provide prediction intervals
alongside the point forecasts if level
is not None
.
Sourcefn training_data_size(&self) -> Option<usize>
fn training_data_size(&self) -> Option<usize>
Return the number of training data points used to fit the model.
Provided Methods§
Sourcefn predict(
&self,
horizon: usize,
level: Option<f64>,
) -> Result<Forecast, Box<dyn Error + Send + Sync + 'static>>
fn predict( &self, horizon: usize, level: Option<f64>, ) -> Result<Forecast, Box<dyn Error + Send + Sync + 'static>>
Return the n-ahead predictions for the given horizon.
The predictions are point forecasts and optionally include
prediction intervals at the specified level
.
level
should be a float between 0 and 1 representing the
confidence level of the prediction intervals. If None
then
no prediction intervals are returned.
§Errors
Any errors returned by the trend model are propagated.
Sourcefn predict_in_sample(
&self,
level: Option<f64>,
) -> Result<Forecast, Box<dyn Error + Send + Sync + 'static>>
fn predict_in_sample( &self, level: Option<f64>, ) -> Result<Forecast, Box<dyn Error + Send + Sync + 'static>>
Return the in-sample predictions.
The predictions are point forecasts and optionally include
prediction intervals at the specified level
.
level
should be a float between 0 and 1 representing the
confidence level of the prediction intervals. If None
then
no prediction intervals are returned.
§Errors
Any errors returned by the trend model are propagated.