boost-R / mboost

Boosting algorithms for fitting generalized linear, additive and interaction models to potentially high-dimensional data. The current relase version can be found on CRAN (http://cran.r-project.org/package=mboost).
74 stars 27 forks source link

Warning: "In min(diff(sort(ux))) : no non-missing arguments to min; returning Inf" #100

Closed kenahoo closed 5 years ago

kenahoo commented 5 years ago

Using the following example (highly whittled down from data in my actual application), I get a warning about a failed call to min inside the training:

> data.frame(target = c(46, 42, 42, 39, 42, 42, 39, 36, 42, 
                        39, 36, 45, 39, 36, 45, 43, 36, 45, 43, 39, 45, 43, 39, 36, 43, 
                        39, 36, 34, 39, 36, 34, 31, 36, 34, 31, 31, 34, 31, 31, 38, 31, 
                        31, 38, 35, 31, 38, 35, 34, 38, 30, 31, 31, 30, 31, 35, 30, 31, 
                        35, 34, 31, 35, 34, 34, 35, 34, 34, 32, 34, 34, 32, 34, 34, 32, 
                        34, 30, 32, 34, 30, 27, 34, 30, 27, 33, 30, 27, 33, 31, 27, 33, 
                        31, 30, 33, 31, 30, 31, 31, 30, 31, 33, 30, 31, 33, 31, 31, 33, 
                        31, 31, 33, 31, 31, 28, 31, 31, 28, 26, 31, 28, 26, 24, 28, 26, 
                        24, 25, 26, 24, 25, 25, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 
                        25, 26, 25, 25, 26, 28, 25, 26, 28, 25, 26, 28, 25, 25, 28, 25, 
                        25, 24, 25, 25, 24, 29, 25, 24, 29, 26, 24, 29, 26, 26, 29, 26, 
                        26, 25, 26, 26, 25, 26, 26, 25, 26, 24, 25, 26, 24, 25, 26, 24, 
                        25, 25, 24, 25, 25, 25, 25, 25, 25, 24),
             X = c(0, 1, 1, 
                   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 
                   0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 
                   1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 
                   1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 
                   0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 
                   1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
                   1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 
                   1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 
                   0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 
                   1, 0, 0))

> mboost::mboost(target ~ ., d, baselearner=mboost::btree)

     Model-based Boosting

Call:
mboost::mboost(formula = target ~ ., data = d, baselearner = mboost::btree)

     Squared Error (Regression) 

Loss function: (y - f)^2 

Number of boosting iterations: mstop = 100 
Step size:  0.1 
Offset:  30.6359 
Number of baselearners:  1 

Warning message:
In min(diff(sort(ux))) : no non-missing arguments to min; returning Inf

Do you know what's causing that? Anything to worry about?

Looks like it's happening in mboost_fit, on this line:

bl <- lapply(blg, dpp, weights = weights)
fabian-s commented 5 years ago

Another inum-related issue, which is caused by having a covariate with only two unique values.

@kenahoo : Seems safe to ignore, the baselearner representation is still done correctly.

closing this here now.

@thothorn : these two lines in inum.data.frame trigger this, since ux has length 1 in the second line:

 ux <- ux[ux < xmax] 
 tol <- min(diff(sort(ux)))
d <- data.frame(target = c(46, 42, 42, 39, 42, 42, 39, 36, 42, 
                      39, 36, 45, 39, 36, 45, 43, 36, 45, 43, 39, 45, 43, 39, 36, 43, 
                      39, 36, 34, 39, 36, 34, 31, 36, 34, 31, 31, 34, 31, 31, 38, 31, 
                      31, 38, 35, 31, 38, 35, 34, 38, 30, 31, 31, 30, 31, 35, 30, 31, 
                      35, 34, 31, 35, 34, 34, 35, 34, 34, 32, 34, 34, 32, 34, 34, 32, 
                      34, 30, 32, 34, 30, 27, 34, 30, 27, 33, 30, 27, 33, 31, 27, 33, 
                      31, 30, 33, 31, 30, 31, 31, 30, 31, 33, 30, 31, 33, 31, 31, 33, 
                      31, 31, 33, 31, 31, 28, 31, 31, 28, 26, 31, 28, 26, 24, 28, 26, 
                      24, 25, 26, 24, 25, 25, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 
                      25, 26, 25, 25, 26, 28, 25, 26, 28, 25, 26, 28, 25, 25, 28, 25, 
                      25, 24, 25, 25, 24, 29, 25, 24, 29, 26, 24, 29, 26, 26, 29, 26, 
                      26, 25, 26, 26, 25, 26, 26, 25, 26, 24, 25, 26, 24, 25, 26, 24, 
                      25, 25, 24, 25, 25, 25, 25, 25, 25, 24),
           X = c(0, 1, 1, 
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 
                 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 
                 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 
                 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 
                 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 
                 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
                 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 
                 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 
                 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 
                 1, 0, 0))
options(warn = 2)
mboost::mboost(target ~ ., d, baselearner=mboost::btree)
#> Error in min(diff(sort(ux))): (converted from warning) no non-missing arguments to min; returning Inf
traceback()
[....]
10: .signalSimpleWarning("no non-missing arguments to min; returning Inf", 
        quote(min(diff(sort(ux)))))
9: inum.data.frame(mf, ignore = names(mf)[zerozvars], total = FALSE, 
       nmax = nmax["z"], meanlevels = FALSE)
8: inum::inum(mf, ignore = names(mf)[zerozvars], total = FALSE, 
       nmax = nmax["z"], meanlevels = FALSE)
7: extree_data(fm, data = df, yx = "none", nmax = c(yx = Inf, z = nmax))
6: object$dpp(weights)
5: dpp.blg(X[[i]], ...)
4: FUN(X[[i]], ...)
3: lapply(blg, dpp, weights = weights)
2: mboost_fit(bl, response = response, weights = weights, offset = offset, 
       family = family, control = control, oobweights = oobweights, 
       ...)
1: mboost::mboost(target ~ ., d, baselearner = mboost::btree)

Created on 2019-04-23 by the reprex package (v0.2.1)

Session info ``` r devtools::session_info() #> ─ Session info ────────────────────────────────────────────────────────── #> setting value #> version R version 3.5.3 (2019-03-11) #> os Linux Mint 19.1 #> system x86_64, linux-gnu #> ui X11 #> language en_GB #> collate en_GB.UTF-8 #> ctype en_GB.UTF-8 #> tz Europe/Berlin #> date 2019-04-23 #> #> ─ Packages ────────────────────────────────────────────────────────────── #> package * version date lib source #> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.5.3) #> backports 1.1.4 2019-04-10 [1] CRAN (R 3.5.3) #> callr 3.2.0 2019-03-15 [1] CRAN (R 3.5.3) #> cli 1.1.0 2019-03-19 [1] CRAN (R 3.5.3) #> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.3) #> desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.3) #> devtools 2.0.2 2019-04-08 [1] CRAN (R 3.5.3) #> digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.3) #> evaluate 0.13 2019-02-12 [1] CRAN (R 3.5.3) #> Formula 1.2-3 2018-05-03 [1] CRAN (R 3.5.3) #> fs 1.2.7 2019-03-19 [1] CRAN (R 3.5.3) #> glue 1.3.1 2019-03-12 [1] CRAN (R 3.5.3) #> highr 0.8 2019-03-20 [1] CRAN (R 3.5.3) #> htmltools 0.3.6 2017-04-28 [1] CRAN (R 3.5.3) #> inum 1.0-0 2017-12-12 [1] CRAN (R 3.5.3) #> knitr 1.22 2019-03-08 [1] CRAN (R 3.5.3) #> lattice 0.20-38 2018-11-04 [4] CRAN (R 3.5.1) #> libcoin 1.0-4 2019-02-28 [1] CRAN (R 3.5.3) #> magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.3) #> Matrix 1.2-17 2019-03-22 [4] CRAN (R 3.5.3) #> mboost 2.9-1 2018-08-22 [1] CRAN (R 3.5.3) #> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.3) #> mvtnorm 1.0-10 2019-03-05 [1] CRAN (R 3.5.3) #> nnls 1.4 2012-03-19 [1] CRAN (R 3.5.3) #> partykit 1.2-3 2019-01-31 [1] CRAN (R 3.5.3) #> pkgbuild 1.0.3 2019-03-20 [1] CRAN (R 3.5.3) #> pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.3) #> prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.3) #> processx 3.3.0 2019-03-10 [1] CRAN (R 3.5.3) #> ps 1.3.0 2018-12-21 [1] CRAN (R 3.5.3) #> quadprog 1.5-5 2013-04-17 [1] CRAN (R 3.5.3) #> R6 2.4.0 2019-02-14 [1] CRAN (R 3.5.3) #> Rcpp 1.0.1 2019-03-17 [1] CRAN (R 3.5.3) #> remotes 2.0.4 2019-04-10 [1] CRAN (R 3.5.3) #> rlang 0.3.4 2019-04-07 [1] CRAN (R 3.5.3) #> rmarkdown 1.12 2019-03-14 [1] CRAN (R 3.5.3) #> rpart 4.1-13 2018-02-23 [1] CRAN (R 3.5.3) #> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.3) #> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.3) #> stabs 0.6-3 2017-07-19 [1] CRAN (R 3.5.3) #> stringi 1.4.3 2019-03-12 [1] CRAN (R 3.5.3) #> stringr 1.4.0 2019-02-10 [1] CRAN (R 3.5.3) #> survival 2.44-1.1 2019-04-01 [1] CRAN (R 3.5.3) #> testthat 2.0.1 2018-10-13 [1] CRAN (R 3.5.3) #> usethis 1.5.0 2019-04-07 [1] CRAN (R 3.5.3) #> withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.3) #> xfun 0.6 2019-04-02 [1] CRAN (R 3.5.3) #> yaml 2.2.0 2018-07-25 [1] CRAN (R 3.5.3) #> #> [1] /home/lmmista-wap218/R/x86_64-pc-linux-gnu-library/3.5 #> [2] /usr/local/lib/R/site-library #> [3] /usr/lib/R/site-library #> [4] /usr/lib/R/library ```
thothorn commented 5 years ago

also fixed on CRAN

On Tue, 23 Apr 2019, Fabian Scheipl wrote:

Another inum-related issue, which is caused by having a covariate with only two unique values.

@kenahoo : Seems safe to ignore, the baselearner representation is still done correctly.

closing this here now.

@thothorn : these two lines in inum.data.frame trigger this, since ux has length 1 in the second line:

ux <- ux[ux < xmax] tol <- min(diff(sort(ux)))

d <- data.frame(target = c(46, 42, 42, 39, 42, 42, 39, 36, 42, 39, 36, 45, 39, 36, 45, 43, 36, 45, 43, 39, 45, 43, 39, 36, 43, 39, 36, 34, 39, 36, 34, 31, 36, 34, 31, 31, 34, 31, 31, 38, 31, 31, 38, 35, 31, 38, 35, 34, 38, 30, 31, 31, 30, 31, 35, 30, 31, 35, 34, 31, 35, 34, 34, 35, 34, 34, 32, 34, 34, 32, 34, 34, 32, 34, 30, 32, 34, 30, 27, 34, 30, 27, 33, 30, 27, 33, 31, 27, 33, 31, 30, 33, 31, 30, 31, 31, 30, 31, 33, 30, 31, 33, 31, 31, 33, 31, 31, 33, 31, 31, 28, 31, 31, 28, 26, 31, 28, 26, 24, 28, 26, 24, 25, 26, 24, 25, 25, 24, 25, 25, 25, 25, 25, 25, 25, 25, 25, 25, 26, 25, 25, 26, 28, 25, 26, 28, 25, 26, 28, 25, 25, 28, 25, 25, 24, 25, 25, 24, 29, 25, 24, 29, 26, 24, 29, 26, 26, 29, 26, 26, 25, 26, 26, 25, 26, 26, 25, 26, 24, 25, 26, 24, 25, 26, 24, 25, 25, 24, 25, 25, 25, 25, 25, 25, 24), X = c(0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0, 1, 0, 0, 1, 0, 0, 1, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 1, 1, 0, 0)) options(warn = 2) mboost::mboost(target ~ ., d, baselearner=mboost::btree)

> Error in min(diff(sort(ux))): (converted from warning) no non-missing arguments to min; returning Inf

traceback()

[....] 10: .signalSimpleWarning("no non-missing arguments to min; returning Inf", quote(min(diff(sort(ux))))) 9: inum.data.frame(mf, ignore = names(mf)[zerozvars], total = FALSE, nmax = nmax["z"], meanlevels = FALSE) 8: inum::inum(mf, ignore = names(mf)[zerozvars], total = FALSE, nmax = nmax["z"], meanlevels = FALSE) 7: extree_data(fm, data = df, yx = "none", nmax = c(yx = Inf, z = nmax)) 6: object$dpp(weights) 5: dpp.blg(X[[i]], ...) 4: FUN(X[[i]], ...) 3: lapply(blg, dpp, weights = weights) 2: mboost_fit(bl, response = response, weights = weights, offset = offset, family = family, control = control, oobweights = oobweights, ...) 1: mboost::mboost(target ~ ., d, baselearner = mboost::btree)

Created on 2019-04-23 by the reprex package (v0.2.1)

Session info

devtools::session_info()

> ─ Session info ──────────────────────────────────────────────────────────

> setting value

> version R version 3.5.3 (2019-03-11)

> os Linux Mint 19.1

> system x86_64, linux-gnu

> ui X11

> language en_GB

> collate en_GB.UTF-8

> ctype en_GB.UTF-8

> tz Europe/Berlin

> date 2019-04-23

>

> ─ Packages ──────────────────────────────────────────────────────────────

> package * version date lib source

> assertthat 0.2.1 2019-03-21 [1] CRAN (R 3.5.3)

> backports 1.1.4 2019-04-10 [1] CRAN (R 3.5.3)

> callr 3.2.0 2019-03-15 [1] CRAN (R 3.5.3)

> cli 1.1.0 2019-03-19 [1] CRAN (R 3.5.3)

> crayon 1.3.4 2017-09-16 [1] CRAN (R 3.5.3)

> desc 1.2.0 2018-05-01 [1] CRAN (R 3.5.3)

> devtools 2.0.2 2019-04-08 [1] CRAN (R 3.5.3)

> digest 0.6.18 2018-10-10 [1] CRAN (R 3.5.3)

> evaluate 0.13 2019-02-12 [1] CRAN (R 3.5.3)

> Formula 1.2-3 2018-05-03 [1] CRAN (R 3.5.3)

> fs 1.2.7 2019-03-19 [1] CRAN (R 3.5.3)

> glue 1.3.1 2019-03-12 [1] CRAN (R 3.5.3)

> highr 0.8 2019-03-20 [1] CRAN (R 3.5.3)

> htmltools 0.3.6 2017-04-28 [1] CRAN (R 3.5.3)

> inum 1.0-0 2017-12-12 [1] CRAN (R 3.5.3)

> knitr 1.22 2019-03-08 [1] CRAN (R 3.5.3)

> lattice 0.20-38 2018-11-04 [4] CRAN (R 3.5.1)

> libcoin 1.0-4 2019-02-28 [1] CRAN (R 3.5.3)

> magrittr 1.5 2014-11-22 [1] CRAN (R 3.5.3)

> Matrix 1.2-17 2019-03-22 [4] CRAN (R 3.5.3)

> mboost 2.9-1 2018-08-22 [1] CRAN (R 3.5.3)

> memoise 1.1.0 2017-04-21 [1] CRAN (R 3.5.3)

> mvtnorm 1.0-10 2019-03-05 [1] CRAN (R 3.5.3)

> nnls 1.4 2012-03-19 [1] CRAN (R 3.5.3)

> partykit 1.2-3 2019-01-31 [1] CRAN (R 3.5.3)

> pkgbuild 1.0.3 2019-03-20 [1] CRAN (R 3.5.3)

> pkgload 1.0.2 2018-10-29 [1] CRAN (R 3.5.3)

> prettyunits 1.0.2 2015-07-13 [1] CRAN (R 3.5.3)

> processx 3.3.0 2019-03-10 [1] CRAN (R 3.5.3)

> ps 1.3.0 2018-12-21 [1] CRAN (R 3.5.3)

> quadprog 1.5-5 2013-04-17 [1] CRAN (R 3.5.3)

> R6 2.4.0 2019-02-14 [1] CRAN (R 3.5.3)

> Rcpp 1.0.1 2019-03-17 [1] CRAN (R 3.5.3)

> remotes 2.0.4 2019-04-10 [1] CRAN (R 3.5.3)

> rlang 0.3.4 2019-04-07 [1] CRAN (R 3.5.3)

> rmarkdown 1.12 2019-03-14 [1] CRAN (R 3.5.3)

> rpart 4.1-13 2018-02-23 [1] CRAN (R 3.5.3)

> rprojroot 1.3-2 2018-01-03 [1] CRAN (R 3.5.3)

> sessioninfo 1.1.1 2018-11-05 [1] CRAN (R 3.5.3)

> stabs 0.6-3 2017-07-19 [1] CRAN (R 3.5.3)

> stringi 1.4.3 2019-03-12 [1] CRAN (R 3.5.3)

> stringr 1.4.0 2019-02-10 [1] CRAN (R 3.5.3)

> survival 2.44-1.1 2019-04-01 [1] CRAN (R 3.5.3)

> testthat 2.0.1 2018-10-13 [1] CRAN (R 3.5.3)

> usethis 1.5.0 2019-04-07 [1] CRAN (R 3.5.3)

> withr 2.1.2 2018-03-15 [1] CRAN (R 3.5.3)

> xfun 0.6 2019-04-02 [1] CRAN (R 3.5.3)

> yaml 2.2.0 2018-07-25 [1] CRAN (R 3.5.3)

>

> [1] /home/lmmista-wap218/R/x86_64-pc-linux-gnu-library/3.5

> [2] /usr/local/lib/R/site-library

> [3] /usr/lib/R/site-library

> [4] /usr/lib/R/library

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.[AINBJTKNMIIMH4FBUIDLXTTPR3D3FANCNFSM4HHSYGQQ.gif]