Presentation is loading. Please wait.

Presentation is loading. Please wait.

A Fast and Scalable Nearest Neighbor Based Classification

Similar presentations


Presentation on theme: "A Fast and Scalable Nearest Neighbor Based Classification"— Presentation transcript:

1 A Fast and Scalable Nearest Neighbor Based Classification
Taufik Abidin and William Perrizo Department of Computer Science North Dakota State University

2 Outline Nearest Neighbors Classification Problems
SMART TV (SMall Absolute diffeRence of ToTal Variation): A Fast and Scalable Nearest Neighbors Classification Algorithm SMART TV in Image Classification

3 Search for the K-Nearest Neighbors
Classification Given a (large) TRAINING SET, R(A1,…,An, C), with C=CLASSES and (A1…An)=FEATURES Classification task is: to label the unclassified objects based on the pre-defined class labels of objects in the training set Prominent classification algorithms: SVM, KNN, Bayesian, etc. Training Set Search for the K-Nearest Neighbors Vote the class Unclassified Object

4 Problems with KNN Finding k-nearest neighbors is expensive when the training set contains millions of objects (very large training set) The classification time is linear to the size of the training set Can we make it faster and scalable?

5 P-Tree Vertical Data Structure
A1 A2 A3 A4 R[A1] R[A2] R[A3] R[A4] = R11 R12 R13 R21 R22 R23 R31 R32 R33 R41 R42 R43 The construction steps of P-trees: 1. Convert the data into binary 2. Vertically project each attribute 3. Vertically project each bit position 4. Compress each bit slice into a P-tree 0 0 P11 P12 P13 P21 P22 P23 P31 P32 P33 P41 P42 P43 0 1 10 1 0 01 1 0 0 1 ^

6 Total Variation The Total Variation of a set X about (the mean), , measures total squared separation of objects in X about , defined as follows: TV(X,)=TV(X,x33) 1 2 3 4 5 X TV g a- a Y

7 Total Variation (Cont.)
21 x x 0 + 21 x x 1 = 5 2 3 1 0 1 1 21 x x 1 = 5

8 Total Variation (Cont.)

9 Total Variation (Cont.)

10 Total Variation (Cont.)

11 The Independency of RC The root count operations are independence from , which allows us to run the operations once in advance and retain the count results In classification task, the sets of classes are known and unchanged. Thus, the total variation of an object about its class can be pre-computed

12 Overview of SMART-TV Compute Root Count Store the root count
Measure TV of each object Large Training Set Store the root count and TV values Preprocessing Phase Unclassified Object Approximate the candidate set of NNs Search the K-nearest neighbors for the candidate set Vote Classifying Phase

13 Preprocessing Phase Compute the root counts of each class Cj,  j  number of classes. Store the results. Complexity: O(kdb2) where k is the number of classes, d is the total of dimensions, and b is the bit-width. Compute , 1 j  number of classes. Complexity: O(n) where n is the cardinality of the training set. Also, retain the results.

14 Classifying Phase Stored values of root count and TV Classifying Phase
Unclassified Object Approximate the candidate set of NNs Search the K-nearest neighbors from the candidate set Vote Classifying Phase

15 Classifying Phase For each class Cj with nj objects, 1  j  number of classes, do the followings: a. Compute , where is the unclassified object Find hs objects in Cj such that the absolute difference between the total variation of the objects in Cj and the total variation of about Cj are the smallest, i.e. Let A be an array and , where Store all objectIDs in A into TVGapList

16 Classifying Phase (Cont.)
For each objectIDt, 1 t  Len(TVGapList) where Len(TVGapList) is equal to hs times the total number of classes, retrieve the corresponding object features from the training set and measure the pair-wise Euclidian distance between and , i.e. and determine the k nearest neighbors of Vote the class label for using the k nearest neighbors

