Search All of the Math Forum:

Views expressed in these public forums are not endorsed by NCTM or The Math Forum.

Notice: We are no longer accepting new posts, but the forums will continue to be readable.

Topic: Targets are incorrectly sized for network.
Replies: 3   Last Post: Jan 19, 2013 1:24 AM

 Messages: [ Previous | Next ]
 Greg Heath Posts: 6,387 Registered: 12/7/04
Re: Targets are incorrectly sized for network.
Posted: Jan 17, 2013 3:38 AM

"ogochukwu " <ogcafe@yahoo.com> wrote in message <kd6eug\$8d8\$1@newscl01ah.mathworks.com>...
> i m a student currently carrying out a project work involving the use of neural network, i have been having serious problem using this product. each time i enter this code below >into mathlab (version 7.5.0)

Why not use Matlab? mathlab may be innappropriate for your needs.

>i always get this information " Targets are incorrectly sized for network.
> Matrix must have 1 rows". i really dont know what to do or where the problem is coming from,

Obviously your net has one output dimension; so the target matrix must have one row.

If you have N i/o training pairs with I-dimensional inputs and O-dimensional outputs,
the matrix sizes must be

[ I N ] = size(input)
[ O N ] = size(target).

>my project work is been delayed because of this. pls see the code below and let me know where the problem is coming from. thank you for the soon response

> x=0:2:20
>
> y=(0.03*x.^3)-(0.2*x.^2)+(6*x)+5
>
> p=x;
>
> t=y;
>

You have already created a one-dimensional [p ,t] i/o pair set. What is in choles_all??

You don't use whatever is in it UNLESS it contains another [p,t] i/o set which
overwrites the originally defined set.

whos % Check dimensions

% or

[I N ] =size(p)
[O N] = size(t)

> [pn,pp1] = mapstd(p);
>
> [tn,tp] = mapstd(t);
>
> [ptrans,pp2] = processpca(pn,0.001);

Replace 0.001 to 0.01. A goal of 99% is more realistic than 99.9%

These transformations should only be applied to the training set. The resulting
parameters should then be applied to the val and test sets.

> [R,Q] = size(ptrans);

[R Q ] = ?

> iitst = 2:4:Q;
>
> iival = 4:4:Q;
>
> iitr = [1:4:Q 3:4:Q];
>
> validation.P = ptrans(:,iival);
>
> validation.T = tn(:,iival);
>
> testing.P = ptrans(:,iitst);
>
> testing.T = tn(:,iitst);
>
> ptr = ptrans(:,iitr);
>
> ttr = tn(:,iitr);
>
> net = newff(minmax(ptr),[15 1],{'tansig' 'purelin'},'trainlm');
>
> net.trainParam.show = 50;
>
> [net,tr]=train(net,ptr,ttr,[],[],validation,testing);

% Take a good look at tr

tr = tr

Hope this helps.

Greg

> please see how you can be of help to me by either assisting with any materials that will detail the use of neural network in matlab 7.5.1, or weblinks that will be an eye opener or even personalities that could assist me, i will very gratefull for the soon response. thank you sir

Date Subject Author
1/17/13 Greg Heath
1/19/13 Greg Heath