Testing Neural Network after training data.

2 ビュー (過去 30 日間)
MILLER BIGGELAAR
MILLER BIGGELAAR 2022 年 8 月 20 日
回答済み: Image Analyst 2022 年 8 月 20 日
Hello lovely Mathworks team. :)
I have trained a competitive neural network using the competlayer() function, the network is to classify Iris plants (I know there are examples in Mathworks about this, but it for an assignment), I have allocated 50 out of the 150 sequences to be the training data, leaving 100 to test.
I am unsure how to test the network after training it, below is my code!
clear
clc
test = Iris_data;
label = zeros(150,1);
label(1:50,:) = 1;
label(51:100,:) = 2
label(101:150,:) = 3;
test(:,5) = label;
k = randperm(150,50);
trainset = test(k(1:50),:);
trainsetlabel = test(k,5);
test(k,:) = [];
datalabel = test(:,5);
test = test(:,1:4);
%%%%
compnet = competlayer(3);
compnet = train(compnet,trainset);
outputs = compnet(test)
On the final line I receive an error >>>>
Error using network/sim
Input data sizes do not match net.inputs{1}.size.
It seems to me that the network doesn't like data unless it is the same size as the training set? If you could help figure out how to run my test data that would be greatly appreciated.
Thanks,
Miller
  2 件のコメント
KSSV
KSSV 2022 年 8 月 20 日
Attach your data Iris_data.
MILLER BIGGELAAR
MILLER BIGGELAAR 2022 年 8 月 20 日
Here you go!

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2022 年 8 月 20 日
I believe you'd call either the predict function or the classify or classifyRegions function.

カテゴリ

Help Center および File ExchangeDeep Learning Toolbox についてさらに検索

製品


リリース

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by