Search code examples
matlabneural-networkpredict

predict function syntax isnt working to show the result


how to use the "predict" function in MATLAB when I have to predict an output for a 3-input and single output custom neural network?

I have tried using the predict function using Y=predict(net,50,3,10) but it says "Incorrect number or types of inputs or outputs for function 'predict'." my neural network has 3 inputs which take in 3 different numerical arrays as inputs and has a single output but this function doesnt give me any output.


Solution

  • 1. The third and successive input fields to predict

    1.1. are not just numerical values but property names and respective values.

    1.2. have to go in pairs

    Other functions have the alternative of using handles on calling the funtion

    h1=func(input_data)

    and then one may change properties in structure style by doing

    h1.property1=whatever1
    h2.property2= ...
    ..
    

    But it's not the case for predict, one has to use the original MATLAB way of changing properties within the funtion input field.

    2.- example

    [ypred,yci]=predict(mdl,Xnew,'Alpha',0.1,'Simultaneous',true)
    

    3.- Read Mathworks help page for predict and use the examples provided.

    4.- Available in MATLAB version R2013a