How to test an input (after training) by using Neural Network ?

2 views (last 30 days)
Hello,
I want to do cancer detection using NN. In the training scheme: 1) Feature_vectors [5,10000] (Five attributes by number of columns based on number of images) 2) target vectors [2,10000] (cancer 1, not cancer 0 - corresponds to relevant features) 3) [net,tr]= train(net,feature_vectors,target_vectors); By doing so, I obtain the net which is essential for testing section.
Now, I want to present an test input image and expect to get an result whether it is possibly cancer image or not cancer: 1) Y = sim(net,feature_vectors); feature_vectors:extracted features from test image and net comes from training.
Is this the correct methodology to test using neural network ? Or How should I do testing part ? How can I get percent rate of cancer results for a test image ? Can I create a confusion matrix likewise in training part ? (But we don't know the target vectors in testing part)
Would you please help me out how to correctly perform test using Neural Network in Matlab ?
Thank you,
Sertan,
  2 Comments
Greg Heath
Greg Heath on 26 May 2015
You cannot obtain error rates without target values. However, you can predict target error rates by dividing data with targets into training, validation and target subsets.
Then if you have inputs with no corresponding targets, you can compare those inputs with the training/validation/test data inputs. If it is similar, then you estimate the quality of the results.
Probably the best way to do this is to cluster the known data. Then you can find the closest cluster.
Hope this helps.
Greg
Sertan Kaya
Sertan Kaya on 26 May 2015
Hi Prof. Greg,
Thanks for responding quickly. Would you please give me a hint how to test with an input image using neural network in my case?
I have searched many websites and I could not found any similar example regarding testing on neural network. Even though I published paper on neural network, Testing on neural network is not crystal clear for me.
Thank you so much for your valued time, Sertan,

Sign in to comment.

Accepted Answer

Greg Heath
Greg Heath on 27 May 2015
You cannot "test" a net without a known input/target pair.
That is why trn/val/tst data division is a default. The divided test subset is in no way involved in the design process. Therefore it yields an UNBIASED estimate of performance on unseen data.
If the data division is random, you can repeat the design with a different division and obtain another UNBIASED estimate.
Because the initial weights are also random, not all designs will be successful. However you can obtain reasonably accurate summary statistics from a sufficient number of multiple designs.
Examples of multiple designs obtained via a double for loop over(outer loop) number of hidden nodes and (inner loop) random initial weights and data divisions can be found by searching on
greg Hmin:dH:Hmax Ntrials
Hope this helps.
Thank you for formally accepting my answer
Greg
  1 Comment
A D. Putriana
A D. Putriana on 14 Jan 2020
hello,
I trained a network using nprtool.
with 180 input, 30 hiddenlayers and 10 target.
my input and target is binary.
x = 180x841
t = 10x841
after that, i used that network for testing (GUI), here is my code :
load target
t=target4 %is the same target i used for trained 10x841
x=newinput %here is the new input 1x841
load net
y = net(x);
e = gsubtract(t,y);
performance = perform(net,t,y)
tind = vec2ind(t);
yind = vec2ind(y);
percentErrors = sum(tind ~= yind)/numel(tind);
and always error :
"error: Input 1 size does not match net.inputs{1}.size"
can anyone help me, what should i do ?
thx before

Sign in to comment.

More Answers (0)

Categories

Find more on Biotech and Pharmaceutical in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!