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

Model request: bam models from mgcv #453

Closed
spedygiorgio opened this issue Jul 7, 2016 · 3 comments
Closed

Model request: bam models from mgcv #453

spedygiorgio opened this issue Jul 7, 2016 · 3 comments

Comments

@spedygiorgio
Copy link

Mgcv package has recently proposed an optimized version of gam... It could be nice to add this feature https://stat.ethz.ch/R-manual/R-devel/library/mgcv/html/bam.html

topepo added a commit that referenced this issue Jul 26, 2016
@topepo
Copy link
Owner

topepo commented Jul 26, 2016

Go ahead and try that code out for testing.

@topepo
Copy link
Owner

topepo commented Jul 28, 2016

There seems to be an error:
Error in train.default(x = dat[, c("x1", "x2", "x3", "x0")], y = dat$y, :
Model bam is not in caret's built-in library

Also I would suggest to let the family not be bounded to binomial or gaussian cause the model could be very useful to fit other glms (poisson or gamma ones for example)

It isn't in the package yet. You'll have to source the model code into an R session then use method = modelInfo. For example:

library(caret)
set.seed(24)
tr_dat <- SLC14_1(500)

set.seed(13)
mod <- train(y ~ ., data = tr_dat, 
             method = modelInfo,
             trControl = trainControl(method = "cv"))

You should also be able to pass family in also. For example:

hist(exp(tr_dat$y/100))

set.seed(13)
mod <- train(exp(y/100) ~ ., data = tr_dat, 
             method = modelInfo,
             family = Gamma(),
             trControl = trainControl(method = "cv"))

@topepo
Copy link
Owner

topepo commented Aug 5, 2016

on CRAN

@topepo topepo closed this as completed Aug 5, 2016
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