MTK++ Latest version: 0.2.0

Public Member Functions | Protected Member Functions | Protected Attributes
MTKpp::pls Class Reference

Partial Least Squares. More...

#include <mtkpp/src/Statistics/pls.h>

Inheritance diagram for MTKpp::pls:
Inheritance graph
[legend]
Collaboration diagram for MTKpp::pls:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 pls ()
 pls Constructor
 pls (table< double > *Y, table< double > *X, std::string method, int nlvs, std::string cv, bool &bError)
 pls Constructor
 pls (table< double > *Y, table< double > *X, std::string method, int nlvs, std::string cv, sheet *output, bool &bError)
 pls Constructor
 pls (std::string Y, std::string X, sheet *S, std::string method, int nlvs, std::string cv, sheet *output, bool &bError)
 pls Constructor
void run (bool &bError)
 pls Destructor
void runCV (bool &bError)
 Run CV PLS.
void setX (table< double > *x)
 Set X matrix.
void setY (table< double > *y)
 Set Y matrix.
void setMethod (std::string g)
 Set PLS Algorithm.
void setMaxIter (int i)
 Set Maximum number of iterations for iterative methods.
void setEpsilon (double e)
 Set Convergence criteria for iterative methods.
void setCV (std::string c)
 Set Cross validation method.
void setNITER (int i)
 Set number of samples to consider in RANDOM CV.
void setNTEST (int i)
 Set size of test set in RANDOM and LNO CV.
void setSEED (int s)
 Set random number generator seed in RANDOM CV.
void setNLV (int l)
 Set number of Latent Variables to be considered.
void setOutModel (sheet *s)
 The sheet where the model is stored.
double meanColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 BaseStats Destructor.
double meanColumn (ublas::matrix< double > &m, const int &i)
 BaseStats Destructor.
double meanRow (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get sample mean of row.
double meanRow (ublas::matrix< double > &m, const int &i)
 Get sample mean of row.
double sumColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get sum of column.
double sumColumn (ublas::matrix< double > &m, const int &i)
 Get sum of column.
double sumRow (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get sum of row.
double sumRow (ublas::matrix< double > &m, const int &i)
 Get sum of row.
double maxColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get max value of column.
double maxColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i, int &r)
 Get max value of column.
double maxColumn (ublas::matrix< double > &m, const int &i)
 Get max value of column.
double maxColumn (ublas::matrix< double > &m, const int &i, int &r)
 Get max value of column.
double maxRow (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get max value of row.
double maxRow (ublas::matrix< double > &m, const int &i)
 Get max value of row.
double minColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get min value of column.
double minColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i, int &r)
 Get min value of column.
double minColumn (ublas::matrix< double > &m, const int &i)
 Get min value of column.
double minColumn (ublas::matrix< double > &m, const int &i, int &r)
 Get min value of column.
double minRow (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get min value of row.
double minRow (ublas::matrix< double > &m, const int &i)
 Get min value of row.
int getColumnCenters (Eigen::Matrix< double, Dynamic, Dynamic > &mat, Eigen::Matrix< double, Dynamic, Dynamic > &mat_centers)
 Get Mean values for each column in the matrix.
int getColumnCenters (ublas::matrix< double > &mat, ublas::matrix< double > &mat_centers)
 Get Mean values for each column in the matrix.
void centerColumns (Eigen::Matrix< double, Dynamic, Dynamic > &m1, Eigen::Matrix< double, Dynamic, Dynamic > &m2)
 Center matrix by column.
void centerColumns (ublas::matrix< double > &m1, ublas::matrix< double > &m2)
 Center matrix by column.
void centerRows (Eigen::Matrix< double, Dynamic, Dynamic > &m1, Eigen::Matrix< double, Dynamic, Dynamic > &m2)
 Center matrix by row.
void centerRows (ublas::matrix< double > &m1, ublas::matrix< double > &m2)
 Center matrix by row.
void zScoreColumns (Eigen::Matrix< double, Dynamic, Dynamic > &m1, Eigen::Matrix< double, Dynamic, Dynamic > &m2)
 Calculate Z-Scores of matrix by column.
void zScoreColumns (ublas::matrix< double > &m1, ublas::matrix< double > &m2)
 Calculate Z-Scores of matrix by column.
void zScoreRows (Eigen::Matrix< double, Dynamic, Dynamic > &m1, Eigen::Matrix< double, Dynamic, Dynamic > &m2)
 Calculate Z-Scores of matrix by row.
void zScoreRows (ublas::matrix< double > &m1, ublas::matrix< double > &m2)
 Calculate Z-Scores of matrix by row.
int autoScale (Eigen::Matrix< double, Dynamic, Dynamic > &old_mat, Eigen::Matrix< double, Dynamic, Dynamic > &new_mat, Eigen::Matrix< double, Dynamic, Dynamic > &centers, Eigen::Matrix< double, Dynamic, Dynamic > &stdDevs)
 Autoscale using previously computed means and standard deviations.
int autoScale (ublas::matrix< double > &old_mat, ublas::matrix< double > &new_mat, ublas::matrix< double > &centers, ublas::matrix< double > &stdDevs)
 Autoscale using previously computed means and standard deviations.
double varianceColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get variance of column.
double varianceColumn (ublas::matrix< double > &m, const int &i)
 Get variance of column.
double varianceRow (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get variance of row.
double varianceRow (ublas::matrix< double > &m, const int &i)
 Get variance of row.
int getStdDevColumns (Eigen::Matrix< double, Dynamic, Dynamic > &mat, Eigen::Matrix< double, Dynamic, Dynamic > &stdDev_mat)
 Get standard deviation for each column.
int getStdDevColumns (ublas::matrix< double > &mat, ublas::matrix< double > &stdDev_mat)
 Get standard deviation for each column.
double standardDeviationColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get standard deviation of column.
double standardDeviationColumn (ublas::matrix< double > &m, const int &i)
 Get standard deviation of column.
double standardDeviationRow (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i)
 Get standard deviation of row.
double standardDeviationRow (ublas::matrix< double > &m, const int &i)
 Get standard deviation of row.
double covarianceColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m1, const int &i1, Eigen::Matrix< double, Dynamic, Dynamic > &m2, const int &i2)
 Calculate covariance between two column in different matrices.
double covarianceColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m, const int &i, const int &j)
 Calculate covariance between two columns in the same matrix.
double covarianceColumn (ublas::matrix< double > &m1, const int &i1, ublas::matrix< double > &m2, const int &i2)
 Calculate covariance between two column in different matrices.
double covarianceColumn (ublas::matrix< double > &m, const int &i, const int &j)
 Calculate covariance between two columns in the same matrix.
void covarianceMatrix (Eigen::Matrix< double, Dynamic, Dynamic > &A, Eigen::Matrix< double, Dynamic, Dynamic > &CovMat)
 Calculates the Covariance Matrix (or variance, variance-covariance, dispersion)
void covarianceMatrix (ublas::matrix< double > &A, ublas::matrix< double > &CovMat)
 Calculates the Covariance Matrix (or variance, variance-covariance, dispersion)
void covarianceMatrix (ublas::matrix< double > &A, ublas::matrix< double, ublas::column_major > &CovMat)
double correlationCoefficientColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m1, const int &i1, Eigen::Matrix< double, Dynamic, Dynamic > &m2, const int &i2)
 Calculate correlation coefficient by column.
