Hyperparameter tuning for Ensemble of ML models (Simple Python Example) @DataScienceGarage
Hyperparameter tuning for Ensemble of ML models (Simple Python Example)  @DataScienceGarage
Uploaded October 2021 | Updated September 2026, 2 weeks ago
If you have created an ensemble of ML models in scikit-learn, and you want to improve its performance even further, you can tune this ensemble itself.It can be easily implemented by GridSearchCV and VotingClassifier from Scikit-Learn. The main idea is to set the hyperparameters you want to search the best combination of values on, then set all possible weights of Machine Learning classifiers you have in your situation. For example, one option could be that your Random Forest classifier is more important that Linear Regression classifier, and opposite.Then the search for the best combination of your selected hyperparameters will do almost all the job.

That means that by tuning ensembles of ML models you can get the same accuracy as you got from cross validation score in ensemble learning mannier, or increase it with the tuning procedure. So, the good idea is to always invest some time tuning your ensemble. 

In this example we used following ML models for binary classification problem:
- Logistic Regression classifier: scikit-learn.org/stable/modules/generated/sklearn.linear_model.LogisticRegression.html
- Random Forest classifier: scikit-learn.org/stable/modules/generated/sklearn.ensemble.RandomForestClassifier.html
- Decision Tree classifier: scikit-learn.org/stable/modules/generated/sklearn.tree.DecisionTreeClassifier.html

Also we used following methods originally from scikit-learn:
- GridSearchCV: scikit-learn.org/stable/modules/generated/sklearn.model_selection.GridSearchCV.html
- Voting Classifier: scikit-learn.org/stable/modules/generated/sklearn.ensemble.VotingClassifier.html
- Cross Validation Score: scikit-learn.org/stable/modules/generated/sklearn.model_selection.cross_val_score.html

By using all of these functionalities we implemented the search across Soft and Hard voters in Grid Search CV. The main differences and examples of calculations are presented in the BONUS part of this video.

The content of this video:
0:00 - Creating Ensemble of  Machine Learning models1:00 - Tuning the Ensemble of ML models
9:58 - Results of tuning (accuracy).
10:56 - BONUS part: Soft Voting and Hard Voting

#hyperparametertuning #ensemblelearning #gridsearchcv

Enjoy!
Hyperparameter tuning for Ensemble of ML models (Simple Python Example)NLP with Tensorflow and Keras. Tokenizer, Sequences and PaddingMake Better Heatmap With Seaborn in PythonSpeech-To-Text. AWS Lambda function from S3 Event to AWS Transcribe (CloudWatch included)Landing at Warsaw Chopin Airport (from Belgrade to Washaw, Poland)Exam-Labs.com SCAM. Fake answers and Wrong Ads | REVIEWChocolate bar word intro animation by BlenderBI-DIRECTIONAL ATTENTION | Explained in high levelCompare ML Models in few clicks with PyCaret in Python - DEMOHow to build ML Architecture with AWS SageMaker + Lambda + API Gateway | HANDS-ON TUTORIALPhotoshop - could not complete your request because the scratch disks are fullAWS CodeCommit tutorial: your first Repo, Commit and Push
Data Science Garage |

Hyperparameter tuning for Ensemble of ML models (Simple Python Example)

SHARE TO X SHARE TO REDDIT SHARE TO FACEBOOK WALLPAPER