def generate_statistics_with_weighted_majorityvote_ensamble( startingpoint=5, endpoint=50, skips=5, iterations=5, topn=10): results = [] for i in range(startingpoint, endpoint, skips): for j in range(0, iterations): if (os.path.isfile( "weighted_majority_vote_Ensamble_test_results.csv")): f = open("weighted_majority_vote_Ensamble_test_results.csv", "a") else: f = open("weighted_majority_vote_Ensamble_test_results.csv", "w") ensamble_model = BS.boot_strap_aggregator() dir_path = "questions-words.txt" right, wrong = ensamble_model.accuracy(dir_path, number_of_models=i, predictor_method=3) res = [[i, topn, right, wrong]] print(res) results.append(res) np.savetxt(f, res, delimiter=',') f.close() print('iteration finished') print(results) return results
def generate_statistics_weight_based_on_total_oov_ignore_oov_human_similarity( startingpoint=5, endpoint=50, skips=5, iterations=5, topn=10): results = [] for i in range(startingpoint, endpoint, skips): for j in range(0, iterations): if (os.path.isfile( "weight_based_on_total_oov_ignore_oov_human_similarity_stats.csv" )): f = open( "weight_based_on_total_oov_ignore_oov_human_similarity_stats.csv", "a") else: f = open( "weight_based_on_total_oov_ignore_oov_human_similarity_stats.csv", "w") ensamble_model = BS.boot_strap_aggregator() dir_path = "wordsim353.tsv" spearman_result, pearson_result = ensamble_model.evaluate_word_pairs( dir_path, number_of_models=i, similarity_model_type=3) res = [[ i, topn, spearman_result[0], spearman_result[1], pearson_result[0], pearson_result[1] ]] print(res) results.append(res) np.savetxt(f, res, delimiter=',') f.close() print('iteration finished') print(results) return results
def oov_test(startingpoint, endpoint, skips, iterations): results = [] for i in range(startingpoint, endpoint, skips): for j in range(0, iterations): if (os.path.isfile("oov_test.csv")): f = open("oov_test.csv", "a") else: f = open("oov_test.csv", "w") ensamble_model = BS.boot_strap_aggregator() dir_path = "questions-words.txt" oov = ensamble_model.oov_test(questions=dir_path, number_of_models=i) res = [[i, oov]] print(res) results.append(res) np.savetxt(f, res, delimiter=',') f.close() print('iteration finished')
def word_sim_test(): ensamble = EP.simple_ensamble( generate_array_of_all_trained_model_specification) dir_path = os.path.dirname( os.path.realpath(__file__)) + "/TestingSet/wordsim353.tsv" ensamble.evaluate_word_pairs(dir_path, similarity_model_type=0)
def question_word_test(): ensamble = EP.boot_strap_aggregator( generate_array_of_all_trained_model_specification()) dir_path = "questions-words.txt" #ensamble.set_weights([1, 0.5]) ensamble.accuracy(dir_path, predictor_method=3, number_of_models=2)