Skip to content
Nikii1118 edited this page Feb 18, 2019 · 12 revisions

Q1 Implement Naïve Bayes method using scikit-learn Use iris dataset available in https://umkc.box.com/s/pm3cebmhxpnczi6h87k2lwwiwdvtxyk8Use cross validation to create training and testing part Evaluate the model on testing part

Solution 1: Naive Bayes is one of the simplest supervised learning algorithm. It is a statistical classification technique. It is fast,accurate and reliable algorithm.

Loading the data into from Iris.csv


capture1q1

OUTPUT:-


output1

Train, Testing and Evaluating the Naive bayes using GuassianNb.


capture2q2

OUTPUT:


output12

Q2. Implement linear SVMmethodusing scikit libraryUse the samedataset above.

Solution 2: We use Linear SVM that is support Vector machine.

Using SVM we are training, testing and evaluating the data.


icp4_2

Output


output21

Q3. Compare the results and report accuracy, precision, F-measure and Recall Solution 3 is already implemented in solution 1 and solution 2 code.

Results:-

Naive Bayes algorithm: The model is very accurate in calculating precision score of iris setosa and versicolor that is Positive/All=1.0. For virginica it is low that is 0.9/14. But accuracy score is 0.97.

SVM: The model is very accurate in claculating the precision score of setosa and virginica that is Positive/ALL=1.0. For versicolor, it is very low. Accuracy score also differs with test size that is 0.96

Clone this wiki locally