pub struct ForecastResult {
pub values: Vec<f64>,
pub timestamps: Vec<i64>,
pub confidence_lower: Vec<f64>,
pub confidence_upper: Vec<f64>,
pub confidence_level: f64,
}Expand description
Forecast result with predictions and confidence intervals.
Fields§
§values: Vec<f64>Predicted values.
timestamps: Vec<i64>Predicted timestamps (nanoseconds).
confidence_lower: Vec<f64>Lower confidence bound.
confidence_upper: Vec<f64>Upper confidence bound.
confidence_level: f64Confidence level (e.g. 0.95).
Implementations§
Source§impl ForecastResult
impl ForecastResult
Sourcepub fn with_confidence(self, level: f64) -> Result<Self, ForecastError>
pub fn with_confidence(self, level: f64) -> Result<Self, ForecastError>
Rescale the prediction interval to a different confidence level.
Every model in this crate builds a symmetric normal interval —
value ± z·σ_h, with σ_h whatever the model’s horizon-dependent
error scale is — so changing the level is exactly a change of z, and
this rescaling is not an approximation of the model’s own answer at
that level: it is that answer.
That is only true because the interval is symmetric and normal. It is
not true of the empirical residual quantiles from
QuantileForecaster, which is
where to go when the residuals are skewed or the tails matter more than
the shape.
§Errors
ForecastError::InvalidParams
when level is not in (0, 1), or when the result’s own
confidence_level is not, which would make the ratio meaningless.
Trait Implementations§
Source§impl Clone for ForecastResult
impl Clone for ForecastResult
Source§fn clone(&self) -> ForecastResult
fn clone(&self) -> ForecastResult
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ForecastResult
impl Debug for ForecastResult
Source§impl<'de> Deserialize<'de> for ForecastResult
impl<'de> Deserialize<'de> for ForecastResult
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for ForecastResult
impl RefUnwindSafe for ForecastResult
impl Send for ForecastResult
impl Sync for ForecastResult
impl Unpin for ForecastResult
impl UnsafeUnpin for ForecastResult
impl UnwindSafe for ForecastResult
Blanket Implementations§
impl<T> Allocation for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more