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 acentroid(self) -> Vec<f64>[src]

Arithmetic Centroid = euclidian mean of a set of points

fn hcentroid(self) -> Vec<f64>[src]

Harmonic Centroid = harmonic mean of a set of points

fn trend(self, eps: f64, v: Vec<Vec<f64>>) -> Vec<f64>[src]

Trend between two sets

fn translate(self, m: &[f64]) -> Vec<Vec<f64>>[src]

Subtract m from all points - e.g. transform to zero median form

fn distsums(self) -> Vec<f64>[src]

Sums of distances from each point to all other points.

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]

Sum of distances from arbitrary point (v) to all the points in self

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 medoid(self) -> (f64, usize, f64, usize)[src]

Medoid and Outlier (by distance) of a set of points

fn eccentricities(self) -> Vec<Vec<f64>>[src]

Eccentricity vectors from each point

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]

Returns ( gm, sorted eccentricities magnitudes )

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]

Sorted cosines magnitudes and cpdf, needs central median

fn nxmember(self, indx: usize) -> Vec<f64>[src]

Next approx median point from this member point given by its indx

fn eccmember(self, indx: usize) -> Vec<f64>[src]

Ecentricity of a member point given by its indx

fn nxnonmember(self, p: &[f64]) -> Vec<f64>[src]

Next approx median point from this nonmember point

fn eccnonmember(self, p: &[f64]) -> Vec<f64>[src]

Eccentricity vector for a non member point

fn wnxnonmember(self, ws: &[f64], p: &[f64]) -> Vec<f64>[src]

Weighted eccentricity vector for a non member point

fn mags(self) -> Vec<f64>[src]

magnitudes of a set of vectors

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]

Medoid and Outlier as defined by eccentricities.

fn firstpoint(self) -> Vec<f64>[src]

Geometric medians of a set First iteration point for geometric medians

fn nmedian(self, eps: f64) -> Vec<f64>[src]

Improved Weizsfeld’s Algorithm for geometric median

fn gmedian(self, eps: f64) -> Vec<f64>[src]

New secant algorithm for geometric median

fn wgmedian(self, ws: &[f64], eps: f64) -> Vec<f64>[src]

The weighted geometric median

Implementations on Foreign Types

impl VecVecf64 for &[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(&centre);
assert_eq!(dist, 4.14556218326653_f64);

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(&centre);
assert_eq!(dist, 5.623778191797538_f64);

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]

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]

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]

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]

Individual distances from any point v, typically not a member, to all the members of self.

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

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]

Next approximate weighted median, from a non member point.

fn mags(self) -> Vec<f64>[src]

Magnitudes of all the vectors in self

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]

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]

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]

Possible first iteration point for geometric medians. Same as eccnonmember(origin), just saving the zero subtractions when moving from the origin

fn gmedian(self, eps: f64) -> Vec<f64>[src]

Secant method with recovery from divergence for finding the geometric median

fn wgmedian(self, ws: &[f64], eps: f64) -> Vec<f64>[src]

Secant method with recovery for finding the weighted geometric median

Implementors