How can i do if i want to test the network created with new input ?

2 ビュー (過去 30 日間)
afef
afef 2017 年 5 月 29 日
コメント済み: afef 2017 年 5 月 30 日
Hi , i used the neural Network start (nnstart) for pattern recognition and i got this script
% Solve a Pattern Recognition Problem with a Neural Network
% Script generated by Neural Pattern Recognition app
% Created 29-May-2017 14:25:55
%
% This script assumes these variables are defined:
%
% inputepilepsie - input data.
% targetepilepsie - target data.
x = inputepilepsie;
t = targetepilepsie;
% Choose a Training Function
% For a list of all training functions type: help nntrain
% 'trainlm' is usually fastest.
% 'trainbr' takes longer but may be better for challenging problems.
% 'trainscg' uses less memory. Suitable in low memory situations.
trainFcn = 'trainscg'; % Scaled conjugate gradient backpropagation.
% Create a Pattern Recognition Network
hiddenLayerSize = 10;
net = patternnet(hiddenLayerSize);
% Setup Division of Data for Training, Validation, Testing
net.divideParam.trainRatio = 70/100;
net.divideParam.valRatio = 15/100;
net.divideParam.testRatio = 15/100;
% Train the Network
[net,tr] = train(net,x,t);
% Test the Network
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)
tind = vec2ind(t);
yind = vec2ind(y);
percentErrors = sum(tind ~= yind)/numel(tind);
% View the Network
view(net)
% Plots
% Uncomment these lines to enable various plots.
%figure, plotperform(tr)
%figure, plottrainstate(tr)
%figure, ploterrhist(e)
%figure, plotconfusion(t,y)
%figure, plotroc(t,y)
I want to know how can i do if i want to test the network with new input ?

採用された回答

Greg Heath
Greg Heath 2017 年 5 月 30 日
% Test the Network with new data
ynew = net(xnew);
enew = gsubtract(tnew,ynew);
performancenew = perform(net,tnew,ynew)
tindnew = vec2ind(tnew);
yindnew = vec2ind(ynew);
percentErrorsnew = sum(tindnew ~= yindnew)/numel(tindnew);
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 件のコメント
afef
afef 2017 年 5 月 30 日
Actually i want to evalute the network created and see how it will classify the new data and also please how could i save this network as .mat file then i can directly open the network in matlab software.

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSequence and Numeric Feature Data Workflows についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by