Creates new OPLS (orthogonal partial latent structures) from features and labels.

new OPLS(data: Array, labels: Array, options: Object)
Parameters
data (Array) matrix containing data (X).
labels (Array) 1D Array containing metadata (Y).
options (Object = {})
Name Description
options.center boolean (default true) should the data be centered (subtract the mean).
options.scale boolean (default true) should the data be scaled (divide by the standard deviation).
options.cvFolds Array (default []) Allows to provide folds as array of objects with the arrays trainIndex and testIndex as properties.
options.nbFolds number (default 7) Allows to generate the defined number of folds with the training and test set choosen randomly from the data set.
Static Members
load(model)
Instance Members
_getTrainTest(X, group, index)
getLogs()
predict(features, options)
predictCategory(features, options)
toJSON()
new PLS()
Static Members
load(model)
Instance Members
getExplainedVariance()
predict(dataset)
toJSON()
train(trainingSet, trainingValues)
new KOPLS()
Static Members
load(model, kernel)
Instance Members
predict(toPredict)
toJSON()
train(trainingSet, trainingValues)

OPLS loop

oplsNipals(data: (Array | Matrix), labels: (Array | Matrix), options: Object): Object
Parameters
data ((Array | Matrix)) matrix with features
labels ((Array | Matrix)) an array of labels (dependent variable)
options (Object = {}) an object with options
Returns
Object: an object with model (filteredX: err, loadingsXOrtho: pOrtho, scoresXOrtho: tOrtho, weightsXOrtho: wOrtho, weightsPred: w, loadingsXpred: p, scoresXpred: t, loadingsY:)

Get total sum of square

tss(x: Array): Number
Parameters
x (Array) an array
Returns
Number: the sum of the squares