After using custom Sigmoid layer , I am getting following error
6 views (last 30 days)
Show older comments
As I have created custom sigmoid layer and custome regression layer for multilabel classification , I have checked the layer ,it works still I am getting following error:
Error using trainNetwork (line 170)
Invalid training data. Y must be a vector,
matrix, or 4-D array of numeric responses and
must not contain NaNs.
Error in DenseNet201
(line 37)
netTransfer =
trainNetwork(augimdsTrain,lgraph,options);
Can some help me regarding this?
0 Comments
Answers (1)
Jayanti
on 4 Jul 2025
Hi,
The error you are encountering might occur when the label data (Y) passed to trainNetwork is either not in the correct format or contains invalid values such as NaN. Since you are using a custom sigmoid layer for multilabel classification, make sure your label matrix "Y" is a numeric array of size with no NaN values.
To resolve the issue, please check for and remove any NaN values in your labels using the following code:
% Remove rows with NaNs
Y(any(isnan(Y), 2), :) = [];
0 Comments
See Also
Categories
Find more on Statistics and Machine Learning Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!