INNER CODE UNIT · Python

y

SalvatoreRa/tutorial · machine learning/scripts/MNAR.py:87

    X, y = df.iloc[:, :-1], df.iloc[:, -1]
    lb = LabelBinarizer()
    y =lb.fit_transform(y)
    
    print(datasets_name)
    # first we just start with the baseline
    # here we use as a classifier XGBoost but you can change with another on
    # we do 5 fold cross validation
    kf = KFold(n_splits=fold_splits)
    X = np.array(X)
    for train_index, test_index in kf.split(X):
        algo_time = time.time()
        X_train, X_test = X[train_index], X[test_index]
        y_train, y_test = y[train_index], y[test_index]
        clf = xgb.XGBClassifier(random_state=42)
        clf.fit(X_train, y_train)
        y_test_pred = clf.predict(X_test)
               

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…