37 mat Y = repmat(wavelength, 1, components);
38 mat X_loadings, Y_loadings, X_scores, Y_scores, coefficients, percent_variance, fitted;
40 X_loadings, Y_loadings,
42 coefficients, percent_variance,
48 AddMetadata(
"Components calculated", QString::number(components));
49 AddMatrix(
"Percent Variance", percent_variance);
50 AddMatrix(
"Predictor Loadings", X_loadings);
51 AddMatrix(
"Response Loadings", Y_loadings);
67 mat X_loadings, Y_loadings, X_scores, Y_scores, coefficients, percent_variance, fitted;
69 X_loadings, Y_loadings,
71 coefficients, percent_variance,
74 inplace_trans(coefficients);
78 AddMetadata(
"Components calculated", QString::number(controls.n_cols));
79 AddMatrix(
"Percent Variance", percent_variance);
80 AddMatrix(
"Predictor Loadings", X_loadings);
81 AddMatrix(
"Response Loadings", Y_loadings);
102 if (labels.n_rows != data.n_cols)
return false;
103 mat X_loadings, Y_loadings, X_scores, Y_scores, coefficients, percent_variance, fitted;
105 X_loadings, Y_loadings,
107 coefficients, percent_variance,
109 mat residuals = fitted - labels;
113 AddMetadata(
"Components calculated", QString::number(labels.n_cols));
114 AddMatrix(
"Percent Variance", percent_variance);
115 AddMatrix(
"Predictor Loadings", X_loadings);
116 AddMatrix(
"Response Loadings", Y_loadings);
void AddMetadata(QString key, QString value)
bool Discriminate(const mat &data, const mat &labels)
PLSData::Discriminate.
VESPUCCI_EXPORT bool plsregress(arma::mat X, arma::mat Y, int components, arma::mat &X_loadings, arma::mat &Y_loadings, arma::mat &X_scores, arma::mat &Y_scores, arma::mat &coefficients, arma::mat &percent_variance, arma::mat &fitted)
Vespucci::MathDimensionReduction::plsregress PLS Regression Using SIMPLS algorithm. This is essentially a line-for-line rewrite of plsregress from the Octave statistics package. Copyright (C) 2012 Fernando Damian Nieuwveldt fdnieuwveldt@gmail.com This is an implementation of the SIMPLS algorithm: Reference: SIMPLS: An alternative approach to partial least squares regression. Chemometrics and Intelligent Laboratory Systems (1993)
void AddMatrix(const QString &key, const mat &value, QStringList column_headings=QStringList())
bool Classify(const mat &spectra, const vec &wavelength, int components)
PLSData::Apply.
The AnalysisResults class A container for a mat object that allows a mat to be copied to a heap-alloc...
bool Calibrate(const mat &spectra, const mat &controls)