print("Creating BAYES class...") bayes = Bayes(dictionary1, dictionary0, testing_set) print("Bayes class created") print("Predicting sentiments for testing set...") nb_undetermined = bayes.predict_sentiments(LAPLACE_SMOOTHING, pos_spl_nb, neg_spl_nb) print("Prediction of sentiments for testing set done") print( f"Number of tweets with undetermined sentiments : {nb_undetermined}" ) print( "Comparing sentiments from the dataset with predicted sentiments..." ) metrics, conf_matrix = bayes.compare_sentiments() bayes.print_metrics() bayes.print_confusion_matrix() bayes.plot_confusion_matrix() # --------- VALIDATION METHOD = CROSSVALIDATION ---------- else: print("Proceeding with cross-validation algorithm") total_metrics = [0, 0, 0, 0] total_conf_matrix = [0, 0, 0, 0] for set_number in range(1, K + 1): training_pos_set, training_neg_set, testing_set = dataset.create_sets_cv( set_number, K)