From ce66f4d8296d05ce352908295c31ab8e7e24e5eb Mon Sep 17 00:00:00 2001 From: Matt Dancho Date: Mon, 30 Oct 2023 23:57:02 -0400 Subject: [PATCH] fix bug with observed_clean calculation. --- R/anomalize.R | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/R/anomalize.R b/R/anomalize.R index 469dc06b..67d5bbf1 100644 --- a/R/anomalize.R +++ b/R/anomalize.R @@ -191,8 +191,8 @@ anomalize.data.frame <- function( ret <- ret %>% dplyr::mutate( observed_clean = dplyr::case_when( - anomaly_direction == -1 ~ recomposed_l1 + (1-.clean_alpha)*anomaly_score, - anomaly_direction == 1 ~ recomposed_l2 - (1-.clean_alpha)*anomaly_score, + anomaly_direction == -1 ~ recomposed_l1 + (1-.clean_alpha)*(recomposed_l2-recomposed_l1)/2, + anomaly_direction == 1 ~ recomposed_l2 - (1-.clean_alpha)*(recomposed_l2-recomposed_l1)/2, TRUE ~ observed ) )