Skip to content

Commit

Permalink
Update softImputeCV.R
Browse files Browse the repository at this point in the history
  • Loading branch information
statwangz committed Dec 17, 2023
1 parent 5b9a805 commit 0926f58
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion others/softImputeCV.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,11 @@ softImputeCrossVal <- function(Y, rank_max = NULL, lambda_range = NULL,
if (is.null(lambda_range)) {
hi_fit <- softImpute(Y, rank.max = rank_max)
lambda_min <- tail(hi_fit$d, 1) / 100
lambda_max <- mean((hi_fit$d)[1:2])
if(length(hi_fit$d) > 1) {
lambda_max <- mean((hi_fit$d)[1:2])
} else {
lambda_max <- hi_fit$d
}
} else {
lambda_min <- lambda_range[1]
lambda_max <- lambda_range[2]
Expand Down

0 comments on commit 0926f58

Please sign in to comment.