anymous_asker
anymous_asker

Reputation: 113

R: Convert a caret train object to glmnet object

I'd like to ask how can I convert the final model that I get from a grid search with caret's 'train' function into an object of the class that is created with the glmnet function, assuming that I specified method='glmnet'.

Upvotes: 0

Views: 829

Answers (1)

anymous_asker
anymous_asker

Reputation: 113

I'll answer myself (found it looking with different terms): the final model is saved in the train object as attribute 'finalModel', so if the train object is called 'fit', it can be accessed by fit$finalModel

Upvotes: 2

Related Questions