Matlab fitnet function ignores some input variables that contain NaN values
1 次查看(过去 30 天)
显示 更早的评论
Matlab fitnet function ignores some input variables that contain NaN values.
My input layer contains some points with NaN values. I am aware that fitnet will not handle NaN values. However, when I get the input weights (IW) from the network with ten predictors, the input weights matrix eliminates two predictors and I don't know which ones.
0 个评论
回答(1 个)
MULI
2024-6-20
Hi Jorge,
I understand that you are experiencing an issue in training the model due to NaN values.
Following steps helps in addressing the issue:
Step 1: Identify NaN-containing predictors
Before feeding your data into the fitnet function, check which predictors contain NaN values using MATLAB functions like “isnan”.
Step 2: Handling NaN Values
Once you have identified the columns with NaNs, you can:
Remove NaNs: If only a few rows contain NaNs, you might choose to remove those rows.
Imputation: Replace NaN values with some form of imputation. Common strategies include using the mean, median, or mode of the column.
Step 3: Re-check Input Weights Matrix
After handling NaN values, retrain your network using fitnet and check the input weights matrix again. Now, it should consider all predictors since none of them contain NaNs.
You may refer this documentation link for more information on “isnan” function
You may also refer this link for more information in handling NaN values in the training data set.
Hope this answers your query!
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Sequence and Numeric Feature Data Workflows 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!