Doubt in labelling data for machine learning in MATLAB.

4 visualizzazioni (ultimi 30 giorni)
charu shree
charu shree il 19 Lug 2023
Risposto: Divyam il 19 Nov 2024 alle 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.

Risposte (1)

Divyam
Divyam il 19 Nov 2024 alle 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.

Categorie

Scopri di più su Statistics and Machine Learning Toolbox in Help Center e File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by