double correlationCoefficientColumn (ublas::matrix< double > &m1, const int &i1, ublas::matrix< double > &m2, const int &i2)
 Calculate correlation coefficient by column.
double rSquaredColumn (Eigen::Matrix< double, Dynamic, Dynamic > &m1, const int &i1, Eigen::Matrix< double, Dynamic, Dynamic > &m2, const int &i2)
 Calculate R^2 by column.
double rSquaredColumn (ublas::matrix< double > &m1, const int &i1, ublas::matrix< double > &m2, const int &i2)
 Calculate R^2 by column.
double AdjustedRSquaredColumn (Eigen::Matrix< double, Dynamic, Dynamic > &Ys, const int &i1, Eigen::Matrix< double, Dynamic, Dynamic > &Y_Pred, const int &i2, const int &i3)
 Calculate Adjusted R^2 by column.
double AdjustedRSquaredColumn (ublas::matrix< double > &Ys, const int &i1, ublas::matrix< double > &Y_Pred, const int &i2, const int &i3)
 Calculate Adjusted R^2 by column.
double RMSE (Eigen::Matrix< double, Dynamic, Dynamic > &Ys, const int &i, Eigen::Matrix< double, Dynamic, Dynamic > &Y_Pred, const int &j)
 Calculate root mean squared error.
double RMSE (ublas::matrix< double > &Ys, const int &i, ublas::matrix< double > &Y_Pred, const int &j)
 Calculate root mean squared error.
double MSE (Eigen::Matrix< double, Dynamic, Dynamic > &Ys, const int &i, Eigen::Matrix< double, Dynamic, Dynamic > &Y_Pred, const int &j)
 Calculate mean squared error.
double MSE (ublas::matrix< double > &Ys, const int &i, ublas::matrix< double > &Y_Pred, const int &j)
 Calculate mean squared error.
double UnsignedError (Eigen::Matrix< double, Dynamic, Dynamic > &Ys, const int &i, Eigen::Matrix< double, Dynamic, Dynamic > &Y_Pred, const int &j)
 Calculate unsigned/absolute error.
double UnsignedError (ublas::matrix< double > &Ys, const int &i, ublas::matrix< double > &Y_Pred, const int &j)
 Calculate unsigned/absolute error.
double SignedError (Eigen::Matrix< double, Dynamic, Dynamic > &Ys, const int &i, Eigen::Matrix< double, Dynamic, Dynamic > &Y_Pred, const int &j)
 Calculate signed error.
double SignedError (ublas::matrix< double > &Ys, const int &i, ublas::matrix< double > &Y_Pred, const int &j)
 Calculate signed error.
double SumSquaredDeviationsColumn (Eigen::Matrix< double, Dynamic, Dynamic > &Ys, const int &i)
 Calculates the Sum of squared deviations.
double SumSquaredDeviationsColumn (ublas::matrix< double > &Ys, const int &i)
 Calculates the Sum of squared deviations.
double SumSquaredRegressionColumn (Eigen::Matrix< double, Dynamic, Dynamic > &Ys, Eigen::Matrix< double, Dynamic, Dynamic > &Y_Pred)
 Calculates the Sum of squared due to regression.
double SumSquaredRegressionColumn (ublas::matrix< double > &Ys, ublas::matrix< double > &Y_Pred)
 Calculates the Sum of squared due to regression.
double SumSquaredResidualErrorsColumn (Eigen::Matrix< double, Dynamic, Dynamic > &Ys, Eigen::Matrix< double, Dynamic, Dynamic > &Y_Pred, Eigen::Matrix< double, Dynamic, Dynamic > &Residuals)
 Calculates the Sum of squared residuals (Errors)
double SumSquaredResidualErrorsColumn (Eigen::Matrix< double, Dynamic, Dynamic > &Ys, const int &c, Eigen::Matrix< double, Dynamic, Dynamic > &Y_Pred, const int &d)
 Calculates the Sum of squared residuals (Errors)
