Presentation on theme: "Clustering High Dimensional Data Using SVM Tsau Young Lin and Tam Ngo Department of Computer Science San José State University."— Presentation transcript:
Clustering High Dimensional Data Using SVM Tsau Young Lin and Tam Ngo Department of Computer Science San José State University
Overview Introduction Support Vector Machine (SVM) What is SVM How SVM Works Data Preparation Using SVD Singular Value Decomposition (SVD) Analysis of SVD The Project Conceptual Exploration Result Analysis Conclusion Future Work
Introduction World Wide Web No. 1 place for information contains billions of documents impossible to classify by humans Project’s Goals Cluster documents Reduce documents size Get reasonable results when compared to humans classification
Support Vector Machine (SVM) a supervised learning machine outperforms many popular methods for text classification used for bioinformatics, signature/hand writing recognition, image and text classification, pattern recognition, and spam categorization
Motivation for SVM How do we separate these points? with a hyperplane Source: Author’s Research
SVM Process Flow Feature Space Input Space Source: DTREG
Simple SVM Example How would SVM separates these points? use the kernel trick Φ(X 1 ) = (X 1, X 1 2 ) It becomes 2-deminsional ClassX1X Source: Author’s Research
Simple Points in Feature Space ClassX1X1 X12X All points here are support vectors. Source: Author’s Research
SVM Calculation Positive: w x + b = +1 Negative: w x + b = -1 Hyperplane: w x + b = 0 find the unknowns, w and b Expending the equations: w 1 x 1 + w 2 x 2 + b = +1 w 1 x 1 + w 2 x 2 + b = -1 w 1 x 1 + w 2 x 2 + b = 0
Use Linear Algebra to Solve w and b w 1 x 1 + w 2 x 2 + b = +1 w w b = +1 w w b = +1 w 1 x 1 + w 2 x 2 + b = -1 w w b = -1 w w b = -1 Solution is w 1 = -3, w 2 = 1, b = 1 SVM algorithm can find the solution that returns a hyperplane with the largest margin
Use Solutions to Draw the Planes Positive Plane: w x + b = +1 w 1 x 1 + w 2 x 2 + b = +1 -3x 1 + 1x = +1 x 2 = 3x 1 Negative Plane: w x + b = -1 w 1 x 1 + w 2 x 2 + b = -1 -3x 1 + 1x = -1 x 2 = x 1 Hyperplane: w x + b = 0 w 1 x 1 + w 2 x 2 + b = 0 -3x 1 + 1x = 0 x 2 = x 1 X1X1 X2X X1X1 X2X X1X1 X2X Source: Author’s Research
Simple Data Separated by a Hyperplane Source: Author’s Research
LIBSVM and Parameter C LIBSVM: A Java Library for SVM C is very small: SVM only considers about maximizing the margin and the points can be on the wrong side of the plane. C value is very large: SVM will want very small slack penalties to make sure that all data points in each group are separated correctly.
Choosing Parameter C Source: LIBSVM
4 Basic Kernel Types LIBSVM has implemented 4 basic kernel types: linear, polynomial, radial basis function, and sigmoid 0 -- linear: u'*v 1 -- polynomial: (gamma*u'*v + coef0)^degree 2 -- radial basis function: exp(-gamma*|u-v|^2) 3 -- sigmoid: tanh(gamma*u'*v + coef0) We use radial basis function with large parameter C for this project.
Data Preparation Using SVD SVM is excellent for text classification, but requires labeled documents to use for training Singular Value Decomposition (SVD) separates a matrix into three parts; left eigenvectors, singular values, and right eigenvectors decompose data such as images and text. reduce data size We will use SVD to cluster
SVD Example of 4 Documents D1: Shipment of gold damaged in a fire D2: Delivery of silver arrived in a silver truck D3: Shipment of gold arrived in a truck D4: Gold Silver Truck Source: Garcia, E., 2006
Matrix A = U*S*V T D1D2D3D4 a1110 arrived0110 damaged1000 delivery0100 fire1000 gold1011 in1110 of1110 shipment1010 silver0201 truck0111 Given a matrix A, we can factor it into three parts: U, S, and V T. Source: Garcia, E., 2006
Using JAMA to Decompose Matrix A U = S = Source: JAMA (MathWorks and the National Institute of Standards and Technology (NIST))
Using JAMA to Decompose Matrix A V = V T = Matrix A can be reconstructed by multiplying matrices: U*S*V T Source: JAMA
Rank 2 Approximation (Reduced U, S, and V Matrices) U’ = S’ = V’ =
Use Matrix V to Calculate Cosine Similarities calculate cosine similarities for each document. sim(D’, D’) = (D’ D’) / (|D’| |D’|) example, Calculate for D1’: sim(D1’, D2’) = (D1’ D2’) / (|D1’| |D2’|) sim(D1’, D3’) = (D1’ D3’) / (|D1’| |D3’|) sim(D1’, D4’) = (D1’ D4’) / (|D1’| |D4’|)
Result for Cosine Similarities Example result for D1’: sim(D1’, D2’) = (( * ) + ( * )) = ( (0.4652) 2 + ( ) 2 ) * ( (0.6406) 2 + (0.6401) 2 ) sim(D1’, D3’) = (( * ) + ( * )) = ( (0.4652) 2 + ( ) 2 ) * ( (0.5622) 2 + ( ) 2 ) sim(D1’, D4’) = (( * ) + ( * )) = ( (0.4652) 2 + ( ) 2 ) * ( (0.2391) 2 + (0.2450) 2 ) D3 returns the highest value, pair D1 with D3 Do the same for D2, D3, and D4.
Result of Simple Data Set D1: 3 D2: 4 D3: 1 D4: 2 label 1: 1 3 label 2: 2 4 label 1: D1: Shipment of gold damaged in a fire D3: Shipment of gold arrived in a truck label 2: D2: Delivery of silver arrived in a silver truck D4: Gold Silver Truck
Check Cluster Using SVM Now we have the label, we can use it to train with SVM SVM input format on original data: 1 1:1.00 2:0.00 3:1.00 4:0.00 5:1.00 6:1.00 7:1.00 8:1.00 9: : : :1.00 2:1.00 3:0.00 4:1.00 5:0.00 6:0.00 7:1.00 8:1.00 9: : : :1.00 2:1.00 3:0.00 4:0.00 5:0.00 6:1.00 7:1.00 8:1.00 9: : : :0.00 2:0.00 3:0.00 4:0.00 5:0.00 6:1.00 7:0.00 8:0.00 9: : :1.00
Results from SVM’s Prediction Results from SVM’s Prediction on Original Data Documents use for Training Predict the Following Document SVM Prediction Result SVD Cluster Result D1, D2, D3D41.02 D1, D2, D4D31.01 D1, D3, D4D22.02 D2, D3, D4D11.01 Source: Author’s Research
Using Truncated V Matrix We want to reduce data size, more practical to use truncated V matrix SVM input format (truncated V matrix): 1 1: : : : : : : :0.2450
SVM Result From Truncated V Matrix Results from SVM’s Prediction on Reduced Data Documents use for Training Predict the Following Document SVM Prediction Result SVD Cluster Result D1, D2, D3D42.02 D1, D2, D4D31.01 D1, D3, D4D22.02 D2, D3, D4D11.01 Source: Author’s Research Using truncated V matrix gives better results.
Vector Documents on a Graph D4 D2 D1 D3 Source: Author’s Research
Program Process Flow use the previous methods on larger data sets compare the results with that of humans classification Program Process Flow
Conceptual Exploration Reuters a collection of newswire articles that have been human-classified by Carnegie Group, Inc. and Reuters, Ltd most widely used data set for text categorization
Result Analysis Clustering with SVD vs. Humans Classification First Data Set First Data Set from Reuters (200 x 9928) # of Naturally Formed Cluster using SVD SVD Cluster Accuracy SVM Prediction Accuracy Rank %65.0% Rank %82.0% Rank %54.0% Rank %51.5% Rank %46.5% Rank %54.0% Rank %58.5% Rank %51.5% Rank %58.5% Source: Author’s Research
Result Analysis Clustering with SVD vs. Humans Classification Second Data Set Second Data Set from Reuters (200 x 9928) # of Naturally Formed Cluster using SVD SVD Cluster Accuracy SVM Prediction Accuracy Rank %84.5% Rank %84.5% Rank %85.5% Rank %81.0% Rank %50.0% Rank %83.5% Rank %79.0% Rank %25.5% Rank %47.0% Source: Author’s Research
Result Analysis highest percentage accuracy for SVD clustering is 81.5% lower rank value seems to give better results SVM predicts about the same accuracy as SVD cluster
Result Analysis: Why results may not be higher? humans classification is more subjective than a program reducing many small clusters to only 2 clusters by computing the average may decrease the accuracy
Conclusion Showed how SVM works Explore the strength of SVM Showed how SVD can be used for clustering Analyzed simple and complex data the method seems to cluster data reasonably Our method is able to: reduce data size (by using truncated V matrix) cluster data reasonably classify new data efficiently (based on SVM) By combining known methods, we created a form of unsupervised SVM
Future Work extend SVD to very large data set that can only be stored in secondary storage looking for more efficient kernels of SVM
References Bennett, K. P., & Campbell, C. (2000). Support Vector Machines: Hype or Hellelujah?. ACM SIGKDD Explorations. VOl. 2, No. 2, 1-13 Chang, C & Lin, C. (2006). LIBSVM: a library for support vector machines, Retrived November 29, 2006, from Cristianini, N. (2001). Support Vector and Kernel Machines. Retrieved November 29, 2005, from Cristianini, N., & Shawe-Taylor, J. (2000). An Introduction to Support Vector Machines. Cambridge UK: Cambridge University Press Garcia, E. (2006). SVD and LSI Tutorial 4: Latent Semantic Indexing (LSI) How-to Calculations. Retrieved November 28, 2006, from how-to-calculations.html Guestrin, C. (2006). Machine Learning. Retrived November 8, 2006, from Hicklin, J., Moler, C., & Webb, P. (2005). JAMA : A Java Matrix Package. Retrieved November 28, 2006, from
References Joachims, T. (1998). Text Categorization with Support Vector Machines: Learning with Many Relevant Features. Joachims, T. (2004). Support Vector Machines. Retrived November 28, 2006, from Reuters Text Categorization Test Collection. Retrived November 28, 2006, from SVM - Support Vector Machines. DTREG. Retrived November 28, 2006, from Vapnik, V. N. (2000, 1995). The Nature of Statistical Learning Theory. Springer-Verlag New York, Inc.