Skip to content

Commit

Permalink
Merge pull request #107 from tlverse/fix_quantiles
Browse files Browse the repository at this point in the history
Update make_basis.R
  • Loading branch information
rachaelvp authored Oct 12, 2023
2 parents e8ce819 + 6aba854 commit 48f41e5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions R/make_basis.R
Original file line number Diff line number Diff line change
Expand Up @@ -327,8 +327,9 @@ quantizer <- function(X, bins) {

p <- max(1 - (20 / nrow(X)), 0.98)
quants <- seq(0, p, length.out = bins)
q <- stats::quantile(x, quants)
nearest <- findInterval(x, q)
q <- unique(stats::quantile(x, quants, type = 1))
# NOTE: all.inside must be FALSE or else all binary variables are mapped to zero.
nearest <- findInterval(x, q, all.inside = FALSE)
x <- q[nearest]
return(x)
}
Expand Down

0 comments on commit 48f41e5

Please sign in to comment.