# Confused about Pattern Recognition Network in Matlab Documentation

In the Matlab documentation for the Pattern Recognition Network (patternnet()), I am confused about a line of code in the documentation:

[x,t] = iris_dataset;
net = patternnet(10);
net = train(net,x,t);
view(net)
y = net(x);
perf = perform(net,t,y);
classes = vec2ind(y);


Why is y = net(x)? So, I am assuming that y is the output vector, but why is it set to the column of the input vector, x? I see that the net is the matrix containing the information from the train() function call, but why would it be asking for the inputs?

The y = net(x) is the inference - using the trained model to predict y given a test input x. I suspect that the model is internally splitting the data of x in training, validation and test sub-sets, but keeping that only as index references. Thus it needs the input vector to pull the test sub-set out of it. See if the example code makes better sense.
• Thanks for the other example. But what I don't understand is why it's being called an output, if it's the neural network's input? Is net(input) returned an array that I'm not understanding?
• While being trained, the NN is trying to "discover" a function f(x) such that f(x_train) = t with t being the labels. After the model is trained, the purpose of f(x) is to produce predictions. If x_test is the input, then y = f(x_test) is the output. I think the confusion comes from the vector x containing both x_train and x_test which have completely different purposes. Sep 9 '16 at 7:04