Exemplo n.º 1
0
def main():
    for data_set in tqdm(util.feature_sets):
        X_train, X_test, Y_train, Y_test = util.load_movie_data(data_set)
        model = OneVsRestClassifier(QuadraticDiscriminantAnalysis(), n_jobs=-1)
        model.fit(X_train, Y_train)
        prediction = model.predict(X_test)
        filename = data_set + '_output_one_vs_rest_qda.txt'
        util.output_to_file(data_set, filename, Y_test, prediction)

        util.write_model(model, data_set + '_one_vs_rest_qda')
Exemplo n.º 2
0
def main():
    for data_set in tqdm(util.feature_sets):
        X_train, X_test, Y_train, Y_test = util.load_movie_data(data_set)
        model = KNeighborsClassifier()
        model.fit(X_train, Y_train)
        prediction = model.predict(X_test)
        filename = data_set + '_output_kneighbors.txt'
        util.output_to_file(data_set, filename, Y_test, prediction)

        util.write_model(model, data_set + '_kneighbors')
Exemplo n.º 3
0
def main():
    for data_set in tqdm(util.feature_sets):
        X_train, X_test, Y_train, Y_test = util.load_movie_data(data_set)
        model = RandomForestClassifier(n_estimators=100, n_jobs=-1)
        model.fit(X_train, Y_train)
        prediction = model.predict(X_test)
        filename = data_set + '_output_random_forest.txt'
        util.output_to_file(data_set, filename, Y_test, prediction)

        util.write_model(model, data_set + '_random_forest')
Exemplo n.º 4
0
def main():
    for data_set in tqdm(util.feature_sets):    
        X_train, X_test, Y_train, Y_test = util.load_movie_data(data_set)
        model = OneVsRestClassifier(DecisionTreeClassifier(max_depth=100), n_jobs = -1)
        model.fit(X_train, Y_train)
        prediction = model.predict(X_test)
        filename = data_set + '_output_one_vs_rest_tree.txt'
        util.output_to_file(data_set, filename, Y_test, prediction)
        
        util.write_model(model, data_set + '_one_vs_rest_tree')
Exemplo n.º 5
0
def main():
    for data_set in tqdm(util.feature_sets):
        X_train, X_test, Y_train, Y_test = util.load_movie_data(data_set)
        model = OneVsRestClassifier(GaussianNB(), n_jobs=-1)
        model.fit(X_train, Y_train)
        prediction = model.predict(X_test)
        filename = data_set + '_output_one_vs_rest_gasussian_bayes.txt'
        util.output_to_file(data_set, filename, Y_test, prediction)

        util.write_model(model, data_set + '_one_vs_rest_gasussian_bayes')
Exemplo n.º 6
0
def main():
    for data_set in tqdm(util.feature_sets):
        X_train, X_test, Y_train, Y_test = util.load_movie_data(data_set)
        model = OneVsRestClassifier(SGDClassifier(max_iter=1000, tol=1e-3),
                                    n_jobs=-1)
        model.fit(X_train, Y_train)
        prediction = model.predict(X_test)
        filename = data_set + '_output_one_vs_rest_svm.txt'
        util.output_to_file(data_set, filename, Y_test, prediction)

        util.write_model(model, data_set + '_one_vs_rest_svm')