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

2 views (last 30 days)
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!!

Answers (1)

KSSV
KSSV on 21 Aug 2022

Community Treasure Hunt

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

Start Hunting!