Trait ndarray_stats::DeviationExt [−][src]
An extension trait for ArrayBase
providing functions
to compute different deviation measures.
Required methods
fn count_eq<T>(&self, other: &ArrayBase<T, D>) -> Result<usize, MultiInputError> where
A: PartialEq,
T: Data<Elem = A>,
[src]
A: PartialEq,
T: Data<Elem = A>,
Counts the number of indices at which the elements of the arrays self
and other
are equal.
The following errors may be returned:
MultiInputError::EmptyInput
ifself
is emptyMultiInputError::ShapeMismatch
ifself
andother
don’t have the same shape
fn count_neq<T>(
&self,
other: &ArrayBase<T, D>
) -> Result<usize, MultiInputError> where
A: PartialEq,
T: Data<Elem = A>,
[src]
&self,
other: &ArrayBase<T, D>
) -> Result<usize, MultiInputError> where
A: PartialEq,
T: Data<Elem = A>,
Counts the number of indices at which the elements of the arrays self
and other
are not equal.
The following errors may be returned:
MultiInputError::EmptyInput
ifself
is emptyMultiInputError::ShapeMismatch
ifself
andother
don’t have the same shape
fn sq_l2_dist<T>(&self, other: &ArrayBase<T, D>) -> Result<A, MultiInputError> where
A: AddAssign + Clone + Signed,
T: Data<Elem = A>,
[src]
A: AddAssign + Clone + Signed,
T: Data<Elem = A>,
Computes the squared L2 distance between self
and other
.
n
∑ |aᵢ - bᵢ|²
i=1
where self
is a
and other
is b
.
The following errors may be returned:
MultiInputError::EmptyInput
ifself
is emptyMultiInputError::ShapeMismatch
ifself
andother
don’t have the same shape
fn l2_dist<T>(&self, other: &ArrayBase<T, D>) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
[src]
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
Computes the L2 distance between self
and other
.
n
√ ( ∑ |aᵢ - bᵢ|² )
i=1
where self
is a
and other
is b
.
The following errors may be returned:
MultiInputError::EmptyInput
ifself
is emptyMultiInputError::ShapeMismatch
ifself
andother
don’t have the same shape
Panics if the type cast from A
to f64
fails.
fn l1_dist<T>(&self, other: &ArrayBase<T, D>) -> Result<A, MultiInputError> where
A: AddAssign + Clone + Signed,
T: Data<Elem = A>,
[src]
A: AddAssign + Clone + Signed,
T: Data<Elem = A>,
Computes the L1 distance between self
and other
.
n
∑ |aᵢ - bᵢ|
i=1
where self
is a
and other
is b
.
The following errors may be returned:
MultiInputError::EmptyInput
ifself
is emptyMultiInputError::ShapeMismatch
ifself
andother
don’t have the same shape
fn linf_dist<T>(&self, other: &ArrayBase<T, D>) -> Result<A, MultiInputError> where
A: Clone + PartialOrd + Signed,
T: Data<Elem = A>,
[src]
A: Clone + PartialOrd + Signed,
T: Data<Elem = A>,
Computes the L∞ distance between self
and other
.
max(|aᵢ - bᵢ|)
ᵢ
where self
is a
and other
is b
.
The following errors may be returned:
MultiInputError::EmptyInput
ifself
is emptyMultiInputError::ShapeMismatch
ifself
andother
don’t have the same shape
fn mean_abs_err<T>(
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
[src]
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
Computes the mean absolute error between self
and other
.
n
1/n * ∑ |aᵢ - bᵢ|
i=1
where self
is a
and other
is b
.
The following errors may be returned:
MultiInputError::EmptyInput
ifself
is emptyMultiInputError::ShapeMismatch
ifself
andother
don’t have the same shape
Panics if the type cast from A
to f64
fails.
fn mean_sq_err<T>(
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
[src]
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
Computes the mean squared error between self
and other
.
n
1/n * ∑ |aᵢ - bᵢ|²
i=1
where self
is a
and other
is b
.
The following errors may be returned:
MultiInputError::EmptyInput
ifself
is emptyMultiInputError::ShapeMismatch
ifself
andother
don’t have the same shape
Panics if the type cast from A
to f64
fails.
fn root_mean_sq_err<T>(
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
[src]
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
Computes the unnormalized root-mean-square error between self
and other
.
√ mse(a, b)
where self
is a
, other
is b
and mse
is the mean-squared-error.
The following errors may be returned:
MultiInputError::EmptyInput
ifself
is emptyMultiInputError::ShapeMismatch
ifself
andother
don’t have the same shape
Panics if the type cast from A
to f64
fails.
fn peak_signal_to_noise_ratio<T>(
&self,
other: &ArrayBase<T, D>,
maxv: A
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
[src]
&self,
other: &ArrayBase<T, D>,
maxv: A
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
Computes the peak signal-to-noise ratio between self
and other
.
10 * log10(maxv^2 / mse(a, b))
where self
is a
, other
is b
, mse
is the mean-squared-error
and maxv
is the maximum possible value either array can take.
The following errors may be returned:
MultiInputError::EmptyInput
ifself
is emptyMultiInputError::ShapeMismatch
ifself
andother
don’t have the same shape
Panics if the type cast from A
to f64
fails.
fn __private__(&self, _: PrivateMarker)
[src]
This method makes this trait impossible to implement outside of
ndarray-stats
so that we can freely add new methods, etc., to
this trait without breaking changes.
We don’t anticipate any other crates needing to implement this trait, but if you do have such a use-case, please let us know.
Warning This method is not considered part of the public API, and client code should not rely on it being present. It may be removed in a non-breaking release.
Implementations on Foreign Types
impl<A, S, D> DeviationExt<A, S, D> for ArrayBase<S, D> where
S: Data<Elem = A>,
D: Dimension,
[src]
S: Data<Elem = A>,
D: Dimension,
fn count_eq<T>(&self, other: &ArrayBase<T, D>) -> Result<usize, MultiInputError> where
A: PartialEq,
T: Data<Elem = A>,
[src]
A: PartialEq,
T: Data<Elem = A>,
fn count_neq<T>(
&self,
other: &ArrayBase<T, D>
) -> Result<usize, MultiInputError> where
A: PartialEq,
T: Data<Elem = A>,
[src]
&self,
other: &ArrayBase<T, D>
) -> Result<usize, MultiInputError> where
A: PartialEq,
T: Data<Elem = A>,
fn sq_l2_dist<T>(&self, other: &ArrayBase<T, D>) -> Result<A, MultiInputError> where
A: AddAssign + Clone + Signed,
T: Data<Elem = A>,
[src]
A: AddAssign + Clone + Signed,
T: Data<Elem = A>,
fn l2_dist<T>(&self, other: &ArrayBase<T, D>) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
[src]
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
fn l1_dist<T>(&self, other: &ArrayBase<T, D>) -> Result<A, MultiInputError> where
A: AddAssign + Clone + Signed,
T: Data<Elem = A>,
[src]
A: AddAssign + Clone + Signed,
T: Data<Elem = A>,
fn linf_dist<T>(&self, other: &ArrayBase<T, D>) -> Result<A, MultiInputError> where
A: Clone + PartialOrd + Signed,
T: Data<Elem = A>,
[src]
A: Clone + PartialOrd + Signed,
T: Data<Elem = A>,
fn mean_abs_err<T>(
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
[src]
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
fn mean_sq_err<T>(
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
[src]
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
fn root_mean_sq_err<T>(
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
[src]
&self,
other: &ArrayBase<T, D>
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
fn peak_signal_to_noise_ratio<T>(
&self,
other: &ArrayBase<T, D>,
maxv: A
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,
[src]
&self,
other: &ArrayBase<T, D>,
maxv: A
) -> Result<f64, MultiInputError> where
A: AddAssign + Clone + Signed + ToPrimitive,
T: Data<Elem = A>,