Getting NaN validation lost in regressionLearner app
4 views (last 30 days)
Show older comments
Hello, After applying a deep neural network by regressionLearner app, I want to see the validation loss after exporting the model, but the validation loss values are NaN,although I selected holdout validation with 15% of the training data, what's the wrong here ? Thanks
2 Comments
Answers (1)
prabhat kumar sharma
on 4 Jun 2024
Hi Omar,
I understand you are getting your validation loss value as NaN.When you encounter NaN (Not a Number) values as validation loss in the MATLAB Regression Learner app, particularly after training a deep neural network, it indicates that there might be issues with the data, model configuration, or the training process itself.
Here are several steps you can take to diagnose and resolve this issue:
1. Check for NaNs or Infinities in Your Data for Input Features and target variables both.
2. Deep learning models are sensitive to the scale of input data. If your features are on very different scales, consider normalizing or standardizing your data. Common practices include scaling the inputs to have a mean of 0 and a standard deviation of 1, or scaling to a [0, 1] range.
3. Model Configuration
- Learning Rate: A too high learning rate can cause the model to diverge, resulting in NaN values. Try lowering the learning rate.
- Regularization: Ensure that regularization parameters (if any) are set appropriately. Too much regularization might lead to underfitting, while too little can cause overfitting or instability in training.
- Network Architecture: Review your network architecture. Sometimes, overly complex models for the given dataset size can lead to overfitting or numerical instabilities. Try simplifying the model.
4. Ensure your data splitting is correct and it represents the complete data set.
5. You can experiement with different batch sizes for debugging.
I hope it helps to resolve your issue.
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!