Welcome to How to train XGBoost models in Python tutorial. You'll build an XGBoost Classifier model with an example dataset, step-by-step.
By following this tutorial, you’ll learn:
✅What is XGBoost (vs. gradient tree boosting algorithm)
✅How to build an XGBoost model (Classifier) in Python, step-by-step:
- Step #1: Explore and prep data
- Step #2: Build a pipeline of training
- Step #3: Set up hyperparameter tuning (cross-validation)
- Step #4: Train the XGBoost model
- Step #5: Evaluate the model and make predictions
- Step #6: Measure feature importance (optional)
If you want to use Python to create XGBoost models to make predictions, this practical tutorial will get you started.
GitHub Repo with code: https://github.com/liannewriting/YouTube-videos-public/blob/main/xgboost-python-tutorial-example/xgboost_python.ipynb
Technologies that will be used:
☑️ JupyterLab (Notebook)
☑️ pandas
☑️ scikit-learn (sklearn)
☑️ category_encoders
☑️ xgboost Python package
☑️ scikit-optimize (skopt)
Links mentioned in the video
► Bank marketing dataset: https://archive.ics.uci.edu/ml/datasets/bank+marketing
► What is gradient boosting in machine learning tutorial: fundamentals explained: https://www.justintodata.com/gradient-boosting-machine-learning/
► To learn Python basics, take our course Python for Data Analysis with projects: https://www.justintodata.com/courses/python-for-data-analysis-projects-online-course/
► sklearn pipeline: https://scikit-learn.org/stable/modules/generated/sklearn.pipeline.Pipeline.html
► Target Encoder: https://contrib.scikit-learn.org/category_encoders/targetencoder.html
► XGBClassifier documentation with hyperparameters definition: https://xgboost.readthedocs.io/en/stable/python/python_api.html#xgboost.XGBClassifier
There's also an article version of the same content. If you prefer reading, please check it out. How to build XGBoost models in Python: https://www.justintodata.com/xgboost-model-classifier-python-example/
Get access to more data science materials, check out our website Just into Data: https://justintodata.com/