![]() ![]() When a method requires a function from a certain package, that package will need to be installed. In this case, the function is the base R function glm(), so no additional package is required. The train() function is essentially a wrapper around whatever method we chose. The method essentially specifies both the model (and more specifically the function to fit said model in R) and package that will be used. ![]() method = glm specifies that we will fit a generalized linear model.trControl = trainControl(method = "cv", number = 5) specifies that we will be using 5-fold cross-validation.data = default_trn specifies that training will be down with the default_trn data. ![]() It also indicates that all available predictors should be used. specifies the default variable as the response. Here, we have supplied four arguments to the train() function form the caret package. , data = default_trn, trControl = trainControl( method = "cv", number = 5), method = "glm", family = "binomial" ) predict() used on objects of type train will be truly magical!ĭefault_glm_mod = train( form = default ~.tuneGrid which specifies the tuning parameters to train over.method, a statistical learning method from a long list of availible models. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |