app = "_" + str(time.time())
            model_file_raw += app

        model_file = model_file_raw + ".skl"

        # X = x[:, i]
        X = x

        # print(np.shape(x))
        # print(np.shape(y))

        n_train_percent = config["train_percent"]

        x_train, y_train = classifiers.split_dataset_train(
            X, y, n_train_percent)
        x_test, y_test = classifiers.split_dataset_test(X, y, n_train_percent)

        dt = 0

        if not use_saved_model:
            tstart = time.time()
            model = classifiers.create_svm_multiclass()
            model, acc = classifiers.train_decision_tree(
                model, x_train, y_train)
            dt = time.time() - tstart
        else:
            model = model_loader.load_sklearn_model(model_file)

        model, acc, diff, total, _ = classifiers.predict_decision_tree(
            model, x_train, y_train, False)
Exemple #2
0
    #     if y2 is None:
    #         y2 = [y21]
    #         # print(y2)
    #         # print([y21])
    #     else:
    #         y2 = np.append(y2, [y21], axis=0)

    # y = y2

    # print(y)

    # quit(0)

    x_train, y_train = classifiers.split_dataset_train(x, y, train_percent)

    x_eval, y_eval = classifiers.split_dataset_test(x, y, train_percent)

    print("end select data")
    quit(0)
    ##

    sizex = np.shape(x_train)

    top_acc = 0
    top_model_filename = None

    # run multiple evaluations (each training may return different results in terms of accuracy)
    for i in range(n_reps):
        print("evaluating model rep: " + str(i) + "/" + str(n_reps))

        # session = K.get_session()