Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit b0be291

Browse files
committed
Added GNB, LDA, and QDA classifiers
1 parent 5999de5 commit b0be291

File tree

5 files changed

+52
-4
lines changed

5 files changed

+52
-4
lines changed

‎README.md‎

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,15 @@ following:
2323
* Random Forest (RF)
2424
* K-Nearest Neighbor (KNN)
2525
* Multi-Layer Perceptron (ML)
26+
* Gaussian Naive Bayes (GNB)
27+
* Linear Discriminant Analysis (LDA)
28+
* Quadratic Discriminant Analysis (QDA)
2629

2730
Training and validation time, and the accuracy of each classifier is
28-
displayed. Most classifier were run with their default tuning values,
29-
however tuning was carriedon those classifier that fell well below 90%
30-
accuracy for their defaults, such of Extra Trees and Random Forsest
31-
(initially in the 75 - 78% region).
31+
displayed. Most classifiers were run with their default tuning values,
32+
however tuning was carried, where possible, on those classifiers that
33+
fell well below 90% accuracy for their defaults, such of Extra Trees
34+
and Random Forsest (initially in the 75 - 78% region).
3235

3336
A summary of the results is as follows (training/test time, accuracy):
3437

@@ -37,6 +40,9 @@ A summary of the results is as follows (training/test time, accuracy):
3740
* RF: 16.47 sec, 90.8%
3841
* KNN: 2.2 sec, 91.5%
3942
* MLP: 13.83 sec, 97.1%
43+
* GNB: 1.1 sec, 91.8%
44+
* LDA: 4.95 sec, 91.0%
45+
* QDA: 0.84 sec, 5.3% (Variables are collinear warning!)
4046

4147
Note that these results vary between runs, and are just representative.
4248

@@ -80,3 +86,15 @@ laptop.
8086
## Multi-Layer Perceptron
8187

8288
![caltech MLP confusion matrix](assets/mlp_cm.png)
89+
90+
## Gaussian Naive Bayes
91+
92+
![caltech GNB confusion matrix](assets/gnb_cm.png)
93+
94+
## Linear Discriminant Analysis
95+
96+
![caltech LDA confusion matrix](assets/lda_cm.png)
97+
98+
## Quadratic Discriminant Analysis
99+
100+
![caltech QDA confusion matrix](assets/qda_cm.png)

‎assets/gnb_cm.png‎

116 KB
Loading[フレーム]

‎assets/lda_cm.png‎

116 KB
Loading[フレーム]

‎assets/qda_cm.png‎

120 KB
Loading[フレーム]

‎inceptionv3_svm_classifier.py‎

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
from sklearn.ensemble import RandomForestClassifier, ExtraTreesClassifier
88
from sklearn.neighbors import KNeighborsClassifier
99
from sklearn.neural_network import MLPClassifier
10+
from sklearn.naive_bayes import GaussianNB
11+
from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
12+
from sklearn.discriminant_analysis import QuadraticDiscriminantAnalysis
1013
import numpy as np
1114
import matplotlib.pyplot as plt
1215
import pickle
@@ -231,3 +234,30 @@ def run_classifier(clfr, x_train_data, y_train_data, x_test_data, y_test_data, a
231234
clf = MLPClassifier()
232235
run_classifier(clf, X_train, y_train, X_test, y_test, "CNN-MLP Accuracy: {0:0.1f}%",
233236
"Multi-layer Perceptron Confusion matrix")
237+
238+
# GaussianNB defaults:
239+
# priors=None
240+
241+
# classify the images with a Gaussian Naive Bayes Classifier
242+
print('Gaussian Naive Bayes Classifier starting ...')
243+
clf = GaussianNB()
244+
run_classifier(clf, X_train, y_train, X_test, y_test, "CNN-GNB Accuracy: {0:0.1f}%",
245+
"Gaussian Naive Bayes Confusion matrix")
246+
247+
# LinearDiscriminantAnalysis defaults:
248+
# solver=’svd’, shrinkage=None, priors=None, n_components=None, store_covariance=False, tol=0.0001
249+
250+
# classify the images with a Quadratic Discriminant Analysis Classifier
251+
print('Linear Discriminant Analysis Classifier starting ...')
252+
clf = LinearDiscriminantAnalysis()
253+
run_classifier(clf, X_train, y_train, X_test, y_test, "CNN-LDA Accuracy: {0:0.1f}%",
254+
"Linear Discriminant Analysis Confusion matrix")
255+
256+
# QuadraticDiscriminantAnalysis defaults:
257+
# priors=None, reg_param=0.0, store_covariance=False, tol=0.0001, store_covariances=None
258+
259+
# classify the images with a Quadratic Discriminant Analysis Classifier
260+
print('Quadratic Discriminant Analysis Classifier starting ...')
261+
clf = QuadraticDiscriminantAnalysis()
262+
run_classifier(clf, X_train, y_train, X_test, y_test, "CNN-QDA Accuracy: {0:0.1f}%",
263+
"Quadratic Discriminant Analysis Confusion matrix")

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /