how to label features to train by SVM?

조회 수: 4 (최근 30일)
Farman Shah
Farman Shah 2018년 8월 12일
답변: Akshat 2024년 11월 26일 21:32
i have to train SURF features which are stored in a excel file..what is the best way to label? i have 96x20 (48x20 for class A and 48x20 for Class B) dimension of features which i currently stored in a excel sheet..then i made another excel sheet and assign labels as A to 48 rows and next assigned 48 B labels..then i loaded both the files through xlsread in my program..
features_train = xlsread('A_B_features');
[num,labels_train]=xlsread('A_B_labels');
SVMStruct = svmtrain(features_train,labels_train,'Showplot',true);
is this the correct way for svmtrain ?? or should i keep my features and labels into a single file? if yes..how??

답변 (1개)

Akshat
Akshat 2024년 11월 26일 21:32
Your implementation looks correct, except just one thing; "svmtrain" has been deprecated.
As a replacement, "fitcsvm" function has been introduced. Here is an example:
features_train = xlsread('A_B_features');
[num, txt] = xlsread('A_B_labels');
labels_train = categorical(txt);
SVMModel = fitcsvm(features_train, labels_train, 'KernelFunction', 'linear', 'Standardize', true, 'ClassNames', {'A', 'B'});
Here is the documentation link for "fitcsvm":
Hope this helps.

카테고리

Help CenterFile Exchange에서 Quantizers에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by