text_plain_output_2.png text_plain_output_1.png
from catboost import CatBoostRegressor, Pool

from sklearn import metrics

from sklearn.preprocessing import LabelEncoder

import numpy as np

import pandas as pd

train = pd.read_csv('../input/hr-analytics-job-change-of-data-scientists/aug_train.csv')

train = train.replace([np.inf, -np.inf], np.nan)
train = train.fillna(0)

from sklearn.preprocessing import LabelEncoder
le = LabelEncoder()
def FunLabelEncoder(df):
    for c in df.columns:
        if df.dtypes[c] == object:
            le.fit(df[c].astype(str))
            df[c] = le.transform(df[c].astype(str))
    return df

train = FunLabelEncoder(train)

test = pd.read_csv('../input/hr-analytics-job-change-of-data-scientists/aug_test.csv')

test = FunLabelEncoder(test)

features = ['enrollee_id', 'city', 'city_development_index', 'gender', 'relevent_experience', 'enrolled_university', 'education_level', 'major_discipline', 'experience', 'company_size', 'company_type', 'last_new_job', 'training_hours']
target = 'target'

from catboost import CatBoostRegressor, Pool
from sklearn.metrics import r2_score, mean_squared_error
model = CatBoostRegressor(objective='RMSE')
model.fit(train[features], train[target])

predictions = model.predict(test[features])
predictions

from sklearn import metrics
fpr, tpr, thresholds = metrics.roc_curve(train[target], model.predict(train[features]))
metrics.auc(fpr, tpr)