Skip to content

Commit

Permalink
fix #161: avoid Inf nclusters_pred when both NULL
Browse files Browse the repository at this point in the history
  • Loading branch information
AlejandroCatalina committed Jun 27, 2021
1 parent 76d22a1 commit 38d7621
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions R/cv_varsel.R
Original file line number Diff line number Diff line change
Expand Up @@ -549,10 +549,12 @@ kfold_varsel <- function(refmodel, method, nterms_max, ndraws,
## List of K elements, each containing d_train, p_pred, etc. corresponding
## to each fold.
make_list_cv <- function(refmodel, d_test, msg) {
nclusters_pred <- min(
refmodel$nclusters_pred,
nclusters_pred
)
if (!is.null(nclusters_pred) || !is.null(refmodel$nclusters_pred)) {
nclusters_pred <- min(
refmodel$nclusters_pred,
nclusters_pred
)
}
p_sel <- .get_refdist(refmodel, ndraws, nclusters, seed = seed)
p_pred <- .get_refdist(refmodel, ndraws_pred, nclusters_pred, seed = seed)
newdata <- d_test$newdata
Expand Down

0 comments on commit 38d7621

Please sign in to comment.