double SumSquaredResidualErrorsColumn (ublas::matrix< double > &Ys, ublas::matrix< double > &Y_Pred, ublas::matrix< double > &Residuals)
 Calculates the Sum of squared residuals (Errors)
double SumSquaredResidualErrorsColumn (ublas::matrix< double > &Ys, const int &c, ublas::matrix< double > &Y_Pred, const int &d)
 Calculates the Sum of squared residuals (Errors)

Protected Member Functions

int kernelPLS ()
 Kernel Partial Least Squares.

Protected Attributes

table< double > * itsX
 X matrix.
table< double > * itsY
 Y matrix.
unsigned int YRows
 Number of rows in Y and X.
unsigned int XColumns
 Number of Columns in X.
std::string itsMethod
 PLS Algorithm.
unsigned int maxIter
 Maximum number of iterations for iterative methods.
double epsilon
 Convergence criteria for iterative methods.
std::string CV
 Cross validation parameters.
unsigned int nEXT
 Number of prediction set in CV nEXT = N/nTest.
unsigned int nITER
 Number of samples to consider in RANDOM CV.
unsigned int nTEST
 Size of test set in RANDOM and LNO CV.
int SEED
 Random number generator seed in RANDOM CV.
unsigned int nLV
 Number of Latent Variables to be considered.
sheetoutModel
 The sheet where the model is stored.

Detailed Description

Partial Least Squares.

Author:
Martin Peters

Constructor & Destructor Documentation

MTKpp::pls::pls ( )

pls Constructor

References CV, epsilon, itsMethod, itsX, itsY, maxIter, nITER, nLV, nTEST, outModel, and SEED.

MTKpp::pls::pls ( table< double > *  Y,
table< double > *  X,
std::string  method,
int  nlvs,
std::string  cv,
bool &  bError 
)

pls Constructor

Parameters:
YY matrix
XX matrix
methodmethod
nlvsnumber of latent variables
cvcross validation method
bErrorerror boolean

References CV, epsilon, MTKpp::table< T >::getNumColumns(), MTKpp::table< T >::getNumRows(), itsMethod, itsX, itsY, maxIter, nITER, nLV, nTEST, outModel, SEED, X, XColumns, and YRows.

MTKpp::pls::pls ( table< double > *  Y,
table< double > *  X,
std::string  method,
int  nlvs,
std::string  cv,
sheet output,
bool &  bError 
)

pls Constructor

Parameters:
YY matrix
XX matrix
methodmethod
nlvsnumber of latent variables
cvcross validation method
outputsheet pointer
bErrorerror boolean

References CV, epsilon, MTKpp::table< T >::getNumColumns(), MTKpp::table< T >::getNumRows(), itsMethod, itsX, itsY, maxIter, nITER, nLV, nTEST, outModel, SEED, X, XColumns, and YRows.

MTKpp::pls::pls ( std::string  Y,
std::string  X,
sheet S,
std::string  method,
int  nlvs,
std::string  cv,
sheet output,
bool &  bError 
)

pls Constructor

Parameters:
YY name
XX name
Ssheet pointer
methodmethod
nlvsnumber of latent variables
cvcross validation method
outputsheet pointer
bErrorerror boolean

References CV, epsilon, MTKpp::table< T >::getNumColumns(), MTKpp::sheet::getTable(), itsMethod, itsX, itsY, maxIter, nITER, nLV, nTEST, outModel, SEED, XColumns, and YRows.


Member Function Documentation

void MTKpp::pls::run ( bool &  bError)

pls Destructor

Run PLS

Parameters:
bErrorerror boolean

References CV, itsMethod, kernelPLS(), outModel, and runCV().

Referenced by main().

void MTKpp::pls::runCV ( bool &  bError)
void MTKpp::pls::setX ( table< double > *  x)

Set X matrix.

Parameters:
xtable pointer

References itsX.

void MTKpp::pls::setY ( table< double > *  y)

Set Y matrix.

Parameters:
ytable pointer

References itsY.

void MTKpp::pls::setMethod ( std::string  g)

Set PLS Algorithm.

Parameters:
gPLS Algorithm

References itsMethod.

void MTKpp::pls::setMaxIter ( int  i)

Set Maximum number of iterations for iterative methods.

Parameters:
imax number of iterations

References maxIter.

void MTKpp::pls::setEpsilon ( double  e)

Set Convergence criteria for iterative methods.

Parameters:
eConvergence criteria

References epsilon.

void MTKpp::pls::setCV ( std::string  c)

Set Cross validation method.

Parameters:
cCV method

References CV.

void MTKpp::pls::setNITER ( int  i)

Set number of samples to consider in RANDOM CV.

Parameters:
inumber of samples

References nITER.

Referenced by main().

void MTKpp::pls::setNTEST ( int  i)

Set size of test set in RANDOM and LNO CV.

Parameters:
isize of test set

References nTEST.

Referenced by main().

void MTKpp::pls::setSEED ( int  s)

Set random number generator seed in RANDOM CV.

Parameters:
srandom number generator seed

References SEED, and MTKpp::setRandomNumberSeed().

Referenced by main().

void MTKpp::pls::setNLV ( int  l)

Set number of Latent Variables to be considered.

Parameters:
lnumber of LVs

References nLV.

void MTKpp::pls::setOutModel ( sheet s)

The sheet where the model is stored.

Parameters:
ssheet pointer

References outModel.

int MTKpp::pls::kernelPLS ( ) [protected]

Kernel Partial Least Squares.

