mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 12:57:08 +00:00
Fix non-existent method
This commit is contained in:
@@ -15,9 +15,12 @@ function computePCA(deviations) {
|
|||||||
// Compute mean for centering (1 x 2 matrix)
|
// Compute mean for centering (1 x 2 matrix)
|
||||||
const mean = math.mean(D, 0);
|
const mean = math.mean(D, 0);
|
||||||
|
|
||||||
// Explicitly repeat mean to match D's shape (n x 2)
|
// Manually repeat-mean to match D's shape (n x 2)
|
||||||
const n = deviationMatrix.length;
|
const n = deviationMatrix.length;
|
||||||
const meanRepeated = math.repmat(mean, n, 1);
|
const meanArr = mean.toArray();
|
||||||
|
const meanRepeated = math.matrix(
|
||||||
|
Array(n).fill().map(() => [meanArr[0], meanArr[1]])
|
||||||
|
);
|
||||||
|
|
||||||
// Center the data
|
// Center the data
|
||||||
const centered = math.subtract(D, meanRepeated);
|
const centered = math.subtract(D, meanRepeated);
|
||||||
|
|||||||
Reference in New Issue
Block a user