Beispiel #1
0
    print(len(data))
    # print(vals)
    # print(len(data[999]))
    data = check_array(data, accept_sparse=True)
    # print("d1: ",data[0])
    svd.fit(data)
    d = svd.fit_transform(data)
    # print("d1: ",data[0])
    #DummyClassifier(strategy='most_frequent').fit(d,[styledict[s] for s in style])
    # classifier1 = MLPClassifier(random_state=1,max_iter=1000).fit(d,[styledict[s] for s in style])
    classifier = GradientBoostingClassifier(
        n_estimators=100,
        init=MLPClassifier(max_iter=1000)).fit(d,
                                               [styledict[s] for s in style])
    if type(classifier) == type(GaussianNB()):
        classifier.partial_fit(d, [styledict[s] for s in style], classes=vals)
        for i in range(3):
            data, style = grab_rand_data(cur, length)
            data = svd.fit_transform(data)
            classifier.partial_fit(data, [styledict[s] for s in style])
    elif type(classifier) == type(MLPClassifier()):
        pass

    test_size = 50000
    # print(cur.fetchone())
    data, style = grab_rand_data(cur, test_size)
    print(
        classifier.score(svd.fit_transform(data),
                         [styledict[s] for s in style]))
    # print(classifier1.score(svd.fit_transform(data),[styledict[s] for s in style]))
    # print(test_clf(classifier,classifier1,svd.fit_transform(data),[styledict[s] for s in style]))