Categories &

Functions List

Function Reference: fcnnpredict

statistics: pred_Y = fcnnpredict (LayerWeights, LayerBiases, Activations, OutputLayerActivation, XC)
statistics: pred_Y = fcnnpredict (…, NumThreads)
statistics: [pred_Y, scores] = fcnnpredict (…)

Make predictions from a fully connected Neural Network.

pred_Y = fcnnpredict (LayerWeights, LayerBiases, Activations, OutputLayerActivation, XC) requires the following input arguments.

  • LayerWeights : A cell row vector holding one matrix per layer, each with one row per neuron of that layer and one column per input to it.
  • LayerBiases : A cell row vector holding one bias column per layer, matching LayerWeights layer for layer and row for row.
  • Activations : The activation function of the hidden layers, named as a character vector applying to all of them or as a cellstring naming them one by one. The supported names are listed under fcnntrain.
  • OutputLayerActivation : The activation function of the output layer, named as a character vector.
  • XC : An NxM matrix containing the data set to be predicted upon. Rows N correspond to individual samples and columns M correspond to features (dimensions). Type of XC must be double and the number of features must correspond to those of the trained model.

fcnnpredict can also be called with a sixth input argument, in which case, NumThreads, a positive scalar integer value, defines the number of threads to be used when computing the activation layers. For layers with less than 1000 neurons, NumThreads always defaults to 1. fcnnpredict returns the predicted labels, pred_Y, and if a second output argument is requested, it also returns the corresponding values of the neural networks output in scores.

Installation Note: in order to support parallel processing on MacOS, users have to manually add support for OpenMP by adding the following flags to CFLAGS and CXXFLAGS prior to installing the statistics package:

setenv ("CPPFLAGS", "-I/opt/homebrew/opt/libomp/include -Xclang -fopenmp")

See also: fcnntrain, fitcnet, ClassificationNeuralNetwork

Source Code: fcnnpredict