Y[N][M] X[N][R] +- -+ +- -+ | Y11 Y21 . . Y1M | | X11 X12 . . X1R | | Y21 Y22 . . Y2M | | X21 X22 . . X2R | | . . . . . | | . . . . . | | . . . . . | | . . . . . | | YN1 Y2N . . YNM | | XN1 . . . XNR | +- -+ +- -+

PLS regression searches for a set of components (latent vectors) that performs a simultaneous decomposition of X and Y with the constraint that these components explain as much as possible of the covariance between them. Then a regression step, where the decomposition of X is used to predict Y is performed.

T -- Score Matrix for X T[N][MaxComponents] U -- Score Matrix for Y U[N][MaxComponents] P -- Loading Matrix for X P[R][MaxComponents] C -- Weight Matrix for Y C[M][MaxComponents] W -- Weighting Matrix W[R][MaxComponents] E -- Residual Matrix for X E[N][R] F -- Residual Matrix for Y F[N][M] B -- Regression Coefficients B[N][1]

X = TP' + E Y = TC' + E

Y_pred = X*B + E where: B = W * inv(P' * W) * C'

-- Reference: Herve Abdi, Partial Least Squares (PLS) Regression, University of Texas at Dallas

Referenced by run().

double MTKpp::BaseStats::meanColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]
double MTKpp::BaseStats::meanColumn ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

BaseStats Destructor.

Get sample mean of column

Parameters:
mMatrix pointer
icolumn index
Returns:
sample average
double MTKpp::BaseStats::meanRow ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get sample mean of row.

Parameters:
mMatrix pointer
irow index
Returns:
sample average

Referenced by main(), and MTKpp::BaseStats::varianceRow().

double MTKpp::BaseStats::meanRow ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get sample mean of row.

Parameters:
mMatrix pointer
irow index
Returns:
sample average
double MTKpp::BaseStats::sumColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get sum of column.

Parameters:
mMatrix pointer
icolumn index
Returns:
sum of values

Referenced by main().

double MTKpp::BaseStats::sumColumn ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get sum of column.

Parameters:
mMatrix pointer
icolumn index
Returns:
sum of values
double MTKpp::BaseStats::sumRow ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get sum of row.

Parameters:
mMatrix pointer
irow index
Returns:
sum of values

Referenced by main().

double MTKpp::BaseStats::sumRow ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get sum of row.

Parameters:
mMatrix pointer
irow index
Returns:
sum of values
double MTKpp::BaseStats::maxColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get max value of column.

Parameters:
mMatrix pointer
icolumn index
Returns:
max value

Referenced by main().

double MTKpp::BaseStats::maxColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i,
int &  r 
) [inherited]

Get max value of column.

Parameters:
mMatrix pointer
icolumn index
rrow index [index of max value]
Returns:
max value
double MTKpp::BaseStats::maxColumn ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get max value of column.

Parameters:
mMatrix pointer
icolumn index
Returns:
max value
double MTKpp::BaseStats::maxColumn ( ublas::matrix< double > &  m,
const int &  i,
int &  r 
) [inherited]

Get max value of column.

Parameters:
mMatrix pointer
icolumn index
rrow index [index of max value]
Returns:
max value
double MTKpp::BaseStats::maxRow ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get max value of row.

Parameters:
mMatrix pointer
irow index
Returns:
max value

Referenced by main().

double MTKpp::BaseStats::maxRow ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get max value of row.

Parameters:
mMatrix pointer
irow index
Returns:
max value
double MTKpp::BaseStats::minColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get min value of column.

Parameters:
mMatrix pointer
icolumn index
Returns:
min value

Referenced by main().

double MTKpp::BaseStats::minColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i,
int &  r 
) [inherited]

Get min value of column.

Parameters:
mMatrix pointer
icolumn index
rrow index [index of min value]
Returns:
min value
double MTKpp::BaseStats::minColumn ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get min value of column.

Parameters:
mMatrix pointer
icolumn index
Returns:
min value
double MTKpp::BaseStats::minColumn ( ublas::matrix< double > &  m,
const int &  i,
int &  r 
) [inherited]

Get min value of column.

Parameters:
mMatrix pointer
icolumn index
rrow index [index of min value]
Returns:
min value
double MTKpp::BaseStats::minRow ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get min value of row.

Parameters:
mMatrix pointer
irow index
Returns:
min value

Referenced by main().

double MTKpp::BaseStats::minRow ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get min value of row.

Parameters:
mMatrix pointer
irow index
Returns:
min value
int MTKpp::BaseStats::getColumnCenters ( Eigen::Matrix< double, Dynamic, Dynamic > &  mat,
Eigen::Matrix< double, Dynamic, Dynamic > &  mat_centers 
) [inherited]

Get Mean values for each column in the matrix.

Parameters:
matMatrix pointer
mat_centersMatrix pointer
Returns:
sucess

References MTKpp::BaseStats::meanColumn().

Referenced by main(), and MTKpp::pca::run().

int MTKpp::BaseStats::getColumnCenters ( ublas::matrix< double > &  mat,
ublas::matrix< double > &  mat_centers 
) [inherited]

Get Mean values for each column in the matrix.

Parameters:
matMatrix pointer
mat_centersMatrix pointer
Returns:
sucess

References MTKpp::BaseStats::meanColumn().

void MTKpp::BaseStats::centerColumns ( Eigen::Matrix< double, Dynamic, Dynamic > &  m1,
Eigen::Matrix< double, Dynamic, Dynamic > &  m2 
) [inherited]

Center matrix by column.

Parameters:
m1Matrix pointer
m2Matrix pointer

