View this post on RPubs: rpubs.com/JiawenQi/GridSearchIris View this post on Github: github.com/JiawenQi98/KeepLearningR/blob/master/Grid%20Search%20of%20Iris%20Dataset.Rmd IntroductionOn Dec 10th, Simon Jackson blogged a new article about Grid Search in the tidyverse: https://drsimonj.svbtle.com/grid-search-in-the-tidyverse As a beginner in this field, Grid Search is a new term for me.
Decision Tree Example of IrisIris dataset is very famous and predictable. Let’s predict the Species by other four features
Let’s do a decision tree.
Split Training and Testing80% training, and 20% testing.
Create the GridDefine hyperparameter combinations: (you can try different value for minsplit and maxdepth)
Create a Model FunctionCreate a function to go through our grid search hyperparameter combinations and modeling easily.
Fit the ModelsIterate down the values and fit our models.
Obtain Accuracy Create a function to get accuracy easily:
Arrange ResultsSort results by high-accuracy, more-minsplit and less-maxdepth:
Take Away
0 Comments
Leave a Reply. |
Archive
February 2017
Category |