from sklearn.model_selection import train_test_split

import xgboost as xgb


def prepare_training_data(data, clist):
    y = data["goal"]
    X = data[clist]
    X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42)

    dtrain = xgb.DMatrix(X_train, label=y_train)
    dtest = xgb.DMatrix(X_test, label=y_test)

    return {
        "training_data": dtrain,
        "testing_data": dtest,
        "testing_data_correct_result": y_test,
        "clist": clist
    }
