Skip to content

RangeError: Submatrix indices are out of range #38

Description

@josiahbryan

Usage:

const pca = new PCA([vector]);
const result = pca.predict([vector], { nComponents: 2 });

...where vector is an array with 1,536 elements a la an Open AI embedding. E.g. const vector = [0.00728, -0.0181, 0.014, ....]

The goal is to reduce/project the 1,536-element vector into 2d space for graphing related vectors.

However, when I call pca.predict, it throws this error:

(PID 60093) 2023-07-03T22:51:51.304Z  [ERROR] script-cli.js:127: RangeError: Submatrix indices are out of range
    at checkRange (/Users/josiahbryan/devel/rubber/backend/node_modules/ml-matrix/matrix.js:1038:11)
    at Matrix.subMatrix (/Users/josiahbryan/devel/rubber/backend/node_modules/ml-matrix/matrix.js:2455:5)
    at PCA.predict (/Users/josiahbryan/devel/rubber/backend/node_modules/ml-pca/lib/pca.js:123:28)
    [snipped]

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions