text_plain_output_1.png
from sklearn.ensemble import GradientBoostingRegressor

from sklearn.metrics import mean_squared_error

from sklearn.model_selection import train_test_split

import category_encoders as ce

import pandas as pd

aug_data = pd.read_csv('../input/hr-analytics-job-change-of-data-scientists/aug_train.csv', index_col='enrollee_id')
aug_data = aug_data.sort_index()
aug_data

aug_data.isnull().sum()

aug_data.isnull().sum()

y = aug_data.target.astype('int')
X = aug_data.drop('target', axis=1)
X_train, X_val, y_train, y_val = train_test_split(X, y, test_size=0.1)

from sklearn.preprocessing import OneHotEncoder
import category_encoders as ce
catboost_encoder = ce.CatBoostEncoder(cols=X.columns)
catboost_encoder.fit(X_train, y_train)
def catboost_encode_x_data(x_data):
    encoder_x_data = x_data.copy()
    encoder_x_data = catboost_encoder.transform(x_data)
    encoder_x_data.index = x_data.index
    return encoder_x_data
encoder_X_train = catboost_encode_x_data(X_train)
encoder_X_val = catboost_encode_x_data(X_val)

model = GradientBoostingRegressor()
model.fit(encoder_X_train, y_train)
y_val_predict = model.predict(encoder_X_val)
error = mean_squared_error(y_val, y_val_predict)
print('MAE: ', error)