How to save a trained Neural Network with NNTools and classify a new set of data based on it? I don't want to use the testing/validation percentage in the GUI

7 views (last 30 days)
Hi,
I have used NNstart to train a NN based on my data set. I have successfully done that and can see the confusion matrices too. Now I want to save this trained NN and input a new data set for testing the classification result. I don't want to use the GUI's tool to assign a percentage of my training data for testing and validation. Can you experts shed some light on how to achieve that? 1. how to save the trained NN? 2. how to get the confusion matrix based on a new testing set that is analysed against the saved NN? 3. What are the internal parameters/functions Matlab uses for the trained NN?
Cheers, M.

Accepted Answer

Mehrdad Azh
Mehrdad Azh on 11 Sep 2015
write this function in Matlab:
%%%%%%%%%%%%%%%%%%%%%%%%%%
function iris_datasets()
[x,t] = iris_dataset;%this is a data set from Matlab
net = patternnet(5);%hidden layers
net = train(net,x,t);%trains the NN
save net;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%
then in command prompt test a new data set like "new" on the same trained NN:
new2=[5.3;3.3;1.2;0.4];% this is similar to the first column of x, which is classified under the first class in t
sim(net,new2);%simulates NN based on your test set
ans =
0.9996
0.0004
0.0000

More Answers (0)

Community Treasure Hunt

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

Start Hunting!