pub struct HalfNormal {
pub scale: Array1<f64>,
/* private fields */
}Expand description
The Half-Normal distribution.
The Half-Normal distribution is a Normal distribution folded at zero, with loc fixed at 0. It has one parameter: scale (sigma).
Fields§
§scale: Array1<f64>The scale parameter (sigma).
Trait Implementations§
Source§impl Clone for HalfNormal
impl Clone for HalfNormal
Source§fn clone(&self) -> HalfNormal
fn clone(&self) -> HalfNormal
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HalfNormal
impl Debug for HalfNormal
Source§impl Distribution for HalfNormal
impl Distribution for HalfNormal
Source§fn from_params(params: &Array2<f64>) -> Self
fn from_params(params: &Array2<f64>) -> Self
Creates a new distribution from a set of parameters.
Source§fn fit(y: &Array1<f64>) -> Array1<f64>
fn fit(y: &Array1<f64>) -> Array1<f64>
Fits the distribution to the data
y and returns the initial parameters.Source§fn grad<S: Score>(
&self,
y: &Array1<f64>,
_score: S,
natural: bool,
) -> Array2<f64>where
Self: Scorable<S>,
fn grad<S: Score>(
&self,
y: &Array1<f64>,
_score: S,
natural: bool,
) -> Array2<f64>where
Self: Scorable<S>,
Calculates the gradient of the score with respect to the distribution’s parameters.
fn total_score<S: Score>(&self, y: &Array1<f64>, _score: S) -> f64where
Self: Scorable<S>,
Source§impl DistributionMethods for HalfNormal
impl DistributionMethods for HalfNormal
Source§fn variance(&self) -> Array1<f64>
fn variance(&self) -> Array1<f64>
Returns the variance of the distribution for each observation.
Source§fn std(&self) -> Array1<f64>
fn std(&self) -> Array1<f64>
Returns the standard deviation of the distribution for each observation.
Source§fn pdf(&self, y: &Array1<f64>) -> Array1<f64>
fn pdf(&self, y: &Array1<f64>) -> Array1<f64>
Evaluates the probability density function at point y for each observation.
Source§fn logpdf(&self, y: &Array1<f64>) -> Array1<f64>
fn logpdf(&self, y: &Array1<f64>) -> Array1<f64>
Evaluates the log probability density function at point y for each observation.
Source§fn cdf(&self, y: &Array1<f64>) -> Array1<f64>
fn cdf(&self, y: &Array1<f64>) -> Array1<f64>
Evaluates the cumulative distribution function at point y for each observation.
Source§fn ppf(&self, q: &Array1<f64>) -> Array1<f64>
fn ppf(&self, q: &Array1<f64>) -> Array1<f64>
Evaluates the percent point function (inverse CDF / quantile function).
Returns the value y such that P(Y <= y) = q.
Source§fn sample(&self, n_samples: usize) -> Array2<f64>
fn sample(&self, n_samples: usize) -> Array2<f64>
Generates random samples from the distribution. Read more
Source§fn mode(&self) -> Array1<f64>
fn mode(&self) -> Array1<f64>
Returns the mode of the distribution for each observation (if well-defined).
Default implementation returns the mean; override for distributions where mode != mean.
Source§impl Scorable<CRPScore> for HalfNormal
impl Scorable<CRPScore> for HalfNormal
Source§fn d_score(&self, y: &Array1<f64>) -> Array2<f64>
fn d_score(&self, y: &Array1<f64>) -> Array2<f64>
Calculates the gradient of the score with respect to the distribution’s parameters.
Source§fn metric(&self) -> Array3<f64>
fn metric(&self) -> Array3<f64>
Calculates the Riemannian metric tensor of the score for each observation.
Source§impl Scorable<LogScore> for HalfNormal
impl Scorable<LogScore> for HalfNormal
Source§fn d_score(&self, y: &Array1<f64>) -> Array2<f64>
fn d_score(&self, y: &Array1<f64>) -> Array2<f64>
Calculates the gradient of the score with respect to the distribution’s parameters.
Source§fn metric(&self) -> Array3<f64>
fn metric(&self) -> Array3<f64>
Calculates the Riemannian metric tensor of the score for each observation.
impl RegressionDistn for HalfNormal
Auto Trait Implementations§
impl Freeze for HalfNormal
impl RefUnwindSafe for HalfNormal
impl Send for HalfNormal
impl Sync for HalfNormal
impl Unpin for HalfNormal
impl UnwindSafe for HalfNormal
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.