pca
pca copied to clipboard
RangeError: Submatrix indices are out of range
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]
@josiahbryan did you ever find a solution for this? 🙏
No, sorry, I moved on to a different method of doing this all together, I decided that vector space projection wasn't all that relevant to what I was trying to do so I didn't work out a work around, sorry!
On Thu, Jan 11, 2024, 4:28 PM ahallora @.***> wrote:
@josiahbryan https://github.com/josiahbryan did you ever find a solution for this? 🙏
— Reply to this email directly, view it on GitHub https://github.com/mljs/pca/issues/38#issuecomment-1888069802, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEZELEQXTAZX2A3KZ55HITYOBRRNAVCNFSM6AAAAAAZ47AQE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBYGA3DSOBQGI . You are receiving this because you were mentioned.Message ID: @.***>
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.
I'm confused - are you saying OpenAI's embeddings provides some sort of dimensional reduction built-in?
On Fri, Jan 12, 2024 at 4:59 AM ahallora @.***> wrote:
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.
— Reply to this email directly, view it on GitHub https://github.com/mljs/pca/issues/38#issuecomment-1888882666, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABEZELEBLVFDUZJMJ2ZHF4TYOEJPLAVCNFSM6AAAAAAZ47AQE6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBYHA4DENRWGY . You are receiving this because you were mentioned.Message ID: @.***>
-- Josiah Bryan +1-765-215-0511 (Phone/SMS/WhatsApp) www.josiahbryan.com https://www.josiahbryan.com/?utm_source=sig @.***