References MTKpp::BaseStats::meanColumn().

Referenced by main(), MTKpp::pca::run(), and MTKpp::BaseStats::zScoreColumns().

void MTKpp::BaseStats::centerColumns ( ublas::matrix< double > &  m1,
ublas::matrix< double > &  m2 
) [inherited]

Center matrix by column.

Parameters:
m1Matrix pointer
m2Matrix pointer

References MTKpp::BaseStats::meanColumn().

void MTKpp::BaseStats::centerRows ( Eigen::Matrix< double, Dynamic, Dynamic > &  m1,
Eigen::Matrix< double, Dynamic, Dynamic > &  m2 
) [inherited]

Center matrix by row.

Parameters:
m1Matrix pointer
m2Matrix pointer
void MTKpp::BaseStats::centerRows ( ublas::matrix< double > &  m1,
ublas::matrix< double > &  m2 
) [inherited]

Center matrix by row.

Parameters:
m1Matrix pointer
m2Matrix pointer
void MTKpp::BaseStats::zScoreColumns ( Eigen::Matrix< double, Dynamic, Dynamic > &  m1,
Eigen::Matrix< double, Dynamic, Dynamic > &  m2 
) [inherited]

Calculate Z-Scores of matrix by column.

Parameters:
m1Matrix pointer
m2Matrix pointer

References MTKpp::BaseStats::centerColumns(), and MTKpp::BaseStats::standardDeviationColumn().

Referenced by main().

void MTKpp::BaseStats::zScoreColumns ( ublas::matrix< double > &  m1,
ublas::matrix< double > &  m2 
) [inherited]

Calculate Z-Scores of matrix by column.

Parameters:
m1Matrix pointer
m2Matrix pointer

References MTKpp::BaseStats::centerColumns(), and MTKpp::BaseStats::standardDeviationColumn().

void MTKpp::BaseStats::zScoreRows ( Eigen::Matrix< double, Dynamic, Dynamic > &  m1,
Eigen::Matrix< double, Dynamic, Dynamic > &  m2 
) [inherited]

Calculate Z-Scores of matrix by row.

Parameters:
m1Matrix pointer
m2Matrix pointer
void MTKpp::BaseStats::zScoreRows ( ublas::matrix< double > &  m1,
ublas::matrix< double > &  m2 
) [inherited]

Calculate Z-Scores of matrix by row.

Parameters:
m1Matrix pointer
m2Matrix pointer
int MTKpp::BaseStats::autoScale ( Eigen::Matrix< double, Dynamic, Dynamic > &  old_mat,
Eigen::Matrix< double, Dynamic, Dynamic > &  new_mat,
Eigen::Matrix< double, Dynamic, Dynamic > &  centers,
Eigen::Matrix< double, Dynamic, Dynamic > &  stdDevs 
) [inherited]

Autoscale using previously computed means and standard deviations.

Parameters:
old_matmatrix pointer
new_matmatrix pointer
centersmatrix of means
stdDevsmatrix of standard deviations
Returns:
success

Referenced by main().

int MTKpp::BaseStats::autoScale ( ublas::matrix< double > &  old_mat,
ublas::matrix< double > &  new_mat,
ublas::matrix< double > &  centers,
ublas::matrix< double > &  stdDevs 
) [inherited]

Autoscale using previously computed means and standard deviations.

Parameters:
old_matmatrix pointer
new_matmatrix pointer
centersmatrix of means
stdDevsmatrix of standard deviations
Returns:
success
double MTKpp::BaseStats::varianceColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get variance of column.

Parameters:
mMatrix pointer
icolumn index
Returns:
variance

References MTKpp::BaseStats::meanColumn().

Referenced by MTKpp::BaseStats::getStdDevColumns(), main(), and MTKpp::BaseStats::standardDeviationColumn().

double MTKpp::BaseStats::varianceColumn ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get variance of column.

Parameters:
mMatrix pointer
icolumn index
Returns:
variance

References MTKpp::BaseStats::meanColumn().

double MTKpp::BaseStats::varianceRow ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get variance of row.

Parameters:
mMatrix pointer
irow index
Returns:
variance

References MTKpp::BaseStats::meanRow().

Referenced by main(), and MTKpp::BaseStats::standardDeviationRow().

double MTKpp::BaseStats::varianceRow ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get variance of row.

Parameters:
mMatrix pointer
irow index
Returns:
variance

References MTKpp::BaseStats::meanRow().

int MTKpp::BaseStats::getStdDevColumns ( Eigen::Matrix< double, Dynamic, Dynamic > &  mat,
Eigen::Matrix< double, Dynamic, Dynamic > &  stdDev_mat 
) [inherited]

Get standard deviation for each column.

Parameters:
matmatrix pointer
stdDev_matmatrix of standard deviations
Returns:
success

References MTKpp::BaseStats::varianceColumn().

Referenced by main().

int MTKpp::BaseStats::getStdDevColumns ( ublas::matrix< double > &  mat,
ublas::matrix< double > &  stdDev_mat 
) [inherited]

Get standard deviation for each column.

Parameters:
matmatrix pointer
stdDev_matmatrix of standard deviations
Returns:
success

References MTKpp::BaseStats::varianceColumn().

double MTKpp::BaseStats::standardDeviationColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get standard deviation of column.

Parameters:
mMatrix pointer
icolumn index
Returns:
standard deviation

References MTKpp::BaseStats::varianceColumn().

Referenced by main(), and MTKpp::BaseStats::zScoreColumns().

double MTKpp::BaseStats::standardDeviationColumn ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get standard deviation of column.

