Binary and Multi-class SVM

버전 3.1.0.1 (21 KB) 작성자: Karl Ezra Pilario
SVMs for classifying 2D data to 2 or more classes, with 3D/2D visualizations as output.
다운로드 수: 1.9K
업데이트 날짜: 2019/4/23

라이선스 보기

This code is intended to help visualize the learned classifier, when training nonlinear C-SVMs for classifying 2-dimensional data (2 features) to 2 or more classes. The case when C = Inf gives the hard margin classifier, while C < Inf gives the 1-norm soft margin classifier. (See Proposition 6.12 and Eq. (7.1) in Ref. [2])

MATLAB's quadprog is used to solve the dual variables, a. The solver is set to use the interior-point method. The Gaussian radial basis function (RBF) kernel is used to generate nonlinear boundaries.

In the Binary classification file (SVMtrial.m): There are 6 different training sets to play with. Outputs are the 3D mesh plot of the classifier and the number of support vectors.

Data sets for binary classification:
(1) TYPICAL
(2) SADDLE
(3) RANDOM
(4) RANDOM, IN ELLIPSE W/ 1 OUTLIER
(5) SPIRAL
(6) IMBALANCED + OVERLAP

In the Multi-class classification file (DAGsvm.m): There are 5 different training sets to play with. Outputs are the 3D mesh plots of the K*(K-1)/2 classifiers, a plot of the training set, and a list of misclassified training samples. You can also have the code estimate the RBF kernel width, according to [4]. I have used the DAG-SVM algorithm from [3] for multi-class classification. The output mesh plots are, thus, arranged in a directed acyclic graph (DAG).

Data sets for multi-class classification:
(1) (3 classes) FISHER IRIS - PETALS
(2) (4 classes) FAN W/ 4 ARMS
(3) (6 classes) RANDOM CIRCLES
(4) (5 classes) SOUTHEAST ASIAN MAP
(5) (7 classes) RAINBOW

You can start by simply running either SVMtrial.m or DAGsvm.m. With these, the user can change certain data points or hyperparameters (kernel width and box constraint) and directly see the effects to the 3D manifold visually. I hope this is useful for educational purposes. This implementation was used in Ref. [5].

References:

[1] Coursera - Machine Learning by Andrew Ng.
[2] Support Vector Machines, Cristianini & Shawe-Taylor, 2000
[3] Platt et al. Large Margin DAGs for Multiclass Classification, Advances in NIPS, 2000.
[4] Karatzoglou et al. Support Vector Machines in R, Journal of Statistical Software, 15(9), 2006.
[5] Eyo et al. "Development of a Real-time Objective Flow Regime Identifier using Kernel Methods", IEEE Trans. on Cybernetics, DOI 10.1109/TCYB.2019.2910257.

인용 양식

Karl Ezra Pilario (2024). Binary and Multi-class SVM (https://www.mathworks.com/matlabcentral/fileexchange/65232-binary-and-multi-class-svm), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2013b
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Classification에 대해 자세히 알아보기
도움

받음: Red Blue Colormap, SVM

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
3.1.0.1

Included a reference in IEEE Trans. on Cybernetics.

3.1.0.0

Changed the title; Made minor code corrections

3.0.0.0

Added multi-class classification using DAG-SVM.

2.3.0.0

Added an imbalanced data set with an overlap between classes.

2.2.0.0

Wrote a red-white-blue colormap code where white must coincide with the decision boundary.

2.1.0.0

Changed the description.

2.0.0.0

Implemented 1-Norm Soft Margin SVM.

1.0.0.0