pub trait VecVecg<T, U> {
Show 18 methods
fn wacentroid(self, ws: &[U]) -> Vec<f64>;
fn trend(self, eps: f64, v: Vec<Vec<U>>) -> Vec<f64>;
fn translate(self, m: &[U]) -> Vec<Vec<f64>>;
fn zerogm(self, gm: &[f64]) -> Vec<Vec<f64>>;
fn dependencies(self, m: &[U]) -> Vec<f64>;
fn correlations(self, m: &[U]) -> Vec<f64>;
fn distsum(self, v: &[U]) -> f64;
fn dists(self, v: &[U]) -> Vec<f64>;
fn wsortedeccs(self, ws: &[U], gm: &[f64]) -> (Vec<f64>, Vec<f64>);
fn wsortedcos(
self,
medmed: &[U],
unitzmed: &[U],
ws: &[U]
) -> (Vec<f64>, Vec<f64>);
fn wnxnonmember(self, ws: &[U], p: &[f64]) -> Vec<f64>;
fn weccnonmember(self, ws: &[U], p: &[f64]) -> Vec<f64>;
fn wgmedian(self, ws: &[U], eps: f64) -> Vec<f64>;
fn wmadgm(self, ws: &[U], wgm: &[f64]) -> f64;
fn covar(self, med: &[U]) -> Vec<f64>;
fn wcovar(self, ws: &[U], m: &[f64]) -> Vec<f64>;
fn comed(self, m: &[U]) -> Vec<f64>;
fn wcomed(self, ws: &[U], m: &[f64]) -> Vec<f64>;
}
Expand description
Methods applicable to vector of vectors of generic end type and one argument of a similar kind.
Required Methods
fn wacentroid(self, ws: &[U]) -> Vec<f64>
fn wacentroid(self, ws: &[U]) -> Vec<f64>
Weighted Arithmetic Centre = weighted euclidian mean of a set of points
Subtract m from all points - e.g. transform to zero median form
fn dependencies(self, m: &[U]) -> Vec<f64>
fn dependencies(self, m: &[U]) -> Vec<f64>
Dependencies of vector m on each vector in self
fn correlations(self, m: &[U]) -> Vec<f64>
fn correlations(self, m: &[U]) -> Vec<f64>
(Median) correlations of m with each vector in self
Sum of distances from arbitrary point (v) to all the points in self
Individual distances from any point v (typically not in self) to all the points in self.
Medoid and Outlier (by distance) of a set of points ( wgm, sorted eccentricities magnitudes, associated cpdf )
Sorted cosines magnitudes and cpdf, needs central median
Estimated weighted gm computed at a non member point
Estimated weighted eccentricity for a non-member point
The weighted geometric median to accuracy eps
wmadgm median of weighted absolute deviations from weighted gm: stable nd data spread estimator
Flattened lower triangular part of a covariance matrix of a Vec of f64 vectors.
Flattened lower triangular part of a covariance matrix for weighted f64 vectors.
Flattened comediance matrix for f64 vectors in self.
Similar to covar
above but medians instead of means are returned.
Implementations on Foreign Types
sourceimpl<T, U> VecVecg<T, U> for &[Vec<T>] where
T: Copy + PartialOrd + Display,
f64: From<T>,
U: Copy + PartialOrd + Display,
f64: From<U>,
impl<T, U> VecVecg<T, U> for &[Vec<T>] where
T: Copy + PartialOrd + Display,
f64: From<T>,
U: Copy + PartialOrd + Display,
f64: From<U>,
sourcefn wacentroid(self, ws: &[U]) -> Vec<f64>
fn wacentroid(self, ws: &[U]) -> Vec<f64>
Weighted Centre
sourcefn trend(self, eps: f64, v: Vec<Vec<U>>) -> Vec<f64>
fn trend(self, eps: f64, v: Vec<Vec<U>>) -> Vec<f64>
Trend computes the vector connecting the geometric medians of two sets of multidimensional points. This is a robust relationship between two unordered multidimensional sets. The two sets have to be in the same space but can have different numbers of points.
sourcefn translate(self, m: &[U]) -> Vec<Vec<f64>>
fn translate(self, m: &[U]) -> Vec<Vec<f64>>
Translates the whole set by subtracting vector m. Returns Vec of Vecs.
When m is set to the geometric median, this produces the zero median form.
The geometric median is invariant with respect to rotation,
unlike the often used mean (acentroid
here), or the quasi median,
both of which depend on the choice of axis.
sourcefn zerogm(self, gm: &[f64]) -> Vec<Vec<f64>>
fn zerogm(self, gm: &[f64]) -> Vec<Vec<f64>>
Transforms nd data to zeromedian form essentially the same as translate but specialised to f64 gms
sourcefn dependencies(self, m: &[U]) -> Vec<f64>
fn dependencies(self, m: &[U]) -> Vec<f64>
Dependencies of m on each vector in self m is typically a vector of outcomes. Factors out the entropy of m to save repetition of work
sourcefn correlations(self, m: &[U]) -> Vec<f64>
fn correlations(self, m: &[U]) -> Vec<f64>
(Median) correlations of m with each vector in self Factors out the unit vector of m to save repetition of work
sourcefn dists(self, v: &[U]) -> Vec<f64>
fn dists(self, v: &[U]) -> Vec<f64>
Individual distances from any point v, typically not a member, to all the members of self.
sourcefn distsum(self, v: &[U]) -> f64
fn distsum(self, v: &[U]) -> f64
Sum of distances from any single point v, typically not a member,
to all members of self.
Geometric Median (gm) is defined as the point which minimises this function.
This is relatively expensive measure to compute.
The radius (distance) from gm is far more efficient, once gm has been found.
sourcefn wsortedeccs(self, ws: &[U], gm: &[f64]) -> (Vec<f64>, Vec<f64>)
fn wsortedeccs(self, ws: &[U], gm: &[f64]) -> (Vec<f64>, Vec<f64>)
Sorted eccentricities magnitudes (radii), w.r.t. weighted geometric median. associated cummulative probability density function in [0,1] of the weights.
sourcefn wsortedcos(
self,
medmed: &[U],
unitzmed: &[U],
ws: &[U]
) -> (Vec<f64>, Vec<f64>)
fn wsortedcos(
self,
medmed: &[U],
unitzmed: &[U],
ws: &[U]
) -> (Vec<f64>, Vec<f64>)
Sorted cosines magnitudes, associated cummulative probability density function in [0,1] of the weights. Needs central median
sourcefn wnxnonmember(self, ws: &[U], p: &[f64]) -> Vec<f64>
fn wnxnonmember(self, ws: &[U], p: &[f64]) -> Vec<f64>
Next approximate weighted median, from a non member point.
sourcefn weccnonmember(self, ws: &[U], p: &[f64]) -> Vec<f64>
fn weccnonmember(self, ws: &[U], p: &[f64]) -> Vec<f64>
Estimated (computed) eccentricity vector for a non member point The true geometric median is as yet unknown. Returns the weighted eccentricity vector. The true geometric median would return zero vector. This function is suitable for a single non-member point.
sourcefn wgmedian(self, ws: &[U], eps: f64) -> Vec<f64>
fn wgmedian(self, ws: &[U], eps: f64) -> Vec<f64>
Secant method with recovery from divergence for finding the weighted geometric median
sourcefn wmadgm(self, ws: &[U], wgm: &[f64]) -> f64
fn wmadgm(self, ws: &[U], wgm: &[f64]) -> f64
wmadgm median of weighted absolute deviations from weighted gm: stable nd data spread estimator
sourcefn covar(self, m: &[U]) -> Vec<f64>
fn covar(self, m: &[U]) -> Vec<f64>
Covariance matrix for f64 vectors in self. Becomes comediance when
argument m is the geometric median instead of the centroid.
Since the matrix is symmetric, the missing upper triangular part can be trivially
regenerated for all j>i by: c(j,i) = c(i,j).
The indexing is always in this order: (row,column) (left to right, top to bottom).
The items are flattened into a single vector in this order.
The full 2D matrix can be reconstructed by symmatrix
in the trait Stats
.
sourcefn wcovar(self, ws: &[U], m: &[f64]) -> Vec<f64>
fn wcovar(self, ws: &[U], m: &[f64]) -> Vec<f64>
Weighted covariance matrix for f64 vectors in self. Becomes comediance when
argument m is the geometric median instead of the centroid.
Since the matrix is symmetric, the missing upper triangular part can be trivially
regenerated for all j>i by: c(j,i) = c(i,j).
The indexing is always in this order: (row,column) (left to right, top to bottom).
The items are flattened into a single vector in this order.
The full 2D matrix can be reconstructed by symmatrix
in the trait Stats
.
sourcefn comed(self, m: &[U]) -> Vec<f64>
fn comed(self, m: &[U]) -> Vec<f64>
Covariance matrix for f64 vectors in self. Becomes comediance when
argument m is the geometric median instead of the centroid.
Since the matrix is symmetric, the missing upper triangular part can be trivially
regenerated for all j>i by: c(j,i) = c(i,j).
The indexing is always in this order: (row,column) (left to right, top to bottom).
The items are flattened into a single vector in this order.
The full 2D matrix can be reconstructed by symmatrix
in the trait Stats
.
Similar to covar
above but instead of averaging the covariances over n points,
their medians are returned.
sourcefn wcomed(self, ws: &[U], m: &[f64]) -> Vec<f64>
fn wcomed(self, ws: &[U], m: &[f64]) -> Vec<f64>
Covariance matrix for weighted f64 vectors in self. Becomes comediance when
argument m is the geometric median instead of the centroid.
Since the matrix is symmetric, the missing upper triangular part can be trivially
regenerated for all j>i by: c(j,i) = c(i,j).
The indexing is always in this order: (row,column) (left to right, top to bottom).
The items are flattened into a single vector in this order.
The full 2D matrix can be reconstructed by symmatrix
in the trait Stats
.
Similar to wcovar
above but instead of averaging the covariances over n points,
their median is returned.