In [1]:
import joblib
import xgboost
In [2]:
import os
import sys
In [3]:
# This thing relies heavily on reusing AISUP; if you don't have it, I, er, apologize
AISUP_DIR = '/home/mrkun/PycharmProjects/AISUP/main'
os.chdir(AISUP_DIR)
sys.path.append(AISUP_DIR)

from cfg import *
In [4]:
X_train_vec_1 = joblib.load('X_train_vec_1.pkl')
X_test_vec_1 = joblib.load('X_test_vec_1.pkl')
X_train_vec_2 = joblib.load('X_train_vec_2.pkl')
X_test_vec_2 = joblib.load('X_test_vec_2.pkl')
y_train = joblib.load('y_train.pkl')
y_test = joblib.load('y_test.pkl')
In [5]:
assert not (X_test_vec_1 != X_test_vec_2).toarray().any()
assert not (X_train_vec_1 != X_train_vec_2).toarray().any()
In [9]:
xgb_clf_test_1 = xgboost.XGBClassifier(updater='grow_gpu_hist')
eval_set = [(X_test_vec_1, y_test)]
xgb_clf_test_1.fit(X_train_vec_1, y_train,
                   eval_set=eval_set, eval_metric=["merror",],
                   early_stopping_rounds=1)
print(xgb_clf_test_1.best_score)
[0]	validation_0-merror:0.893003
Will train until validation_0-merror hasn't improved in 1 rounds.
[1]	validation_0-merror:0.892458
[2]	validation_0-merror:0.892186
[3]	validation_0-merror:0.895726
Stopping. Best iteration:
[2]	validation_0-merror:0.892186

0.892186
In [10]:
xgb_clf_test_2 = xgboost.XGBClassifier(updater='grow_gpu_hist')
eval_set = [(X_test_vec_2, y_test)]
xgb_clf_test_2.fit(X_train_vec_2, y_train,
                   eval_set=eval_set, eval_metric=["merror",],
                   early_stopping_rounds=1)
print(xgb_clf_test_2.best_score)
[0]	validation_0-merror:0.896542
Will train until validation_0-merror hasn't improved in 1 rounds.
[1]	validation_0-merror:0.898448
Stopping. Best iteration:
[0]	validation_0-merror:0.896542

0.896542