#!/usr/bin/env python

import pandas as pd
import xgboost
from sklearn.preprocessing import LabelEncoder
from sklearn.grid_search import GridSearchCV


def main():
    path = '../datasets/processed/'
    train_users = pd.read_csv(path + 'processed_train_users.csv')
    test_users = pd.read_csv(path + 'processed_test_users.csv')

    y_train = train_users['country_destination']
    train_users.drop('country_destination', axis=1, inplace=True)
    train_users.drop('id', axis=1, inplace=True)

    x_train = train_users.values

    test_users.drop('id', axis=1, inplace=True)

    label_encoder = LabelEncoder()
    encoded_y_train = label_encoder.fit_transform(y_train)

    xgb_model = xgboost.XGBClassifier(
        objective="multi:softprob",
        nthread=-1,
        gamma=0,
        min_child_weight=1,
        max_delta_step=0,
        colsample_bylevel=1,
        colsample_bytree=1,
        subsample=1,
        reg_alpha=0,
        reg_lambda=1,
        scale_pos_weight=1,
        base_score=0.5,
        seed=42
    )

    clf = GridSearchCV(
        xgb_model,
        {
            'max_depth': [7, 8],
            'n_estimators': [55, 56, 57],
            'learning_rate': [0.18, 0.2, 0.22],
        },
        cv=10,
        verbose=10,
        n_jobs=1,
        scoring='log_loss'
    )

    clf.fit(x_train, encoded_y_train)

    print
    print(clf.grid_scores_)
    print
    print(clf.best_params_)
    print
    print(clf.best_score_)
    print


if __name__ == '__main__':
    main()

@@ -1108,16 +1108,19 @@
 epth': %5B
+6, 
 7, 8%5D,%0A 
@@ -1152,17 +1152,17 @@
 : %5B5
-5, 56, 57
+0, 52, 54
 %5D,%0A 
@@ -1197,20 +1197,20 @@
 %5B0.1
-8
+6
 , 0.
-2
+18
 , 0.2
-2
 %5D,%0A 

Update Grid Search parameters to adjust new data