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')
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')
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')
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')
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')
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')