Doubt in labelling data for machine learning in MATLAB.

4 Ansichten (letzte 30 Tage)
charu shree
charu shree am 19 Jul. 2023
Beantwortet: Divyam am 19 Nov. 2024 um 8:33
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.

Antworten (1)

Divyam
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.

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!

Translated by