I just recently found this javascript library. So far it's looking pretty good. I've always wanted some sort of Javascript equivalent to NumPy and while this isn't anywhere near that extreme, it does offer some pretty handy features.
Here's a jsFiddle I put together to show it performing a simple implementation of PCA (Principle Component Analysis) on a fictional dataset. The first component should have a slope of approximately 0.357
Here's a quick snippet, the actual PCA function using numericjs...
function pca(X) {
/*
Return matrix of all principle components as column vectors
*/
var m = X.length;
var sigma = numeric.div(numeric.dot(numeric.transpose(X), X), m);
return numeric.svd(sigma).U;
}
Here's a jsFiddle I put together to show it performing a simple implementation of PCA (Principle Component Analysis) on a fictional dataset. The first component should have a slope of approximately 0.357
Here's a quick snippet, the actual PCA function using numericjs...
function pca(X) {
/*
Return matrix of all principle components as column vectors
*/
var m = X.length;
var sigma = numeric.div(numeric.dot(numeric.transpose(X), X), m);
return numeric.svd(sigma).U;
}