Trait rstats::VecVecf64 [−][src]
pub trait VecVecf64 {}Show methods
fn acentroid(self) -> Vec<f64>; fn hcentroid(self) -> Vec<f64>; fn trend(self, eps: f64, v: Vec<Vec<f64>>) -> Vec<f64>; fn translate(self, m: &[f64]) -> Vec<Vec<f64>>; fn distsums(self) -> Vec<f64>; fn distsuminset(self, indx: usize) -> f64; fn distsum(self, v: &[f64]) -> f64; fn dists(self, v: &[f64]) -> Vec<f64>; fn medoid(self) -> (f64, usize, f64, usize); fn eccentricities(self) -> Vec<Vec<f64>>; fn exacteccs(self, eps: f64) -> Vec<Vec<f64>>; fn sortedeccs(self, ascending: bool, eps: f64) -> (Vec<f64>, Vec<f64>); fn wsortedeccs(self, ws: &[f64], eps: f64) -> (Vec<f64>, Vec<f64>, Vec<f64>); fn wsortedcos(
self,
medmed: &[f64],
med: &[f64],
ws: &[f64]
) -> (Vec<f64>, Vec<f64>); fn nxmember(self, indx: usize) -> Vec<f64>; fn eccmember(self, indx: usize) -> Vec<f64>; fn nxnonmember(self, p: &[f64]) -> Vec<f64>; fn eccnonmember(self, p: &[f64]) -> Vec<f64>; fn wnxnonmember(self, ws: &[f64], p: &[f64]) -> Vec<f64>; fn mags(self) -> Vec<f64>; fn moe(self, eps: f64) -> (MStats, Med); fn emedoid(self, eps: f64) -> (f64, usize, f64, usize); fn firstpoint(self) -> Vec<f64>; fn nmedian(self, eps: f64) -> Vec<f64>; fn gmedian(self, eps: f64) -> Vec<f64>; fn wgmedian(self, ws: &[f64], eps: f64) -> Vec<f64>;
Expand description
Methods applicable to vector of vectors of
Required methods
fn translate(self, m: &[f64]) -> Vec<Vec<f64>>
[src]
fn translate(self, m: &[f64]) -> Vec<Vec<f64>>
[src]Subtract m from all points - e.g. transform to zero median form
fn distsuminset(self, indx: usize) -> f64
[src]
fn distsuminset(self, indx: usize) -> f64
[src]Fast sums of distances from each point to all other points
fn distsum(self, v: &[f64]) -> f64
[src]
fn distsum(self, v: &[f64]) -> f64
[src]Sum of distances from arbitrary point (v) to all the points in self
fn dists(self, v: &[f64]) -> Vec<f64>
[src]
fn dists(self, v: &[f64]) -> Vec<f64>
[src]Individual distances from any point v (typically not in self) to all the points in self.
fn eccentricities(self) -> Vec<Vec<f64>>
[src]
fn eccentricities(self) -> Vec<Vec<f64>>
[src]Eccentricity vectors from each point
fn exacteccs(self, eps: f64) -> Vec<Vec<f64>>
[src]
fn exacteccs(self, eps: f64) -> Vec<Vec<f64>>
[src]Exact eccentricity vectors from all member points by first finding the Geometric Median.
As well as being more accurate, it is usually faster than eccentricities
above,
especially for large numbers of points.
fn sortedeccs(self, ascending: bool, eps: f64) -> (Vec<f64>, Vec<f64>)
[src]
fn sortedeccs(self, ascending: bool, eps: f64) -> (Vec<f64>, Vec<f64>)
[src]Returns ( gm, sorted eccentricities magnitudes )
fn wsortedeccs(self, ws: &[f64], eps: f64) -> (Vec<f64>, Vec<f64>, Vec<f64>)
[src]
fn wsortedeccs(self, ws: &[f64], eps: f64) -> (Vec<f64>, Vec<f64>, Vec<f64>)
[src]( wgm, sorted eccentricities magnitudes, associated cpdf )
fn wsortedcos(
self,
medmed: &[f64],
med: &[f64],
ws: &[f64]
) -> (Vec<f64>, Vec<f64>)
[src]
fn wsortedcos(
self,
medmed: &[f64],
med: &[f64],
ws: &[f64]
) -> (Vec<f64>, Vec<f64>)
[src]Sorted cosines magnitudes and cpdf, needs central median
fn nxmember(self, indx: usize) -> Vec<f64>
[src]
fn nxmember(self, indx: usize) -> Vec<f64>
[src]Next approx median point from this member point given by its indx
fn wnxnonmember(self, ws: &[f64], p: &[f64]) -> Vec<f64>
[src]
fn wnxnonmember(self, ws: &[f64], p: &[f64]) -> Vec<f64>
[src]Weighted eccentricity vector for a non member point
fn moe(self, eps: f64) -> (MStats, Med)
[src]
fn moe(self, eps: f64) -> (MStats, Med)
[src]Median and quartiles of eccentricities (new robust measure of spread of a multivariate sample)
fn emedoid(self, eps: f64) -> (f64, usize, f64, usize)
[src]
fn emedoid(self, eps: f64) -> (f64, usize, f64, usize)
[src]Medoid and Outlier as defined by eccentricities.
fn firstpoint(self) -> Vec<f64>
[src]
fn firstpoint(self) -> Vec<f64>
[src]Geometric medians of a set First iteration point for geometric medians
Implementations on Foreign Types
impl VecVecf64 for &[Vec<f64>]
[src]
impl VecVecf64 for &[Vec<f64>]
[src]fn acentroid(self) -> Vec<f64>
[src]
fn acentroid(self) -> Vec<f64>
[src]acentroid = simple multidimensional arithmetic mean
Example
use rstats::{Vecf64,VecVec,functions::genvec}; let pts = genvec(15,15,255,30); let centre = pts.acentroid(); let dist = pts.distsum(¢re); assert_eq!(dist, 4.14556218326653_f64);
fn hcentroid(self) -> Vec<f64>
[src]
fn hcentroid(self) -> Vec<f64>
[src]hcentroid = multidimensional harmonic mean
Example
use rstats::{Vecf64,VecVec,functions::genvec}; let pts = genvec(15,15,255,30); let centre = pts.hcentroid(); let dist = pts.distsum(¢re); assert_eq!(dist, 5.623778191797538_f64);
fn trend(self, eps: f64, v: Vec<Vec<f64>>) -> Vec<f64>
[src]
fn trend(self, eps: f64, v: Vec<Vec<f64>>) -> Vec<f64>
[src]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.
fn translate(self, m: &[f64]) -> Vec<Vec<f64>>
[src]
fn translate(self, m: &[f64]) -> Vec<Vec<f64>>
[src]Translates the whole set by 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 misguidedly used mean (acentroid
here), or the quasi median,
both of which depend on the choice of axis.
fn distsums(self) -> Vec<f64>
[src]
fn distsums(self) -> Vec<f64>
[src]For each member point, gives its sum of distances to all other points. This is the efficient workhorse of distance based analysis.
fn distsuminset(self, indx: usize) -> f64
[src]
fn distsuminset(self, indx: usize) -> f64
[src]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
.
fn dists(self, v: &[f64]) -> Vec<f64>
[src]
fn dists(self, v: &[f64]) -> Vec<f64>
[src]Individual distances from any point v, typically not a member, to all the members of self.
fn distsum(self, v: &[f64]) -> f64
[src]
fn distsum(self, v: &[f64]) -> f64
[src]The sum of distances from any single point v, typically not a member, to all the members of self.
Geometric Median is defined as the point which minimises this function.
fn medoid(self) -> (f64, usize, f64, usize)
[src]
fn medoid(self) -> (f64, usize, f64, usize)
[src]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 median.
This function returns a four-tuple:
(medoid_distance, medoid_index, outlier_distance, outlier_index).
Example
use rstats::{Vecf64,VecVec,functions::genvec}; let pts = genvec(15,15,255,30); let (dm,_,_,_) = pts.medoid(); assert_eq!(dm,4.812334638782327_f64);
fn eccentricities(self) -> Vec<Vec<f64>>
[src]
fn eccentricities(self) -> Vec<Vec<f64>>
[src]Finds approximate vectors from each member point towards the geometric median. Twice as fast as doing them individually, using symmetry.
fn exacteccs(self, eps: f64) -> Vec<Vec<f64>>
[src]
fn exacteccs(self, eps: f64) -> Vec<Vec<f64>>
[src]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.
fn sortedeccs(self, ascending: bool, eps: f64) -> (Vec<f64>, Vec<f64>)
[src]
fn sortedeccs(self, ascending: bool, eps: f64) -> (Vec<f64>, Vec<f64>)
[src]GM and sorted eccentricities magnitudes.
Describing a set of points self
in n dimensions
fn wsortedeccs(self, ws: &[f64], eps: f64) -> (Vec<f64>, Vec<f64>, Vec<f64>)
[src]
fn wsortedeccs(self, ws: &[f64], eps: f64) -> (Vec<f64>, Vec<f64>, Vec<f64>)
[src]Weighted geometric median, sorted eccentricities magnitudes, associated cummulative probability density function in [0,1] of the weights.
fn wsortedcos(
self,
medmed: &[f64],
zeromed: &[f64],
ws: &[f64]
) -> (Vec<f64>, Vec<f64>)
[src]
fn wsortedcos(
self,
medmed: &[f64],
zeromed: &[f64],
ws: &[f64]
) -> (Vec<f64>, Vec<f64>)
[src]Sorted cosines magnitudes, associated cummulative probability density function in [0,1] of the weights. Needs central median
fn nxmember(self, indx: usize) -> Vec<f64>
[src]
fn nxmember(self, indx: usize) -> Vec<f64>
[src]Vector eccentricity
or measure of
not being the geometric median
, added to a given member point.
The true geometric median is as yet unknown.
The member point in question is specified by its index indx
.
This function is suitable for a single member point.
fn eccmember(self, indx: usize) -> Vec<f64>
[src]
fn eccmember(self, indx: usize) -> Vec<f64>
[src]Vector eccentricity
or measure of
not being the geometric median
for a member point.
The true geometric median is as yet unknown.
The true geometric median would return zero.
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 needed, use exacteccs
above.
fn nxnonmember(self, p: &[f64]) -> Vec<f64>
[src]
fn nxnonmember(self, p: &[f64]) -> Vec<f64>
[src]Eccentricity vector added to a non member point, while the true geometric median is as yet unknown. This function is suitable for a single non-member point.
fn eccnonmember(self, p: &[f64]) -> Vec<f64>
[src]
fn eccnonmember(self, p: &[f64]) -> Vec<f64>
[src]Eccentricity vector for a non member point, while 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.
fn wnxnonmember(self, ws: &[f64], p: &[f64]) -> Vec<f64>
[src]
fn wnxnonmember(self, ws: &[f64], p: &[f64]) -> Vec<f64>
[src]Next approximate weighted median, from a non member point.
fn moe(self, eps: f64) -> (MStats, Med)
[src]
fn moe(self, eps: f64) -> (MStats, Med)
[src]Mean and Std (in MStats struct), Median and quartiles (in Med struct) of scalar eccentricities of points in self. These are new robust measures of a cloud of multidimensional points (or multivariate sample).
fn emedoid(self, eps: f64) -> (f64, usize, f64, usize)
[src]
fn emedoid(self, eps: f64) -> (f64, usize, f64, usize)
[src]Eccentricity defined Medoid and Outlier.
This can give different results to medoid
above, defined by sums of distances,
especially for the outliers. See tests.rs.
Consider some point c and some other points, bunched up at a distance r from c.
The sum of their distances will be nr. Now, spread those points around a circle of radius r from c.
The sum of their distances from c will remain the same but the eccentricity of c will be much reduced.
Example
use rstats::{Vecf64,VecVec,functions::genvec}; pub const EPS:f64 = 1e-7; let d = 6_usize; let pt = genvec(d,24,7,13); // random test data 5x20 let (_medoideccentricity,medei,_outlierecccentricity,outei) = pt.emedoid(EPS); assert_eq!(medei,10); // index of e-medoid assert_eq!(outei,20); // index of e-outlier
fn nmedian(self, eps: f64) -> Vec<f64>
[src]
fn nmedian(self, eps: f64) -> Vec<f64>
[src]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.
fn firstpoint(self) -> Vec<f64>
[src]
fn firstpoint(self) -> Vec<f64>
[src]Possible first iteration point for geometric medians. Same as eccnonmember(origin), just saving the zero subtractions when moving from the origin