{"action":"opened","issue":{"url":"https://api.github.com/repos/topepo/caret/issues/955","repository_url":"https://api.github.com/repos/topepo/caret","labels_url":"https://api.github.com/repos/topepo/caret/issues/955/labels{/name}","comments_url":"https://api.github.com/repos/topepo/caret/issues/955/comments","events_url":"https://api.github.com/repos/topepo/caret/issues/955/events","html_url":"https://github.com/topepo/caret/issues/955","id":374595277,"node_id":"MDU6SXNzdWUzNzQ1OTUyNzc=","number":955,"title":"Improve error message when unsupported tuning parameters are passed for a method","user":{"login":"jmuhlenkamp","id":8418604,"node_id":"MDQ6VXNlcjg0MTg2MDQ=","avatar_url":"https://avatars0.githubusercontent.com/u/8418604?v=4","gravatar_id":"","url":"https://api.github.com/users/jmuhlenkamp","html_url":"https://github.com/jmuhlenkamp","followers_url":"https://api.github.com/users/jmuhlenkamp/followers","following_url":"https://api.github.com/users/jmuhlenkamp/following{/other_user}","gists_url":"https://api.github.com/users/jmuhlenkamp/gists{/gist_id}","starred_url":"https://api.github.com/users/jmuhlenkamp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmuhlenkamp/subscriptions","organizations_url":"https://api.github.com/users/jmuhlenkamp/orgs","repos_url":"https://api.github.com/users/jmuhlenkamp/repos","events_url":"https://api.github.com/users/jmuhlenkamp/events{/privacy}","received_events_url":"https://api.github.com/users/jmuhlenkamp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-10-27T02:04:36Z","updated_at":"2018-10-27T02:04:36Z","closed_at":null,"author_association":"NONE","body":"Caret gives a confusing error message the `tuneGrid` passed to `train` contains a tuning parameter not supported by passed `method`.  As a simple example.\r\n\r\n```\r\nlibrary(caret)\r\nmtry <- round(sqrt(18), 0)\r\ngbmGrid <- expand.grid(\r\n    interaction.depth = c(1, 2, 3, 4, 5, 6)\r\n    , n.trees = seq(10, 10000, by = 100)\r\n    , shrinkage = 0.01\r\n    , n.minobsinnode = c(5, 10, 20, 30)\r\n    , distribution = 'gaussian'\r\n    , method = 'gbm'\r\n    , mtry = mtry\r\n)\r\nfitControl <- trainControl(\r\n    method = \"repeatedcv\"\r\n    , number = 2\r\n    , repeats = 3\r\n)\r\ngbmFit1 <- train(\r\n    Species ~ Sepal.Length + Sepal.Width\r\n    , data = iris\r\n    , trControl = fitControl\r\n    , tuneGrid = gbmGrid\r\n    , verbose = FALSE\r\n)\r\n# Error: The tuning parameter grid should have columns mtry\r\n```\r\n\r\nI was digging into why it was giving such a strange error message and realized an improved error message would be a straightforward code change.  I will be opening a pull request for this issue that adds 5 lines of code and in the above case would now show the error message.\r\n```\r\n# Error: The tuning parameter grid should not have columns mtry\r\n```\r\n\r\nBy simply adding a NOT to the message for this circumstance, the error message now becomes much more helpful.\r\n\r\nThe current error message has certainly tripped me up in the past and apparently [others as well](https://stackoverflow.com/questions/52832898/caret-the-tuning-parameter-grid-should-have-columns-mtry)."}}
{"actor":{"display_login":"jmuhlenkamp"}}