slipting sata manually into train, validation and test sets, then using fitcnet and testing accuracy

4 次查看(过去 30 天)
Hey guys!
So, I am trying to design a neural network to classify subjects into three classes via fitcnet. There is a txt file that consists of 1092 rows and 14 collums (1092 x 14). The 14th collumn has the class of the sets either A, B or C and I specificly want the first 450 x 14 of them to be the training set , the next 150 x 14 to be the validation data and the rest of them to be the test set. Here is my code:
clc; clear all;
creditrating = readtable("STATSTOTAL.txt");
creditrating = removevars(creditrating,"Row");
creditrating.class = categorical(creditrating.class, ...
["A","B","C"],"Ordinal",true);
rng("default") % For reproducibility of the partition
creditTrain = creditrating(1:450 ,:);
creditVal=creditrating (451:600, :);
creditTest= creditrating (601:end, :);
It works fine!
****The thing is, how do I use the fitcnet function and how do I test the accuracy now that I have the three sets?
Without the validation data I did this following the example in matlab-help:
Mdl = fitcnet(creditTrain,"class")
testAccuracy = 1 - loss(Mdl,creditTest,"class", ...
"LossFun","classiferror")
But how do i change them now?
Thank you in advance!!

回答(1 个)

KSSV
KSSV 2022-8-21

Community Treasure Hunt

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

Start Hunting!

Translated by