MATLAB: Newp function… What does specifying the range do

neural networksperceptron

I am aware that newp has been 'obsoleted', but my course requires that we use it for this sheet. I'm having a lot of difficulty understanding what purpose the values that you might specify for a newp function actually serve. For instance, if you have:
P = [0 0 1 1; 0 1 0 1];
T = [0 1 0 1];
net = newp([-2 +2;-2 +2],1);
net = train(net,P,T);
Y = net(P)
Then what do the values
([-2 +2;-2 +2],1)
Actually do? I've searched and looked at literature but it's often explained from a position of already decent understanding. It seems to me that in this case, I can change these values to…
([4444 +5555;-444 +3333],1)
For example – and it has absolutely no effect on the number of epochs, speed, weight values or biases. I have read that they specify the range of the input, but seeing as I can use any value and it has no obvious bearing on the result, what does it mean to specify the range? What do they do, and can someone provide an example where I can see their values actually effect the outcome significantly?

Best Answer

Before asking questions about any functions it is good practice to first use the MATLAB help and documentation info via, e.g.,
help newp
doc newp
type newp
Even if this doesn't answer your question, it will help you formulate a more precise question.
% "help newp" documentation example:
net1 = newp([0 1; -2 2],1);
x = [0 0 1 1; 0 1 0 1];
t = [0 1 1 1];
% Constant Model
y00 = mean(t) % 0.7500 Reference output
mse00 = mse(t- y00) % 0.1875 Reference mse
% Linear Model % y0 = A * [ ones(1,4) ; x ];
A = t /[ ones(1,4); x ] % [ 0.25 0.5 0.5 ]
y0 = A *[ ones(1,4); x ] % [ 0.25 0.75 0.75 1.25 ]
mse0 = mse(t-y0) % 0.0625
nmse0 = mse0/mse00 % 0.3333 Normalized mse
R20 = 1 - nmse0 % 0.6667 R-squared
% Now: % 1. Simulate the untrained neural network's output,
y1 = net1(x) % [ 1 1 1 1 ]
mse1 = mse(t-y1) % 0.2500
nmse1 = mse1/mse00 % 1.3333
R21 = 1 - nmse1 % -0.3333
% 2. Train the net given the target, t
[ net2 tr y2 e2 ] = train(net1,x,t);
% y2 = [ 0 1 1 1 ], e2 = [ 0 0 0 0 ]
% Double check the answers
isequal(y2,net2(x)) % logical 1

isequal(e2, t-y2) % logical 1
% Grade the trained net
mse2 = mse(e2) % 0

nmse2 = mse2/mse00 % 0
R22 = 1 - nmse2 % 1 PERFECT !!!
Now, I will let you verify that the same answer results from
net1 = newp([0.5 0.5; 0.5 0.5],1);
Which verifies your suspicion that those coordinate ranges do not affect performance.
EXCEPT THE RANGES CANNOT BE NEGATIVE!
If you are still curious, check the code via
type newp
Hope this helps
Thank you for formally accepting my answer
Greg