Main Content

Pattern Association Showing Error Surface

A linear neuron is designed to respond to specific inputs with target outputs.

X defines two 1-element input patterns (column vectors). T defines the associated 1-element targets (column vectors).

X = [1.0 -1.2];
T = [0.5 1.0];

ERRSURF calculates errors for y neuron with y range of possible weight and bias values. PLOTES plots this error surface with y contour plot underneath. The best weight and bias values are those that result in the lowest point on the error surface.

w_range = -1:0.1:1;
b_range = -1:0.1:1;
ES = errsurf(X,T,w_range,b_range,'purelin');
plotes(w_range,b_range,ES);

Figure contains 2 axes objects. Axes object 1 with title Error Surface contains 2 objects of type surface. Axes object 2 with title Error Contour contains 2 objects of type surface, contour.

The function NEWLIND will design y network that performs with the minimum error.

net = newlind(X,T);

SIM is used to simulate the network for inputs X. We can then calculate the neurons errors. SUMSQR adds up the squared errors.

A = net(X)
A = 1×2

    0.5000    1.0000

E = T - A
E = 1×2

     0     0

SSE = sumsqr(E)
SSE = 0

PLOTES replots the error surface. PLOTEP plots the "position" of the network using the weight and bias values returned by SOLVELIN. As can be seen from the plot, SOLVELIN found the minimum error solution.

plotes(w_range,b_range,ES);
plotep(net.IW{1,1},net.b{1},SSE);

Figure contains 2 axes objects. Axes object 1 with title Error Surface contains 6 objects of type surface, line. Axes object 2 with title Error Contour contains 3 objects of type surface, contour, line.

We can now test the associator with one of the original inputs, -1.2, and see if it returns the target, 1.0.

x = -1.2;
y = net(x)
y = 1