text_plain_output_1.png
from sklearn.model_selection import train_test_split, cross_val_predict, cross_val_score, StratifiedKFold, RandomizedSearchCV

from sklearn.preprocessing import RobustScaler

from xgboost import XGBRegressor, XGBClassifier

import matplotlib.pyplot as plt

import numpy as np

import numpy as np # linear algebra

import pandas as pd

import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)

import seaborn as sns

data = pd.read_csv('/kaggle/input/playground-series-s3e7/train.csv')

corrmat = data.corr()
cols = corrmat.nlargest(20, 'booking_status')['booking_status'].index
cm = np.corrcoef(data[cols].values.T)
fig = plt.gcf()
fig.set_size_inches(10, 8)
hm = sns.heatmap(cm, cbar=True, annot=True, square=True, fmt='.2f', annot_kws={'size': 10}, yticklabels=cols.values, xticklabels=cols.values)

g = sns.PairGrid(data, y_vars=['booking_status'], x_vars=data.columns)
g = g.map_diag(plt.hist)
g = g.map_offdiag(sns.scatterplot)

y = data.booking_status
X = data.drop(['booking_status', 'id'], axis=1)
X_train, X_val, y_train, y_val = train_test_split(X, y, train_size=0.8, test_size=0.2)

scaler = RobustScaler()
X = pd.DataFrame(scaler.fit_transform(X))
X_train = pd.DataFrame(scaler.fit_transform(X_train))
X_val = pd.DataFrame(scaler.fit_transform(X_val))

XGB_model = XGBRegressor(random_state=0)
XGB_scores = cross_val_score(XGB_model, X, y, cv=3, scoring='roc_auc')
XGB_mean_score = XGB_scores.mean()
XGB_std_score = XGB_scores.std()
print(f'RMSE = {XGB_scores}')
print(f'Mean RMSE = {XGB_mean_score:.2f}')
print(f'StDev RMSE = {XGB_std_score:.2f}')