Esempio n. 1
0
 def naive_bayes_classify(self):
     nb = NaiveBayesClassifier()
     nb.train(self.X_train, self.y_train)
     predictions = nb.predict(self.X_test)
     accuracy = str(self.main.accuracy(self.y_test, predictions))
     accuracy = accuracy[0:4]
     self.naive_bayes_acc_label.setText(accuracy)
Esempio n. 2
0
    def classify_custom_input(self, custom_input_vector):
        nb = NaiveBayesClassifier()
        nb.train(self.X_train, self.y_train)
        prediction = nb.predict([custom_input_vector])
        self.custom_text_nb_label.setText(str(prediction[0]))

        knn = KNNClassifier()
        prediction = knn.predict_classification(self.X_train, self.y_train,
                                                [custom_input_vector])
        self.custom_text_knn_label.setText(str(prediction[0]))

        rf = SklearnRandomForest()
        prediction = rf.random_forest(self.X_train, self.y_train,
                                      [custom_input_vector])
        self.custom_text_dt_label.setText(str(prediction[0]))

        dt = SklearnDecisionTree()
        prediction = dt.decision_tree(self.X_train, self.y_train,
                                      [custom_input_vector])
        self.custom_text_rf_label.setText(str(prediction[0]))