Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Submatrix indices are out of range #38

Open
josiahbryan opened this issue Jul 3, 2023 · 4 comments
Open

RangeError: Submatrix indices are out of range #38

josiahbryan opened this issue Jul 3, 2023 · 4 comments

Comments

@josiahbryan
Copy link

josiahbryan commented Jul 3, 2023

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]
@ahallora
Copy link

@josiahbryan did you ever find a solution for this? 🙏

@josiahbryan
Copy link
Author

josiahbryan commented Jan 12, 2024 via email

@ahallora
Copy link

Alright, thank you, Joshiah.
For transparency, I ended up just using the OpenAI's embeddings instead. https://platform.openai.com/docs/guides/embeddings
Maybe I'll revisit this later.

@josiahbryan
Copy link
Author

josiahbryan commented Jan 12, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants