sync: TSIR change

This commit is contained in:
Daniel Kapla 2025-05-05 14:35:24 +02:00
parent c4a93d25fa
commit 491688378c
1 changed files with 2 additions and 2 deletions

View File

@ -45,7 +45,7 @@ TSIR <- function(X, y,
y <- as.integer(y) y <- as.integer(y)
# center `X` # center `X`
X <- X - c(rowMeans(X, dim = length(modes))) X <- X - as.vector(rowMeans(X, dim = length(modes)))
# Slice `X` into slices governed by `y` # Slice `X` into slices governed by `y`
slices <- Map(function(s) { slices <- Map(function(s) {
@ -119,7 +119,7 @@ TSIR <- function(X, y,
} }
# mode sample covariance matrices # mode sample covariance matrices
Omegas <- Map(function(k) n^-1 * mcrossprod(X, mode = k), modes) Omegas <- Map(function(k) prod(dim(X)[-k])^-1 * mcrossprod(X, mode = k), modes)
# Check condition of sample covariances and perform regularization if needed # Check condition of sample covariances and perform regularization if needed
if (is.finite(cond.threshold)) { if (is.finite(cond.threshold)) {