text_plain_output_1.png
from sklearn import svm

from sklearn.ensemble import GradientBoostingRegressor

from sklearn.linear_model import SGDRegressor

from sklearn.model_selection import cross_val_score

from sklearn.model_selection import train_test_split

from sklearn.neighbors import KNeighborsRegressor

from sklearn.neural_network import MLPRegressor

from xgboost import XGBRegressor

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)

from sklearn.metrics import mean_squared_error
from sklearn import metrics
from sklearn import svm
from xgboost import XGBRegressor
from sklearn.model_selection import cross_val_score
from sklearn.linear_model import SGDRegressor
from sklearn.ensemble import GradientBoostingRegressor
from sklearn.neighbors import KNeighborsRegressor
from sklearn.neural_network import MLPRegressor
def calc_score(model):
    scores = -1 * cross_val_score(model, encoder_X_train, y_train, cv=5, scoring='neg_mean_squared_error')
    print('MAE score:', scores.mean())
print('SVR ->')
calc_score(svm.SVR())
print('XGBRegressor ->')
calc_score(XGBRegressor())
print('SGDRegressor ->')
calc_score(SGDRegressor())
print('GradientBoostingRegressor ->')
calc_score(GradientBoostingRegressor())
print('KNeighborsRegressor ->')
calc_score(KNeighborsRegressor())
print('MLPRegressor ->')
calc_score(MLPRegressor())