From 491688378c94a2472842548abb5eba30ee7b200f Mon Sep 17 00:00:00 2001 From: daniel Date: Mon, 5 May 2025 14:35:24 +0200 Subject: [PATCH] sync: TSIR change --- tensorPredictors/R/TSIR.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tensorPredictors/R/TSIR.R b/tensorPredictors/R/TSIR.R index 1c364d1..4ee49a8 100644 --- a/tensorPredictors/R/TSIR.R +++ b/tensorPredictors/R/TSIR.R @@ -45,7 +45,7 @@ TSIR <- function(X, y, y <- as.integer(y) # 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` slices <- Map(function(s) { @@ -119,7 +119,7 @@ TSIR <- function(X, y, } # 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 if (is.finite(cond.threshold)) {