How are NaN values in the input data for a Neural Network taken into account while training the network in the Neural Network Toolbox?

38 views (last 30 days)
I have a Dynamic Neural Network with missing input data that I think should be replaced with NaNs but I am not sure how are NaN values treated by the training function.

Accepted Answer

MathWorks Support Team
MathWorks Support Team on 18 Jan 2024
Edited: MathWorks Support Team on 29 Feb 2024
The network object has the property "processFcns" which is a sequence of processing steps that work on the input data before it is considered ready for training. This list of functions can be accessed in the Network object as follows:
net.inputs{i}.processFcns
where "net" is the network object variable, "i" represents the i-th set of inputs.
By default, any network trained via Backpropagation has three input professing functions the first of which is FIXUNKNOWNS. This function re-encodes unknown input values represented by NaN values into numerical values so the network can operate on the values directly. It replaces the NaNs with the average value in the training set for that particular component hence trying to make an educated guess.
For more information, please run the below command in the MATLAB R2018b command window to refer to the documentation:
web(fullfile(docroot, 'deeplearning/ref/fixunknowns.html'))
One can remove this function from the default network object to avoid calling it or even add a custom function to pre-process the inputs.
The template for adding custom functions can be accessed by executing the following at the MATLAB Command Window:
help nncustom
For accessing templates for processing functions, please click on the hyper link "template_process".
Please follow the below link to search for the required information regarding the current release:

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!