ml-pls
    Preparing search index...

    Class OPLS

    OPLS (orthogonal projections to latent structures).

    Index

    Constructors

    • Creates a new OPLS model from features and labels.

      Parameters

      • data: any[]

        matrix containing data (X).

      • labels: any[]

        1D Array containing metadata (Y). Numeric labels trigger regression, string labels trigger discriminant analysis.

      • Optionaloptions: {
            center?: boolean;
            cvFolds?: any[];
            maxComponents?: number;
            nbFolds?: number;
            scale?: boolean;
        } = {}

        constructor options.

        • Optionalcenter?: boolean

          should the data be centered (subtract the mean).

        • OptionalcvFolds?: any[]

          Allows to provide folds as array of objects with the arrays trainIndex and testIndex as properties.

        • OptionalmaxComponents?: number

          upper bound on the number of orthogonal components. The fit normally stops earlier (when adding a component no longer improves the cross-validated metric by at least 0.05); this is a hard cap that guarantees termination even when the metric never plateaus.

        • OptionalnbFolds?: number

          Allows to generate the defined number of folds with the training and test set chosen randomly from the data set.

        • Optionalscale?: boolean

          should the data be scaled (divide by the standard deviation).

      Returns OPLS

    Properties

    center: boolean | undefined
    labels: any
    means: any
    meansY: any
    mode: any
    model: any
    orthogonalScoresCV: any
    output: any
    predictiveScoresCV: any
    scale: boolean | undefined
    stdevs: any
    stdevsY: any
    tssx: number | undefined
    tssy: number | undefined
    yHatScoresCV: any

    Methods

    • get access to all the computed elements Mainly for debug and testing

      Returns object

      output object

    • Returns the cross-validated predictive and orthogonal scores.

      Returns { scoresX: number[][]; scoresY: number[][] }

      the predictive (scoresX) and orthogonal (scoresY) cross-validated scores.

    • Predict scores for new data

      Parameters

      • features: Matrix

        a matrix containing new data

      • Optionaloptions: { center?: boolean; scale?: boolean; trueLabels?: any[] } = {}

        prediction options.

        • Optionalcenter?: boolean

          should the data be centered before prediction.

        • Optionalscale?: boolean

          should the data be scaled before prediction.

        • OptionaltrueLabels?: any[]

          an array with true values to compute confusion matrix.

      Returns object

      • predictions
    • Predicts the class of each row of new data (discriminant analysis mode).

      Parameters

      • features: Matrix

        a matrix containing new data.

      • Optionaloptions: { center?: boolean; scale?: boolean; trueLabels?: any[] } = {}

        prediction options.

        • Optionalcenter?: boolean

          should the data be centered before prediction.

        • Optionalscale?: boolean

          should the data be scaled before prediction.

        • OptionaltrueLabels?: any[]

          an array with true values to compute confusion matrix.

      Returns any[]

      the predicted class name for each row of features.

    • Export the current model to a JSON object

      Returns object

      model

    • Load an OPLS model from JSON

      Parameters

      • model: object

        the serialized model to load.

      Returns OPLS

      the loaded OPLS model.