pub trait VecVec<T> {
Show 24 methods
fn transpose(self) -> Vec<Vec<T>>;
fn jointpdfn(self) -> Vec<f64>;
fn jointentropyn(self) -> f64;
fn dependencen(self) -> f64;
fn crossfeatures<F>(self, f: F) -> Vec<f64>
where
F: Fn(&[T], &[T]) -> f64;
fn acentroid(self) -> Vec<f64>;
fn gcentroid(self) -> Vec<f64>;
fn hcentroid(self) -> Vec<f64>;
fn firstpoint(self) -> Vec<f64>;
fn distsums(self) -> Vec<f64>;
fn medout(self) -> MinMax<f64>;
fn distsuminset(self, indx: usize) -> f64;
fn nxmember(self, indx: usize) -> Vec<f64>;
fn nxnonmember(self, p: &[f64]) -> Vec<f64>;
fn eccmember(self, indx: usize) -> Vec<f64>;
fn eccnonmember(self, p: &[f64]) -> Vec<f64>;
fn eccentricities(self) -> Vec<Vec<f64>>;
fn exacteccs(self, eps: f64) -> Vec<Vec<f64>>;
fn eccinfo(self, eps: f64) -> (MStats, Med, MinMax<f64>)
where
Vec<f64>: FromIterator<f64>;
fn madn(self, eps: f64) -> f64;
fn emedoid(self, eps: f64) -> MinMax<f64>
where
Vec<f64>: FromIterator<f64>;
fn sortedeccs(self, ascending: bool, gm: &[f64]) -> Vec<f64>;
fn gmedian(self, eps: f64) -> Vec<f64>;
fn igmedian(self, eps: f64) -> (Vec<f64>, usize);
}
Expand description
Methods applicable to a single argument: a vector of vectors of generic end type. Operations on a set of multidimensional vectors.
Required methods
Joint probability density function of n matched slices of the same length
fn jointentropyn(self) -> f64
fn jointentropyn(self) -> f64
Joint entropy between a set of vectors of the same length
fn dependencen(self) -> f64
fn dependencen(self) -> f64
Independence (component wise) of a set of vectors.
Flattened lower triangular relations matrix between columns of self
fn firstpoint(self) -> Vec<f64>
fn firstpoint(self) -> Vec<f64>
Possible first iteration point for geometric medians
fn distsuminset(self, indx: usize) -> f64
fn distsuminset(self, indx: usize) -> f64
Fast sums of distances from each point to all other points
Next approx gm computed at a member point given by its indx
Estimated ecentricity vector from a member point given by its indx to gm
Estimated eccentricity vector from a non member point
fn eccentricities(self) -> Vec<Vec<f64>>
fn eccentricities(self) -> Vec<Vec<f64>>
Estimated eccentricity vectors from each member point
Exact eccentricity vectors from each member point by first finding the gm.
As well as being more accurate, it is usually faster than eccentricities
above,
especially for large numbers of points.
Median and quartiles of eccentricities (new robust measure of spread of a multivariate sample)
MADn multidimensional median absolute deviation: data spread estimator that is more stable than variance
Medoid and Outlier as defined by eccentricities.
Returns sorted eccentricities magnitudes
Improved Weizsfeld’s Algorithm for geometric median, to accuracy eps New algorithm for geometric median, to accuracy eps
Implementations on Foreign Types
Joint probability density function of n matched slices of the same length
Joint entropy of vectors of the same length
Dependence (component wise) of a set of vectors.
i.e. dependencen
returns 0 iff they are statistically independent
bigger values when they are dependent
Flattened lower triangular part of a symmetric matrix for column vectors in self.
The upper triangular part can be trivially generated for all j>i by: c(j,i) = c(i,j).
Applies closure f which computes a scalar relationship between two vectors,
that is different features stored in columns of self.
The closure typically invokes one of the methods from Vecg trait (in vecg.rs),
such as dependencies or correlations.
Example call: pts.transpose().crossfeatures(|v1,v2| v1.mediancorr(v2))
computes correlations between all column vectors (features) in pts.
For each member point, gives its sum of distances to all other points and their MinMax
The sum of distances from one member point, given by its indx
, to all the other points in self.
For all the points, use more efficient distsums
.
Medoid and Outlier (Medout)
Medoid is the member point (point belonging to the set of points self
),
which has the least sum of distances to all other points.
Outlier is the point with the greatest sum of distances.
In other words, they are the members nearest and furthest from the geometric median.
Returns struct MinMax{min,minindex,max,maxindex}
Finds approximate vectors from each member point towards the geometric median. Twice as fast using symmetry, as doing them individually.
Exact eccentricity vectors from all member points by first finding the Geometric Median.
Usually faster than the approximate eccentricities
above, especially when there are many points.
Estimated (computed) eccentricity vector for a member point.
It points towards the geometric median.
The true geometric median is as yet unknown.
The true geometric median would return zero vector.
The member point in question is specified by its index indx
.
This function is suitable for a single member point.
When eccentricities of all the points are wanted, use exacteccs
above.
Estimated (computed) eccentricity vector for a non member point. The true geometric median is as yet unknown. Returns the eccentricity vector. The true geometric median would return zero vector. This function is suitable for a single non-member point.
Mean and Std (in MStats struct), Median and quartiles (in Med struct), Median and Outlier (in MinMax struct) of scalar eccentricities of points in self. These are new robust measures of a cloud of multidimensional points (or multivariate sample).
MADn multidimensional median of distances from gm: data spread estimator that is more stable than variances
GM and sorted eccentricities magnitudes.
Describing a set of points self
in n dimensions
Eccentricities of Medoid and Outlier.
Same as just the third element of a tuple returned by eccinfo
Initial (first) point for geometric medians. Same as eccnonmember(‘origin’) but saving the subtractions of zeroes.
Next approximate gm computed from a member point
specified by its index indx
to self.
Next approximate gm computed from a non-member point p
Geometric Median (gm) is the point that minimises the sum of distances to a given set of points.
It has (provably) only vector iterative solutions.
Search methods are slow and difficult in highly dimensional space.
Weiszfeld’s fixed point iteration formula had known problems with sometimes failing to converge.
Especially, when the points are dense in the close proximity of the gm, or gm coincides with one of them.
However, these problems are fixed in my new algorithm here.
There will eventually be a multithreaded version.