示例#1
0
def run_train():
    #    t0 = time.time()
    pt = Preprocessor()
    tr = Trainer_nn()

    X_train, y_train = pt.get_data_labels()
    X_test, y_test = pt.get_data_labels("test")

    #    X_train, y_train = pt.load_data()
    #    X_test, y_test = pt.load_data("mnist_test_data.npz")

    clf = tr.mlp(X_train, y_train)
    tr.save_model(clf, "mlp_mnist_Hu300x300ReluSgdIter100Acc96Sample60000.m")

    tester = Tester("mlp_mnist_Hu300x300ReluSgdIter100Acc96Sample60000.m")
    mt, score, repo = tester.clf_quality(X_test, y_test)
    print(mt, score, repo)
    return clf
示例#2
0
def run_train():
    t0 = time.time()
    pt = Preprocessor()
    tr = Trainer()

    X_train, y_train = pt.get_data_labels()
    X_test, y_test = pt.get_data_labels("test")

    t1 = time.time()
    print(t1 - t0)
    clf = tr.svc(X_train, y_train)
    print(time.time() - t1)

    tr.save_model(clf, "mnist_svm.m")

    tester = Tester("mnist_svm.m")
    mt, score, repo = tester.clf_quality(X_test, y_test)
    print(mt, score, repo)
    return clf