Skip to main content

ProphetDecomposition

Struct ProphetDecomposition 

Source
pub struct ProphetDecomposition {
Show 18 fields pub trend_type: TrendType, pub seasonality_mode: SeasonalityMode, pub cap: Option<Array1<f64>>, pub floor: Option<Array1<f64>>, pub capacities: Option<Array1<f64>>, pub n_changepoints: usize, pub changepoint_range: f64, pub changepoint_prior_scale: f64, pub holiday_prior_scale: f64, pub seasonalities: Vec<SeasonalitySpec>, pub holidays: Vec<Holiday>, pub t0_days: Option<f64>, pub total_days: Option<f64>, pub changepoints: Option<Vec<f64>>, pub delta: Option<Array1<f64>>, pub k: Option<f64>, pub m: Option<f64>, pub beta: Option<Array1<f64>>,
}

Fields§

§trend_type: TrendType§seasonality_mode: SeasonalityMode§cap: Option<Array1<f64>>

Upper capacity bound per observation date C(t)

§floor: Option<Array1<f64>>

Optional lower capacity floor per observation date F(t) (default: 0.0)

§capacities: Option<Array1<f64>>§n_changepoints: usize§changepoint_range: f64§changepoint_prior_scale: f64§holiday_prior_scale: f64§seasonalities: Vec<SeasonalitySpec>§holidays: Vec<Holiday>§t0_days: Option<f64>§total_days: Option<f64>§changepoints: Option<Vec<f64>>§delta: Option<Array1<f64>>§k: Option<f64>§m: Option<f64>§beta: Option<Array1<f64>>

Implementations§

Source§

impl ProphetDecomposition

Source

pub fn new(n_changepoints: usize, changepoint_prior_scale: f64) -> Self

Source

pub fn to_json(&self) -> Result<String>

Serializes the model state (including fitted coefficients) to a JSON string.

Source

pub fn from_json(json_str: &str) -> Result<Self>

Deserializes a ProphetDecomposition model from a JSON string.

Source

pub fn save_to_file<P: AsRef<Path>>(&self, path: P) -> Result<()>

Saves the model state to a JSON file on disk.

Source

pub fn load_from_file<P: AsRef<Path>>(path: P) -> Result<Self>

Loads a model state from a JSON file on disk.

Source

pub fn add_seasonality( &mut self, name: &str, period_days: f64, fourier_order: usize, )

Adds a seasonal component with a default prior scale of 10.0

Source

pub fn add_seasonality_with_prior( &mut self, name: &str, period_days: f64, fourier_order: usize, prior_scale: f64, )

Adds a seasonal component with a custom prior scale for independent regularization

Source

pub fn add_holiday(&mut self, holiday: Holiday)

Source

pub fn predict_with_intervals( &self, dates: &[NaiveDate], interval_width: f64, n_samples: usize, ) -> Result<ProphetPrediction>

Predicts yhat and computes percentile-based uncertainty intervals via parallel Monte Carlo simulation

Source

pub fn fit( &mut self, dates: &[NaiveDate], y: &Array1<f64>, cap: Option<&Array1<f64>>, floor: Option<&Array1<f64>>, ) -> Result<()>

Source

pub fn predict(&self, dates: &[NaiveDate]) -> Result<ProphetPrediction>

Trait Implementations§

Source§

impl Clone for ProphetDecomposition

Source§

fn clone(&self) -> ProphetDecomposition

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ProphetDecomposition

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for ProphetDecomposition

Source§

fn default() -> ProphetDecomposition

Returns the “default value” for a type. Read more
Source§

impl<'de> Deserialize<'de> for ProphetDecomposition

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for ProphetDecomposition

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> SendAlias for T

Source§

impl<T> SyncAlias for T

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V