@qe-libs/rena-wasm 0.1.10 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/index.js +13 -2
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -466,8 +466,19 @@ function runPipeline(qe, rawNetworks, nUnits, nConnections, codes, unitLabels,
|
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
468
|
|
|
469
|
-
// Variance explained (= R's model$variance)
|
|
470
|
-
|
|
469
|
+
// Variance explained (= R's model$variance): each dim's share of the
|
|
470
|
+
// variance over the FULL rotation, as ena.make.set computes it before
|
|
471
|
+
// keeping `dimensions` columns -- not of only the dims returned here, which
|
|
472
|
+
// would always sum to 1 (58%/42% instead of R's 32%/23% on RS.data).
|
|
473
|
+
// Projected rather than taken from pointsForProjection so it holds for a
|
|
474
|
+
// rotation that is not orthonormal.
|
|
475
|
+
let total = null;
|
|
476
|
+
if (dims < rot.rotCols) {
|
|
477
|
+
const full = project(pointsForProjection, nUnits, nConnections,
|
|
478
|
+
rot.rotation, rot.rotRows, rot.rotCols, rot.rotCols);
|
|
479
|
+
total = totalVariance(full, nUnits, rot.rotCols);
|
|
480
|
+
}
|
|
481
|
+
const variance = computeVariance(points, nUnits, dims, total);
|
|
471
482
|
|
|
472
483
|
// Adjacency key (= R's rotation$adjacency.key)
|
|
473
484
|
const adjacencyKey = buildAdjacencyKey(codes, ordered);
|