예제 #1
0
def test_AutoMLClassifier(get_data):
    data = get_data
    test_model = AutoMLClassifier(databunch=data, random_state=RANDOM_SEED)
    predict_test, predict_train = test_model.opt(timeout=1500, verbose=0,)
    assert predict_test is not None
    score = sklearn.metrics.roc_auc_score(data.y_test, predict_test)
    assert score is not None
    assert score >= 0.8
예제 #2
0
        X_train, y_train = X.iloc[train_idx], y.iloc[train_idx]
        X_test, y_test = X.iloc[test_idx], y.iloc[test_idx]
        #print(DATASET_NAME, X_train.shape, X_test.shape)

        # Auto_ml
        START_EXPERIMENT = time.time()
              
        model = AutoMLClassifier(X_train, y_train, X_test, 
                                 #cat_encoder_names=['OneHotEncoder', 'FrequencyEncoder'],
                                 cat_features=cat_features, 
                                 random_state=RANDOM_SEED, 
                                 verbose=1)
        
        time.sleep(0.5)

        y_test_predict_proba, predict_train = model.opt(timeout=TIME_LIMIT, verbose=2)           

        #y_test_predict_proba, _ = model.fit_predict()
        #y_test_predict = automl.predict(X_test)
        print('*'*75)
        print('AUC: ', round(roc_auc_score(y_test, y_test_predict_proba),4))
        print('AUC mean models: ', round(roc_auc_score(y_test, model.stack_models_predicts['predict_test'].mean()),4))
        print('Model_0 FullX: ', round(roc_auc_score(y_test, model.predicts_model_0_full_x['predict_test'].mean()),4))
        print('Model_1 FullX: ', round(roc_auc_score(y_test, model.predicts_model_1_full_x['predict_test'].mean()),4))
        
        print('-'*75)
        #print('Mean Test AUC: ', round(sklearn.metrics.roc_auc_score(y_test, model._data.X_test_predicts.T.mean()),4))

        END_EXPERIMENT = time.time()

        #preds = pd.DataFrame(predictions)