Example #1
0
        'xgb__colsample_bytree': np.logspace(-0.3, 0, 100)  # (~0.5 - 1.0)
    }

    voting = ScikitModel(voting,
                         voting_params,
                         random_search=True,
                         n_iter=25,
                         verbose=True)

    # Train on whole train-set, predict with 0.5 threshold
    voting.train(x_train, y_train)
    voting_preds_no_indeterminates = voting.predict(x_test)

    # Train on 50%, calibrate on 50%, predict with calibrated thresholds
    voting.train_calibrate(x_train, y_train)
    voting_preds_with_indeterminates = voting.predict_calibrated(x_test)

    print()

    ### 2 STAGE: LDA --> VOTING ENSEMBLE ###
    # Stage 1: LDA
    stage1 = LinearDiscriminantAnalysis()

    # Stage 2: LR-SVC-XGB Voting Classifier
    clf1 = SVC(probability=True)
    clf2 = LogisticRegression()
    clf3 = xgb.XGBClassifier(n_jobs=N_JOBS)
    voting = VotingClassifier(estimators=[('svm', clf1), ('lr', clf2),
                                          ('xgb', clf3)],
                              voting='soft',
                              n_jobs=N_JOBS)