Package Exports
- ml-pls
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ml-pls) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
Partial Least Squares (PLS)
PLS regression algorithm based on the Yi Cao Matlab implementation:
Partial Least-Squares and Discriminant Analysis
installation
$ npm install ml-pls
Methods
new PLS()
Constructor that takes no arguments.
Example
var pls = new PLS();
fit(trainingSet, predictions)
Fit the PLS model to the given training set and predictions
Arguments
trainingSet
- A matrix of the training set.predictions
- A matrix of predictions with the same size of rows of the trainingSet.
Example
var training = [[0.1, 0.02], [0.25, 1.01] ,[0.95, 0.01], [1.01, 0.96]];
var predicted = [[1, 0], [1, 0], [1, 0], [0, 1]];
pls.fit(trainingSet, predictions);
predict(dataset)
Predict the values of the dataset.
Arguments
dataset
- A matrix that contains the dataset.
Example
var dataset = [[0, 0], [0, 1], [1, 0], [1, 1]];
var ans = pls.predict(dataset);
getExplainedVariance()
Returns the explained variance on training
export()
Exports the actual PLS to an Javascript Object.
load(model)
Returns a new PLS with the given model.
Arguments
model
- Javascript Object generated from export() function.