Thread Subject: [HELP] Unknow error in my neural network

Subject: [HELP] Unknow error in my neural network

From: Tak

Date: 16 Nov, 2008 13:57:01

Message: 1 of 6

My code is design for image classification, skin cancer one. Should I put all the benign and malignant image into training session? And how to set the target? I saw some people do malignant as [0.9 0.1] and benign as [0.1 0.9] But I not understand how does it mean.




This is the error message:
??? This index expression yields only one result.

Error in ==> ClassificationBNN at 54
[net,tr,out,E] = train(net, train.P, [0.9, 0.1]);

Here is the code:
net = newff(train.P, train.T, [15, 1], {'tansig', 'purelin'}, 'trainlm');
   
net.performFcn = 'mae'; % Mean absolute error performance function
net.trainParam.goal = 0.01; % Performance goal
net.trainParam.show = NaN; % Epochs between displays (NaN for no displays)
net.trainParam.epochs = 1000; % Maximum number of epochs to train
net.trainParam.lr = 0.05; % Learning rate
[net,tr,out,E] = train(net, train.P, train.T);

Where
train.P is a [70x358 double]
train.T is a [1x213 double]

Subject: Unknow error in my neural network

From: Greg Heath

Date: 17 Nov, 2008 00:45:54

Message: 2 of 6

On Nov 16, 8:57 am, "Tak " <lauho...@hotmail.com> wrote:
> My code is design for image classification, skin cancer one.
> Should I put all the benign and malignant image into training session?
> And how to set the target? I saw some people do malignant as
> [0.9 0.1] and benign as [0.1 0.9] But I not understand how does it mean.

For a classifier with only two classes you can use one output
with the target 1 for malignant and 0 for benign.

For Ntrn training cases, and I input variables,

size(train.P) = [ I Ntrn]
size(train.T) = [ 1 Ntrn]

the size of the net will be I-H-1 where H is the
number of hidden nodes. H is determined by trial and error.

Using defaults,

net = newff(train.P, train.T, H);

[net,tr,Y,E] = train(net, train.P, train.T);

net.trainParam.goal = var(train.T)/100
net.trainParam.show = 10;

Go to Google groups and search on

greg-heath pretraining-advice
greg-heath Neq Nw

Hope this helps.

Greg

Subject: Unknow error in my neural network

From: Tak

Date: 17 Nov, 2008 20:22:02

Message: 3 of 6

Thx Greg. And here I have more questions about it.

1) How can I set the "target 1 for malignant and 0 for benign"?

2) Should I include all benign and malignant image inside the train.P?

3) Currently I set the target class as the mean of the train image,
therefore, train.T = mean(train.P, 1);
where Row:Features of the images, Column:Images

4) Should i set row as image and column as feature? Since my dataset, no of features is 80 and no of image is 350. That will cause error due to dataset has more rows than columns.

Subject: [HELP] Unknow error in my neural network

From: Tak

Date: 18 Nov, 2008 02:37:07

Message: 4 of 6

Continuous from above question, normally [x, y] = size(dataset), row(x) or column(y) should be go to the input nodes of the network? for example, I have 60features (row(x) or column(y) value!?), is that mean my input nodes will be 60?

Also because I am a newbie to Matlab and nntool, How can I find out the accuracy of the trainned network?

For example, now I have new image which is not include of the training examples. Should I use "sim" function to test it?

And I have 300 images for training, is there any efficiency way to test them all which is classify correctly? a plot function or I have to write my own equation?

Many thanks,
Tak

Subject: Unknow error in my neural network

From: Greg Heath

Date: 2 Dec, 2008 23:06:57

Message: 5 of 6

On Nov 17, 3:22=A0pm, "Tak " <lauho...@hotmail.com> wrote:
> Thx Greg. And here I have more questions about it.
>
> 1) How can I set the "target 1 for malignant and 0 for benign"?

For each column in train.P put either a 1 or a zer0 in train.T

> 2) Should I include all benign and malignant image inside the train.P?

No, you need to split your data into a training set and a test set.

or a training, validation and test set. These are defined in the
comp.ai.neural-nets FAQ as well as in many of my Google Group
posts.

> 3) Currently I set the target class as the mean of the train image,
> therefore, train.T =3D mean(train.P, 1);

No.

> where Row:Features of the images, Column:Images
>
> 4) Should i set row as image and column as feature? Since my dataset, no =
of features is 80 and no of image is 350. That will cause error due to data=
set has more rows than columns.

For an I-H-O toplology,

size(train.P) =3D [I Ntrn]
size(train.T) =3D {O Ntrn]

Hope this helps.

Greg

Subject: Unknow error in my neural network

From: Greg Heath

Date: 2 Dec, 2008 23:40:02

Message: 6 of 6

On Nov 17, 9:37=A0pm, "Tak " <lauho...@hotmail.com> wrote:
> Continuous from above question, normally [x, y] =3D size(dataset), row(x)=
 or column(y) should be go to the input nodes of the network? for example, =
I have 60features (row(x) or column(y) value!?), is that mean my input node=
s will be 60?

See my previous post.

> Also because I am a newbie to Matlab and nntool, How can I find out the a=
ccuracy of the trainned network?

y =3D sim(net,p);
MSE =3D mse(y-t)

> For example, now I have new image which is not include of the training ex=
amples. Should I use "sim" function to test it?
 yes

> And I have 300 images for training, is there any efficiency way to test t=
hem all which is classify correctly? a plot function or I have to write my =
own equation?

You have to write your own. For each column of y
the row of the maximum has to be the same as the
row of t that contains the "1".

One of my posts may have it, Try searching
Google Groups with

greg-heath confusion matrix

Hope this helps.

Greg

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
backpropagation Tak 16 Nov, 2008 09:00:06
rssFeed for this Thread

Public Submission Policy

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Disclaimer prior to use.

Contact us at files@mathworks.com