Parameters:
mMatrix pointer
icolumn index
Returns:
standard deviation

References MTKpp::BaseStats::varianceColumn().

double MTKpp::BaseStats::standardDeviationRow ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i 
) [inherited]

Get standard deviation of row.

Parameters:
mMatrix pointer
irow index
Returns:
standard deviation

References MTKpp::BaseStats::varianceRow().

Referenced by main().

double MTKpp::BaseStats::standardDeviationRow ( ublas::matrix< double > &  m,
const int &  i 
) [inherited]

Get standard deviation of row.

Parameters:
mMatrix pointer
irow index
Returns:
standard deviation

References MTKpp::BaseStats::varianceRow().

double MTKpp::BaseStats::covarianceColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m1,
const int &  i1,
Eigen::Matrix< double, Dynamic, Dynamic > &  m2,
const int &  i2 
) [inherited]

Calculate covariance between two column in different matrices.

Parameters:
m1Matrix pointer
i1column index
m2Matrix pointer
i2column index
Returns:
covariance

References MTKpp::BaseStats::meanColumn().

double MTKpp::BaseStats::covarianceColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m,
const int &  i,
const int &  j 
) [inherited]

Calculate covariance between two columns in the same matrix.

Parameters:
mMatrix pointer
icolumn index
jcolumn index
Returns:
covariance

References MTKpp::BaseStats::meanColumn().

double MTKpp::BaseStats::covarianceColumn ( ublas::matrix< double > &  m1,
const int &  i1,
ublas::matrix< double > &  m2,
const int &  i2 
) [inherited]

Calculate covariance between two column in different matrices.

Parameters:
m1Matrix pointer
i1column index
m2Matrix pointer
i2column index
Returns:
covariance

References MTKpp::BaseStats::meanColumn().

double MTKpp::BaseStats::covarianceColumn ( ublas::matrix< double > &  m,
const int &  i,
const int &  j 
) [inherited]

Calculate covariance between two columns in the same matrix.

Parameters:
mMatrix pointer
icolumn index
jcolumn index
Returns:
covariance

References MTKpp::BaseStats::meanColumn().

void MTKpp::BaseStats::covarianceMatrix ( Eigen::Matrix< double, Dynamic, Dynamic > &  A,
Eigen::Matrix< double, Dynamic, Dynamic > &  CovMat 
) [inherited]

Calculates the Covariance Matrix (or variance, variance-covariance, dispersion)

The covariance matrix is the matrix of sample variances [i][i] and covariances [i][j] of p variables.

Parameters:
AMatrix object
CovMatcovariance matrix

References MTKpp::BaseStats::meanColumn().

Referenced by main(), and MTKpp::pca::run().

void MTKpp::BaseStats::covarianceMatrix ( ublas::matrix< double > &  A,
ublas::matrix< double > &  CovMat 
) [inherited]

Calculates the Covariance Matrix (or variance, variance-covariance, dispersion)

The covariance matrix is the matrix of sample variances [i][i] and covariances [i][j] of p variables.

Parameters:
AMatrix object
CovMatcovariance matrix

References MTKpp::BaseStats::meanColumn().

void MTKpp::BaseStats::covarianceMatrix ( ublas::matrix< double > &  A,
ublas::matrix< double, ublas::column_major > &  CovMat 
) [inherited]
double MTKpp::BaseStats::correlationCoefficientColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m1,
const int &  i1,
Eigen::Matrix< double, Dynamic, Dynamic > &  m2,
const int &  i2 
) [inherited]

Calculate correlation coefficient by column.

Parameters:
m1Matrix object
i1column index
m2Matrix object
i2column index
Returns:
correlation coefficient

References MTKpp::BaseStats::meanColumn(), and MTKpp::BaseStats::SumSquaredDeviationsColumn().

Referenced by main(), and MTKpp::BaseStats::rSquaredColumn().

double MTKpp::BaseStats::correlationCoefficientColumn ( ublas::matrix< double > &  m1,
const int &  i1,
ublas::matrix< double > &  m2,
const int &  i2 
) [inherited]

Calculate correlation coefficient by column.

Parameters:
m1Matrix object
i1column index
m2Matrix object
i2column index
Returns:
correlation coefficient

References MTKpp::BaseStats::meanColumn(), and MTKpp::BaseStats::SumSquaredDeviationsColumn().

double MTKpp::BaseStats::rSquaredColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  m1,
const int &  i1,
Eigen::Matrix< double, Dynamic, Dynamic > &  m2,
const int &  i2 
) [inherited]

Calculate R^2 by column.

Parameters:
m1Matrix object
i1column index
m2Matrix object
i2column index
Returns:
R-Squared

References MTKpp::BaseStats::correlationCoefficientColumn().

Referenced by main().

double MTKpp::BaseStats::rSquaredColumn ( ublas::matrix< double > &  m1,
const int &  i1,
ublas::matrix< double > &  m2,
const int &  i2 
) [inherited]

Calculate R^2 by column.

Parameters:
m1Matrix object
i1column index
m2Matrix object
i2column index
Returns:
R-Squared

References MTKpp::BaseStats::correlationCoefficientColumn().

double MTKpp::BaseStats::AdjustedRSquaredColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  Ys,
const int &  i1,
Eigen::Matrix< double, Dynamic, Dynamic > &  Y_Pred,
const int &  i2,
const int &  i3 
) [inherited]

Calculate Adjusted R^2 by column.

Parameters:
YsMatrix object
i1column index
Y_PredMatrix object
i2column index
i3column index
Returns:
Adjusted R-Squared

References MTKpp::BaseStats::SumSquaredDeviationsColumn(), and MTKpp::BaseStats::SumSquaredResidualErrorsColumn().

