From c1a886987180c828a313c350b9eb0f9043aa0afd Mon Sep 17 00:00:00 2001 From: Louis Date: Tue, 21 Apr 2026 18:29:29 +0200 Subject: [PATCH] Using softmax invariance by translation to prevent overflow --- R/isomLR.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/isomLR.R b/R/isomLR.R index 0375c66..f57c74d 100644 --- a/R/isomLR.R +++ b/R/isomLR.R @@ -125,8 +125,8 @@ pivotCoordInv <- function(x, norm = "orthonormal"){ for (i in 2:(ncol(y)-1)){ y[,i]=y[,i] - x[,i] * if(norm =="orthonormal") sqrt((D-i)/(D-i+1)) else 1 } - yexp=exp(y) - x.back=yexp/apply(yexp,1,sum) # * rowSums(derOriginaldaten) + yexp=exp(y - apply(y, 1, max)) + x.back = yexp / apply(yexp, 1, sum) # * rowSums(derOriginaldaten) if(is.data.frame(x)) x.back <- data.frame(x.back) return(x.back) #return(yexp)