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

Documentation Request: explicit example passing parameters to model. #554

Closed
mpettis opened this issue Dec 21, 2016 · 5 comments
Closed

Comments

@mpettis
Copy link

mpettis commented Dec 21, 2016

The train() function has an explicit method parameter that specifies a model. However, models like polr exist that also have a method parameter. Normally, you can pass parameters to the underlying functions in the dots parameter, but you cannot when you have a parameter name clash. The solution seems to be to feed it as a column of the tuneGrid parameter data frame. I got the answer here: http://stackoverflow.com/questions/41230809/passing-parameters-to-dots-that-conflict-with-explicit-parameters/41258583#41258583 .

I suggest that this behavior be documented somehow, somewhere, with an example. Perhaps in the documentation that refers to polr in the "available models" listings. Thank you.

@topepo
Copy link
Owner

topepo commented Dec 21, 2016

This isn't a problem that would have an obvious answer. However, I'm not sure where to document this so that it will be more easily seen.

There is a notes element to the model code that you could see using getModelInfo but that isn't any more obvious as the available models page.

In some cases, I can intercept the ... if there is a conflict between a passed argument value and the the grid. The issue is that method is an argument to both polr and train so it never gets that far.

I could will put a note at the top of the available models page saying "if your model has a parameter called method..." but that would be weirdly out of place

@mpettis
Copy link
Author

mpettis commented Dec 21, 2016

Is it true that you could pass all of the parameters via an appropriately structured tuneGrid data frame, instead of via the ... parameter? If so, perhaps the best place to document it would be in the train() documentation, the 'arguments' section for ..., with a note saying that if a particular parameter needs to be passed to the underlying model and it conflicts with an existing train() named parameter, it can be passed as a column in a data frame, with the column name the same as the conflicting parameter name?

If true, I'd be happy to fork and make a pull request with my documentation verbiage as I stated above.

Thank you again for the great package.

@topepo
Copy link
Owner

topepo commented Dec 21, 2016

Is it true that you could pass all of the parameters via an appropriately structured tuneGrid data frame, instead of via the ... parameter?

No. There are a lot of options in the average model function that don't affect performance. The tuning grid only includes arguments that do.

There isn't an easy solution when the names of train and the model function are duplicated (that's one reason why trains other arguments are somewhat specific like trControl instead of control).

@mpettis
Copy link
Author

mpettis commented Dec 21, 2016

I'd consider this closed if you do. I think the real problem was that I fundamentally misunderstood that polr's method parameter was a tuning parameter (which you do clearly state in the ... documentation, and polr's documentation here http://topepo.github.io/caret/train-models-by-tag.html ), so I think it really was my misunderstanding and not a true documentation problem.

If it matters, I was going to go down the path to see what it took to make a custom model that I could feed to train() and then make my model as a very light wrapper around polr, but just with polr's method parameter filled with what I wanted. I didn't go as far to see if it was possible, as I got my question answered prior to that.

@topepo
Copy link
Owner

topepo commented Dec 21, 2016

Okay. Thanks for the feedback

@topepo topepo closed this as completed Dec 21, 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