Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when predicting with large N #57

Open
bryorsnef opened this issue Dec 10, 2019 · 1 comment
Open

Error when predicting with large N #57

bryorsnef opened this issue Dec 10, 2019 · 1 comment

Comments

@bryorsnef
Copy link

I'm getting an error when trying to predict using gamboost, but the error only appears for me when the N becomes large.

E.g. running this code with 10000 rows of data is fine.

try with 10000 obs

p <- 10
n <- 10000

x <- matrix(runif(np), nrow = n, ncol = p)
coefs <- ifelse(runif(p) < 0.5, rnorm(p), 0)
y <- x %
% coefs + rnorm(n)
x[,10] <- ifelse(runif(n) < 0.5, x[,10], NA)

xy <- data.frame(x,y)

forms <- list(mu = as.formula(X10 ~ .), phi = as.formula(X10 ~ .))

mod <- gamboostLSS(forms, data = xy[!is.na(xy[,10]),], families = BetaLSS())

preds <- predict(mod, newdata = xy[is.na(xy$X10),], type = "response")

no error

try with 50000 obs, error

p <- 10
n <- 50000

x <- matrix(runif(np), nrow = n, ncol = p)
coefs <- ifelse(runif(p) < 0.5, rnorm(p), 0)
y <- x %
% coefs + rnorm(n)
x[,10] <- ifelse(runif(n) < 0.5, x[,10], NA)

xy <- data.frame(x,y)

forms <- list(mu = as.formula(X10 ~ .), phi = as.formula(X10 ~ .))

mod <- gamboostLSS(forms, data = xy[!is.na(xy[,10]),], families = BetaLSS())

preds <- predict(mod, newdata = xy[is.na(xy$X10),], type = "response")

@sbrockhaus
Copy link
Member

as a quick fix you can change the following option to something higher than your n.

options("mboost_indexmin") # check current setting 
options(mboost_indexmin = 100000) # set to new value

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants