how to train svm classifier by 3 features

조회 수: 4 (최근 30일)
ANANDHI
ANANDHI 2013년 9월 26일
답변: Sameer 2025년 5월 29일
In my project I need to classify benign tumor and malignant tumor using svm classifier.I have extracted 3 features from each benign tumor and malignant tumor.But I dont know how to train non linear gaussian kernelfunction in svm using three features. I am beginner to matlab. please help me with matlab code.
Thank you

답변 (1개)

Sameer
Sameer 2025년 5월 29일
To train a non-linear SVM classifier using a Gaussian kernel (also called RBF kernel) in MATLAB, the "fitcsvm" function can be used with the "KernelFunction" set to "rbf".
Assuming the features are stored in a matrix "features" and the corresponding class labels (e.g., 0 for benign and 1 for malignant) are stored in a vector "labels", the training can be done like this:
SVMModel = fitcsvm(features, labels, 'KernelFunction', 'rbf');
Each row in "features" should represent one sample (tumor), and each column should represent one of the three extracted features. The "labels" vector should have the same number of elements as the number of rows in "features".
This will train an SVM with a Gaussian (RBF) kernel using the three features provided.
Below is the MathWorks documentation link to know more about "fitcsvm" :
Hope this helps!

카테고리

Help CenterFile Exchange에서 Statistics and Machine Learning Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by