Пример #1
0
print("Data imported.")

###############################################################################

###############################################################################
# Latent Semantic Analysis
###############################################################################
lsa = LSA(MAX_GRAM, MIN_FREQ, P_EIG)
lsa_results = lsa.process_utterances_through_lsa(db.human_utterances)
print("LSA Results computed.")
###############################################################################

test_score = []
###############################################################################
# Data Division
sets = Set(lsa_results, db.robot_ids, db.human_utterances, n_splits=5)
###############################################################################

###############################################################################
# Naive Bayes Classifier
###############################################################################
for i in range(len(sets.lsa_vectors_train)):
    naive = NaiveBayesClassifier(alpha=ALPHA)
    naive.learning_phase(numpy.array(sets.lsa_vectors_train[i]),
                         sets.robot_ids_train[i])
    ###############################################################################

    ###############################################################################
    # Computing the results of the experiment
    ###############################################################################
    test_score.append(
        print("total phrases per class = ", n_elements)
        print("total number of classes = ", count)

        ###############################################################################

        ###############################################################################
        # Latent Semantic Analysis
        ###############################################################################
        lsa = LSA(MAX_GRAM, MIN_FREQ, P_EIG)
        lsa_results = lsa.process_utterances_through_lsa(x)
        print("LSA Results computed.")
        ###############################################################################

        ###############################################################################
        # Data Division
        sets = Set(lsa_results, numpy.array(y), numpy.array(x), n_splits=5)
        ###############################################################################

        ###############################################################################
        # Naive Bayes Classifier
        ###############################################################################
        for i in range(len(sets.lsa_vectors_train)):
            naive = NaiveBayesClassifier(alpha=ALPHA)
            naive.learning_phase(numpy.array(sets.lsa_vectors_train[i]),
                                 sets.robot_ids_train[i])
            ###############################################################################

            ###############################################################################
            # Computing the results of the experiment
            ###############################################################################
            test_score.append(