Exemple #1
0
def bench_classifiers(name):
    classifiers = [
        ada_boost(name + '.ada_boost'),  # boo
        gaussian_nb(name + '.gaussian_nb'),  # eey
        knn(name + '.knn', sparse_data=True),  # eey
        linear_discriminant_analysis(name + '.linear_discriminant_analysis', n_components=1),  # eey
        random_forest(name + '.random_forest'),  # boo
        sgd(name + '.sgd')  # eey
    ]
    if xgboost:
        classifiers.append(xgboost_classification(name + '.xgboost'))  # boo
    return hp.choice('%s' % name, classifiers)
                   Y_train_mini.sum(axis=0),
                   Y_val_mini.sum(axis=0),
                   Y_test_mini.sum(axis=0)
               ])))
        print(seed_val)

        print("\ndata is loaded  - next step > model testing\n")

        n_job = 6
        select_classes = [0, 1, 2, 3, 4, 5]
        val_dist = X_val_mini.shape[0] / X_train_mini.shape[0]
        name = 'my_est_oVa'

        tic_mod_all = time.time()
        select_alg = [
            ada_boost(name + '.ada_boost'),
            gaussian_nb(name + '.gaussian_nb'),
            knn(name + '.knn', sparse_data=True),
            linear_discriminant_analysis(name +
                                         '.linear_discriminant_analysis',
                                         n_components=1),
            random_forest(name + '.random_forest'),
            sgd(name + '.sgd'),
            xgboost_classification(name + '.xgboost')
        ]

        # fitting models
        estim_one_vs_rest = dict()
        # scoring models
        algo_scoring = dict()
        save_score_path = r'C:/Users/anden/PycharmProjects/NovelEEG/results'
Exemple #3
0
                 X_val_mini.shape, Y_val_mini.shape,
                 X_test_mini.shape, Y_test_mini.shape,
                 X_model_mini.shape, Y_model_mini.shape,
                 np.array([Y_train_mini.sum(axis=0), Y_val_mini.sum(axis=0), Y_test_mini.sum(axis=0)])))

        print("\ndata is loaded  - next step > model testing\n")
        print('model:%i\nrun_nr:%s_subsample_%.2f' %
              (args.index, args.reruns, args.subsample))

        n_job = 5
        select_classes = [0, 1, 2, 3, 4, 5]
        val_dist = X_val_mini.shape[0] / X_train_mini.shape[0]
        name = 'my_est_oVa'

        tic_mod_all = time.time()
        select_alg = [ada_boost(name + '.ada_boost'),
                      gaussian_nb(name + '.gaussian_nb'),
                      knn(name + '.knn', sparse_data=True),
                      linear_discriminant_analysis(name + '.linear_discriminant_analysis', n_components=1),
                      random_forest(name + '.random_forest'),
                      sgd(name + '.sgd'),
                      xgboost_classification(name + '.xgboost')]

        # fitting models and score initialization
        estim_one_vs_rest = dict()
        algo_scoring = dict()
        lars_table = {"model names": [], "wF1": [], "acc": [], "balanced acc": [], "sens": [],
                      "sens-eyem": [], "sens-chew": [], "sens-shiv": [],
                      "sens-elpp": [], "sens-musc": [], "sens-null": [],
                      "acc-eyem": [], "acc-chew": [], "acc-shiv": [], "acc-elpp": [], "acc-musc": [], "acc-null": []}