Untitled

mail@pastecode.io avatar
unknown
matlab
a year ago
813 B
6
Indexable
Never
%Fai preprocessing ecc...

% Estrai le features usando AlexNext
features = activations(alexnet, images, 'fc7', 'OutputAs', 'rows');

% Splitti sempre i dati in training e test sets
[train_ind, test_ind] = holdout(numel(images), 0.7);
train_features = features(train_ind, :);
train_labels = labels(train_ind);
test_features = features(test_ind, :);
test_labels = labels(test_ind);

% Alleni il classificatore
classifier = fitcecoc(train_features, train_labels);

% Classifichi il test set
predictions = predict(classifier, test_features);

% Calcolo confusion Matrix
confusion = confusionmat(test_labels, predictions);

% Visualizzi la matrice di confusione
plotconfusion(test_labels, predictions);

% Calcolo le performance metrics per ogni classificatore
report = classification_report(test_labels, predictions);