Doubt in labelling data for machine learning in MATLAB.

4 次查看(过去 30 天)
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.

回答(1 个)

Divyam
Divyam 2024-11-19,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.

类别

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