Doubt in labelling data for machine learning in MATLAB.
4 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello all, I am trying to do classification task of Mrandom -1 and 1 symbols using SVM in MATLAB. The input feature vector is based on energy levels and is shown as and and the correspnding training labels are given as .
I am able to compute the input feature vectors but not getting how to construct the training labels.
Any help in this regard will be highly appreciated.
0 Kommentare
Antworten (1)
Divyam
am 19 Nov. 2024 um 8:33
Assuming that the SVM is used here to map the feature vectors and with their corresponding class labels and 1, the training label vector y can be created as follows:
M_minus = size(E_minus, 1);
M_plus = size(E_plus, 1);
% Create the label vector
labels_minus = -1 * ones(M_minus, 1);
labels_plus = 1 * ones(M_plus, 1);
% Combine the labels
y = [labels_minus; labels_plus];
% Combine the feature vectors
features = [E_minus; E_plus];
% Train SVM model
SVMModel = fitcsvm(features, y);
Using the attached script "SVMTest.m" you can test the code and check out the accuracy and predictions of the SVM.
0 Kommentare
Siehe auch
Kategorien
Mehr zu Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!