Referenced by main().

double MTKpp::BaseStats::AdjustedRSquaredColumn ( ublas::matrix< double > &  Ys,
const int &  i1,
ublas::matrix< double > &  Y_Pred,
const int &  i2,
const int &  i3 
) [inherited]

Calculate Adjusted R^2 by column.

Parameters:
YsMatrix object
i1column index
Y_PredMatrix object
i2column index
i3column index
Returns:
Adjusted R-Squared

References MTKpp::BaseStats::SumSquaredDeviationsColumn(), and MTKpp::BaseStats::SumSquaredResidualErrorsColumn().

double MTKpp::BaseStats::RMSE ( Eigen::Matrix< double, Dynamic, Dynamic > &  Ys,
const int &  i,
Eigen::Matrix< double, Dynamic, Dynamic > &  Y_Pred,
const int &  j 
) [inherited]

Calculate root mean squared error.

Parameters:
YsMatrix object
icolumn index
Y_PredMatrix object
jcolumn index
Returns:
rmse

Referenced by main(), and MTKpp::BaseStats::RMSE().

double MTKpp::BaseStats::RMSE ( ublas::matrix< double > &  Ys,
const int &  i,
ublas::matrix< double > &  Y_Pred,
const int &  j 
) [inherited]

Calculate root mean squared error.

Parameters:
YsMatrix object
icolumn index
Y_PredMatrix object
jcolumn index
Returns:
rmse

References MTKpp::BaseStats::RMSE().

double MTKpp::BaseStats::MSE ( Eigen::Matrix< double, Dynamic, Dynamic > &  Ys,
const int &  i,
Eigen::Matrix< double, Dynamic, Dynamic > &  Y_Pred,
const int &  j 
) [inherited]

Calculate mean squared error.

Parameters:
YsMatrix object
icolumn index
Y_PredMatrix object
jcolumn index
Returns:
mse

Referenced by main(), and MTKpp::BaseStats::MSE().

double MTKpp::BaseStats::MSE ( ublas::matrix< double > &  Ys,
const int &  i,
ublas::matrix< double > &  Y_Pred,
const int &  j 
) [inherited]

Calculate mean squared error.

Parameters:
YsMatrix object
icolumn index
Y_PredMatrix object
jcolumn index
Returns:
mse

References MTKpp::BaseStats::MSE().

double MTKpp::BaseStats::UnsignedError ( Eigen::Matrix< double, Dynamic, Dynamic > &  Ys,
const int &  i,
Eigen::Matrix< double, Dynamic, Dynamic > &  Y_Pred,
const int &  j 
) [inherited]

Calculate unsigned/absolute error.

Parameters:
YsMatrix object
icolumn index
Y_PredMatrix object
jcolumn index
Returns:
unsigned error

Referenced by main().

double MTKpp::BaseStats::UnsignedError ( ublas::matrix< double > &  Ys,
const int &  i,
ublas::matrix< double > &  Y_Pred,
const int &  j 
) [inherited]

Calculate unsigned/absolute error.

Parameters:
YsMatrix object
icolumn index
Y_PredMatrix object
jcolumn index
Returns:
unsigned error
double MTKpp::BaseStats::SignedError ( Eigen::Matrix< double, Dynamic, Dynamic > &  Ys,
const int &  i,
Eigen::Matrix< double, Dynamic, Dynamic > &  Y_Pred,
const int &  j 
) [inherited]

Calculate signed error.

Parameters:
YsMatrix object
icolumn index
Y_PredMatrix object
jcolumn index
Returns:
signed error

Referenced by main().

double MTKpp::BaseStats::SignedError ( ublas::matrix< double > &  Ys,
const int &  i,
ublas::matrix< double > &  Y_Pred,
const int &  j 
) [inherited]

Calculate signed error.

Parameters:
YsMatrix object
icolumn index
Y_PredMatrix object
jcolumn index
Returns:
signed error
double MTKpp::BaseStats::SumSquaredDeviationsColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  Ys,
const int &  i 
) [inherited]

Calculates the Sum of squared deviations.

total sum of squared deviations in Y from its mean (SST) -- \ SST = / (y[i] - y_mean)^2 --

Parameters:
YsMatrix object
icolumn index
Returns:
Sum Squared Deviation

References MTKpp::BaseStats::meanColumn().

Referenced by MTKpp::BaseStats::AdjustedRSquaredColumn(), MTKpp::BaseStats::correlationCoefficientColumn(), MTKpp::ols::LeastSquaresRegressionLine(), and main().

double MTKpp::BaseStats::SumSquaredDeviationsColumn ( ublas::matrix< double > &  Ys,
const int &  i 
) [inherited]

Calculates the Sum of squared deviations.

total sum of squared deviations in Y from its mean (SST) -- \ SST = / (y[i] - y_mean)^2 --

Parameters:
YsMatrix object
icolumn index
Returns:
Sum Squared Deviation

References MTKpp::BaseStats::meanColumn().

double MTKpp::BaseStats::SumSquaredRegressionColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  Ys,
Eigen::Matrix< double, Dynamic, Dynamic > &  Y_Pred 
) [inherited]

Calculates the Sum of squared due to regression.

total sum of squares due to regression (SSR)

__ SSR = \ (y_pred[i] - y_obs_mean)^2 /__

Parameters:
YsMatrix object
Y_PredMatrix object
Returns:
Sum Squared Deviation

References MTKpp::BaseStats::meanColumn().

Referenced by main().

double MTKpp::BaseStats::SumSquaredRegressionColumn ( ublas::matrix< double > &  Ys,
ublas::matrix< double > &  Y_Pred 
) [inherited]