17 Dataset KDDCUP-99 Dataset (Network Intrusion Dataset)
4.8 millions records, 32 numerical attributes 6 classes, each contains >10,000 records Class distribution: Testing set: 120 records, 20 per class 4 synthetic datasets (randomly generated): 10,000 records (SS-I) 100,000 records (SS-II) 1,000,000 records (SS-III) 2,000,000 records (SS-IV) Normal 972,780 IP sweep 12,481 Neptune 1,072,017 Port sweep 10,413 Satan 15,892 Smurf 2,807,886

18 Dataset (Cont.) OPTICS dataset
8,000 points, 8 classes (CL-1, CL-2,…,CL-8) 2 numerical attributes Training set: 7,920 points Testing set: 80 points, 10 per class

19 Dataset (Cont.) IRIS dataset 150 samples
3 classes (iris-setosa, iris-versicolor, and iris-virginica) 4 numerical attributes Training set: 120 samples Testing set: 30 samples, 10 per class

20 Speed and Scalability Speed and Scalability Comparison (k=5, hs=25)
Algorithm x 1000 cardinality 10 100 1000 2000 4891 SMART-TV 0.14 0.33 2.01 3.88 9.27 P-KNN 0.89 1.06 3.94 12.44 30.79 KNN 0.39 2.34 23.47 49.28  NA Machine used: Intel Pentium 4 CPU 2.6 GHz machine, 3.8GB RAM, running Red Hat Linux

21 Classification Accuracy (Cont.)
Classification Accuracy Comparison (SS-III), k=5, hs=25 Algorithm Class TP FP P R F SMART-TV normal 18 1.00 0.90 0.95 ipsweep 20 1 0.98 neptune portsweep satan 17 2 0.85 0.87 smurf 4 0.83 0.91 P-KNN 15 0.75 0.86 14 0.93 0.70 0.80 5 0.89 KNN 3 0.94

22 Overall Classification Accuracy Comparison
Overall Accuracy Overall Classification Accuracy Comparison Datasets SMART-TV PKNN KNN IRIS 0.97 0.71 OPTICS 0.96 0.99 SS-I 0.72 0.89 SS-II 0.92 0.91 SS-III 0.94 SS-IV NI 0.93 NA

23 Outline Nearest Neighbors Classification Problems
SMART TV (SMall Absolute diffeRence of ToTal Variation): A Fast and Scalable Nearest Neighbors Classification Algorithm SMART TV in Image Classification

24 Image Preprocessing We extracted color and texture features from the original pixel of the images Color features: We used HVS color space and quantized the images into 52 bins i.e. (6 x 3 x 3) bins Texture features: we used multi-resolutions Gabor filter with two scales and four orientation (see B.S. Manjunath, IEEE Trans. on Pattern Analysis and Machine Intelligence, 1996)

25 Image Dataset - 54 from color features - 16 from texture features
Corel images ( 10 categories Originally, each category has 100 images Number of feature attributes: - 54 from color features - 16 from texture features We randomly generated several bigger size datasets to evaluate the speed and scalability of the algorithms. 50 images for testing set, 5 for each category

26 Image Dataset

27 Example on Corel Dataset

28 Results Class SMART-TV KNN k=3 k=5 k=7 hs=15 hs=25 hs=35 C1 0.69 0.72
0.75 0.74 0.73 0.78 0.81 0.77 0.79 C2 0.64 0.60 0.59 0.62 0.68 0.63 0.66 C3 0.65 0.67 0.76 0.57 0.70 C4 0.84 0.87 0.90 0.88 C5 0.91 0.92 0.93 0.89 0.94 C6 0.61 0.71 C7 0.85 C8 0.96 C9 0.52 0.43 0.45 0.54 C10 0.82

29 Results Classification Time

30 Results Preprocessing Time

31 Summary A nearest-based classification algorithm that starts its classification steps by approximating a number of candidates of nearest neighbors The absolute difference of total variation between data points in the training set and the unclassified point is used to approximate the candidates The algorithm is fast, and it scales well in very large dataset. The classification accuracy is very comparable to that of KNN algorithm.


Download ppt "A Fast and Scalable Nearest Neighbor Based Classification"

Similar presentations


Ads by Google