pub trait TrendModel: Debug {
// Required methods
fn name(&self) -> Cow<'_, str>;
fn fit(
&self,
y: &[f64],
) -> Result<Box<dyn FittedTrendModel + Sync + Send>, Box<dyn Error + Send + Sync + 'static>>;
}
Expand description
A trend model.
Trend models are used to model the trend component of a time series. Examples implemented in other languages include ARIMA, Theta and ETS.
You can implement this trait for your own trend models.
Required Methods§
Sourcefn fit(
&self,
y: &[f64],
) -> Result<Box<dyn FittedTrendModel + Sync + Send>, Box<dyn Error + Send + Sync + 'static>>
fn fit( &self, y: &[f64], ) -> Result<Box<dyn FittedTrendModel + Sync + Send>, Box<dyn Error + Send + Sync + 'static>>
Fit the model to the given time series.
This method is called once before any calls to predict
or predict_in_sample
.
Implementations should store any state required for prediction in the struct itself.