Calculates the Sum of squared due to regression.

total sum of squares due to regression (SSR)

__ SSR = \ (y_pred[i] - y_obs_mean)^2 /__

Parameters:
YsMatrix object
Y_PredMatrix object
Returns:
Sum Squared Deviation

References MTKpp::BaseStats::meanColumn().

double MTKpp::BaseStats::SumSquaredResidualErrorsColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  Ys,
Eigen::Matrix< double, Dynamic, Dynamic > &  Y_Pred,
Eigen::Matrix< double, Dynamic, Dynamic > &  Residuals 
) [inherited]

Calculates the Sum of squared residuals (Errors)

residuals --> e[i] = y_obs[i] - y_pred[i] sum of squared residuals (SSE) -- \ SSE = / e[i]^2 --

Parameters:
Ys
Y_Pred
Residuals

Referenced by MTKpp::BaseStats::AdjustedRSquaredColumn(), and main().

double MTKpp::BaseStats::SumSquaredResidualErrorsColumn ( Eigen::Matrix< double, Dynamic, Dynamic > &  Ys,
const int &  c,
Eigen::Matrix< double, Dynamic, Dynamic > &  Y_Pred,
const int &  d 
) [inherited]

Calculates the Sum of squared residuals (Errors)

residuals --> e[i] = y_obs[i] - y_pred[i] sum of squared residuals (SSE) -- \ SSE = / e[i]^2 --

Parameters:
YsOrginial Y matrix
ccolumn in Ys
Y_PredPredicted Y matrix
dcolumn in Y_Pred
double MTKpp::BaseStats::SumSquaredResidualErrorsColumn ( ublas::matrix< double > &  Ys,
ublas::matrix< double > &  Y_Pred,
ublas::matrix< double > &  Residuals 
) [inherited]

Calculates the Sum of squared residuals (Errors)

residuals --> e[i] = y_obs[i] - y_pred[i] sum of squared residuals (SSE) -- \ SSE = / e[i]^2 --

Parameters:
Ys
Y_Pred
Residuals
double MTKpp::BaseStats::SumSquaredResidualErrorsColumn ( ublas::matrix< double > &  Ys,
const int &  c,
ublas::matrix< double > &  Y_Pred,
const int &  d 
) [inherited]

Calculates the Sum of squared residuals (Errors)

residuals --> e[i] = y_obs[i] - y_pred[i] sum of squared residuals (SSE) -- \ SSE = / e[i]^2 --

Parameters:
YsOrginial Y matrix
ccolumn in Ys
Y_PredPredicted Y matrix
dcolumn in Y_Pred

Member Data Documentation

table<double>* MTKpp::pls::itsX [protected]

X matrix.

              X[N][R]
         +-                    -+
         | X11 X12  .   .   X1R |
         | X21 X22  .   .   X2R |
         |  .   .   .   .    .  |
         |  .   .   .   .    .  |
         | XN1  .   .   .   XNR |
         +-                    -+

Referenced by pls(), runCV(), and setX().

table<double>* MTKpp::pls::itsY [protected]

Y matrix.

              Y[N][M]
        +-                  -+
        | Y11 Y21  .  .  Y1M |
        | Y21 Y22  .  .  Y2M |
        |  .    .  .  .   .  |
        |  .    .  .  .   .  |
        | YN1 Y2N  .  .  YNM |
        +-                  -+

Referenced by pls(), runCV(), and setY().

unsigned int MTKpp::pls::YRows [protected]

Number of rows in Y and X.

Referenced by pls(), and runCV().

unsigned int MTKpp::pls::XColumns [protected]

Number of Columns in X.

Referenced by pls().

std::string MTKpp::pls::itsMethod [protected]

PLS Algorithm.

  • KERNELPLS
  • SIMPLS
  • NIPLS

Referenced by pls(), run(), and setMethod().

unsigned int MTKpp::pls::maxIter [protected]

Maximum number of iterations for iterative methods.

Referenced by pls(), and setMaxIter().

double MTKpp::pls::epsilon [protected]

Convergence criteria for iterative methods.

Referenced by pls(), and setEpsilon().

std::string MTKpp::pls::CV [protected]

Cross validation parameters.

  • NONE : No CV
  • LOO : Leave One Out cross validation
  • LNO : Leave N Out cross validation, set nTEST parameter
  • RANDOM : Leave nTest out nITER times using SEED

Referenced by pls(), run(), runCV(), and setCV().

unsigned int MTKpp::pls::nEXT [protected]

Number of prediction set in CV nEXT = N/nTest.

Referenced by runCV().

unsigned int MTKpp::pls::nITER [protected]

Number of samples to consider in RANDOM CV.

Referenced by pls(), runCV(), and setNITER().

unsigned int MTKpp::pls::nTEST [protected]

Size of test set in RANDOM and LNO CV.

if N = 100

  • LOO: nTest = 1
  • LNO: nTest = 10 ==> nExt = 10
  • RANDOM: nTest = 10 ==> nExt = 10

Referenced by pls(), runCV(), and setNTEST().

int MTKpp::pls::SEED [protected]

Random number generator seed in RANDOM CV.

Referenced by pls(), and setSEED().

unsigned int MTKpp::pls::nLV [protected]

Number of Latent Variables to be considered.

Referenced by pls(), and setNLV().

The sheet where the model is stored.

Referenced by pls(), run(), runCV(), and setOutModel().


The documentation for this class was generated from the following files:

Generated on Fri Dec 23 2011 09:28:58 for MTK++ by Doxygen 1.7.5.1