/home/nitin/anaconda3/envs/automlgluon/lib/python3.6/site-packages/sklearn/metrics/classification.py:2174: RuntimeWarning: divide by zero encountered in log loss = -(transformed_labels * np.log(y_pred)).sum(axis=1)
See original GitHub issueI am using autogluon to help me a binary classification problem. It is an unbalanced dataset (90:10) and the neural network breaks down in training and never recovers. I guess a reinitialization once this has been encountered would help?
/home/nitin/anaconda3/envs/automlgluon/lib/python3.6/site-packages/sklearn/metrics/classification.py:2174: RuntimeWarning: divide by zero encountered in log
loss = -(transformed_labels * np.log(y_pred)).sum(axis=1)
/home/nitin/anaconda3/envs/automlgluon/lib/python3.6/site-packages/sklearn/metrics/classification.py:2174: RuntimeWarning: divide by zero encountered in log
loss = -(transformed_labels * np.log(y_pred)).sum(axis=1)
/home/nitin/anaconda3/envs/automlgluon/lib/python3.6/site-packages/sklearn/metrics/classification.py:2174: RuntimeWarning: divide by zero encountered in log
loss = -(transformed_labels * np.log(y_pred)).sum(axis=1)
/home/nitin/anaconda3/envs/automlgluon/lib/python3.6/site-packages/sklearn/metrics/classification.py:2174: RuntimeWarning: divide by zero encountered in log
loss = -(transformed_labels * np.log(y_pred)).sum(axis=1)
/home/nitin/anaconda3/envs/automlgluon/lib/python3.6/site-packages/sklearn/metrics/classification.py:2174: RuntimeWarning: divide by zero encountered in log
The task is fitting all the other models just fine and hitting an ‘auc’ of 0.74+ but neural network has issues (dead relus, inf encountered and now wont recover? just guesses) but i guess reinitialization once the weights have been bastardized irrevocably would help
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
RuntimeWarning: divide by zero encountered in log
numpy.log10(prob) calculates the base 10 logarithm for all elements of prob , even the ones that aren't selected by the where .
Read more >when prediction value is very small, metric logloss calculate ...
... /classification.py:2174: RuntimeWarning: divide by zero encountered in log loss = -(transformed_labels * np.log(y_pred)).sum(axis=1) To ...
Read more >numpy.sum — NumPy v1.24 Manual
The default, axis=None, will sum all of the elements of the input array. If axis is negative it counts from the last to...
Read more >log-sum-exp-trick - Jupyter Notebooks Gallery
A gallery of the most interesting jupyter notebooks online.
Read more >What is numpy.sum() in Python? - Educative.io
sum () returns an array with the same shape as the input array, with the specified axis removed. If a is a zero-dimensional...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I have seen this issue in writing my own neural networks based pipeline (it was couple of years back though). I did a few things in trying to solve it and they helped (all in tensorflow) :
Also, with me it did happen that the network broke down at times but i didnt see it break down with every initialization but that is happening here. I dropped around 100 features using null importance and still the neural network is breaking on every initialization.
Fixed in: https://github.com/awslabs/autogluon/pull/481