Updated 4 years ago
XGBoost Templates
- Using sklearn and XGboost for classification
- Applying gblinear
Dataset: UCI Machine Learning Repository Iris dataset
Dataset: Diabetes Diabetes dataset
Dataset: Heart desease
!pip install jovian --upgrade --quiet
import jovian
jovian.commit(project='xgboost-iris-diabetes', filename='xgboost-iris-diabetes.ipynb')
[jovian] Attempting to save notebook..
[jovian] Updating notebook "patxigad/xgboost-iris-diabetes" on https://jovian.ai/
[jovian] Uploading notebook..
[jovian] Capturing environment..
[jovian] Committed successfully! https://jovian.ai/patxigad/xgboost-iris-diabetes
Getting the data
# main imports
import pandas as pd
import datetime as dt
import numpy as np
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
%matplotlib inline
sns.set_style('darkgrid')
matplotlib.rcParams['font.size'] = 14
matplotlib.rcParams['figure.figsize'] = (9, 5)
matplotlib.rcParams['figure.facecolor'] = '#00000000'
# silence warnings
import warnings
warnings.filterwarnings('ignore')
# import the data from sklearn
from sklearn import datasets
# load the iris dataset
iris = datasets.load_iris()
# create the dataframe
df = pd.DataFrame(data=np.c_[iris['data'],
iris['target']],
columns=iris['feature_names'] + ['target'])
# explore first five rows
df.head()