NPL
Neurological Programs and Libraries
statistics.h File Reference
#include <Eigen/Dense>
#include "npltypes.h"
#include "mrimage.h"

Go to the source code of this file.

Classes

struct  npl::RegrResult
 
class  npl::StudentsT
 Student's T-distribution. A cache of the Probability Density Function and cumulative density function is created using the analytical PDF. More...
 
class  npl::Classifier
 Base class for all ND classifiers. More...
 
class  npl::KMeans
 K-means classifier. More...
 
class  npl::ExpMax
 Expectation Maximization With Gaussian Mixture Model. More...
 

Namespaces

 npl
 

Functions

double npl::sample_var (const Ref< const VectorXd > vec)
 Computes the statistical variance of a column vector. More...
 
void npl::regressOutLS (VectorXd &signal, const MatrixXd &X, const MatrixXd &covInv)
 Removes the effects of X from signal (y). Note that this takes both X and the pseudoinverse of X because the bulk of the computation will be on the pseudoinverse. More...
 
template<typename T >
void npl::fillGaussian (Ref< T > m)
 
double npl::gaussianPDF (double mean, double sd, double x)
 1D Gaussian distribution function More...
 
double npl::gaussianCDF (double mean, double sd, double x)
 1D Gaussian cumulative distribution function More...
 
double npl::gammaPDF_MS (double mean, double sd, double x)
 PDF for the gamma distribution, if mean is negative then it is assumed that x should be negated as well. Unlike gammaPDF, this takes the mean and standard deviation (_MS) More...
 
double npl::mutualInformation (size_t len, double *a, double *b, size_t mbin)
 Computes mutual information between signal a and signal b which are of length len. Marginal bins used is mbin. More...
 
double npl::correlation (size_t len, double *a, double *b)
 Computes correlation between signal a and signal b which are of length len. More...
 
double npl::sample_var (int count, double sum, double sumsqr)
 Takes a count, sum and sumsqr and returns the sample variance. This is slightly different than the variance definition and I can never remember the exact formulation. More...
 
double npl::sample_corr (int count, double sum1, double sum2, double sumsq1, double sumsq2, double s1s2)
 Computes the sample correlation. More...
 
void npl::regress (RegrResult *out, const Ref< const VectorXd > y, const Ref< const MatrixXd > X, const Ref< const VectorXd > covInv, const Ref< const MatrixXd > Xinv, const StudentsT &distrib)
 Computes the Ordinary Least Square predictors, beta for. More...
 
void npl::regress (RegrResult *out, const Ref< const VectorXd > y, const Ref< const MatrixXd > X)
 Computes the Ordinary Least Square predictors, beta for. More...
 
void npl::randomizePowerIterationSVD (const Ref< const MatrixXd > A, size_t subsize, size_t poweriters, MatrixXd &U, VectorXd &E, MatrixXd &V)
 
void npl::randomizePowerIterationSVD (const Ref< const MatrixXd > A, double tol, size_t startrank, size_t maxrank, size_t poweriters, MatrixXd &U, VectorXd &E, MatrixXd &V)
 
MatrixXd npl::pca (const Ref< const MatrixXd > X, double varth=1, int odim=-1)
 Computes the Principal Components of input matrix X. More...
 
MatrixXd npl::rpiPCA (const Ref< const MatrixXd > X, double varth, int odim)
 Computes the Principal Components of input matrix X using the randomized power iteration SVD algorithm. More...
 
MatrixXd npl::symICA (const Ref< const MatrixXd > Xin, MatrixXd *unmix=NULL)
 Computes the Independent Components of input matrix X using symmetric decorrlation. Note that you should run PCA on X before running ICA. More...
 
MatrixXd npl::asymICA (const Ref< const MatrixXd > Xin, MatrixXd *unmix=NULL)
 Computes the Independent Components of input matrix X using sequential component extraction. Note that you should run PCA on X before running ICA. More...
 
MatrixXd npl::pseudoInverse (const Ref< const MatrixXd > X)
 Computes the pseudoinverse of the input matrix. More...
 
VectorXd npl::shootingRegr (const Ref< const MatrixXd > X, const Ref< const VectorXd > y, double gamma)
 Performs LASSO regression using the 'shooting' algorithm of. More...
 
VectorXd npl::activeShootingRegr (const Ref< const MatrixXd > X, const Ref< const VectorXd > y, double gamma)
 Performs LASSO regression using the 'activeShooting' algorithm of. More...
 
MatrixXd npl::pcacov (const Ref< const MatrixXd > cov, double varth)
 Computes the Principal Components of input matrix X using the covariance matrix. More...
 
void npl::expMax1D (const Ref< const VectorXd > data, vector< std::function< double(double, double, double)>> pdfs, Ref< VectorXd > mean, Ref< VectorXd > sd, Ref< VectorXd > prior, std::string plotfile="")
 Computes the mean and standard deviation of multiple distributions based on 1D data. The probability distribution functions should be passed in through a vector of function objects (pdfs) taking mu/sd/x. More...
 
void npl::gaussGammaMixtureModel (const Ref< const VectorXd > data, Ref< VectorXd > mu, Ref< VectorXd > sd, Ref< VectorXd > prior, std::string plotfile)
 Computes the mean and standard deviation of multiple distributions based on 1D data. This is a special version in which a negative gamma, a gaussian and positive gamma. The means of the negative and positive gamma are relative to the center of the gaussian. More...
 
void npl::approxKMeans (const Ref< const MatrixXd > samples, size_t nclass, MatrixXd &means)
 Approximates k-means using the algorithm of: More...
 
int npl::fastSearchFindDP (const Eigen::MatrixXf &samples, double thresh, double outthresh, Eigen::VectorXi &classes, bool brute=false)
 Algorithm of unsupervised learning (clustering) based on density. More...
 
int npl::findDensityPeaks (const Eigen::MatrixXf &samples, double thresh, Eigen::VectorXf &rho, Eigen::VectorXf &delta, Eigen::VectorXi &parent)
 Computes Density and Peak computation for Fast Search and Find of Density Peaks algorithm. More...
 
int npl::findDensityPeaks_brute (const Eigen::MatrixXf &samples, double thresh, Eigen::VectorXf &rho, Eigen::VectorXf &delta, Eigen::VectorXi &parent)
 Computes Density and Peak computation for Fast Search and Find of Density Peaks algorithm. This is a slower, non-bin based version. More...