hello
I am running a deep learning program. It runs 28800 pairs of images and compares their features.
completes run, and then I get two errors
- a division by zero error
here is the code:
def percision(outputs, labels, weighted=False):
truePositive = 0
falsePositive = 0
trueNegative = 0
falseNegative = 0
for i in range(len(outputs)):
if (outputs[i] > 0 and labels[i] == 1):
truePositive += 1
if (outputs[i] >= 0 and not labels[i] == 1):
falsePositive += 1
if (outputs[i] < 0 and labels[i] == 0):
trueNegative += 1
if (outputs[i] <= 0 and not labels[i] == 0):
falseNegative += 1
if (truePositive > 0 or falsePositive > 0):
ppv = truePositive / (truePositive + falsePositive)
else:
ppv = 1
if (trueNegative > 0 or falseNegative > 0):
npv = trueNegative / (trueNegative + falseNegative)
else:
npv = 1
acc = (truePositive + trueNegative)
acc = acc / (acc + falseNegative + falsePositive) if (acc + falseNegative + falsePositive)!=0 else acc=0
print(acc)
if(not weighted):
acc = (ppv + npv) / 2
tpr = 1
if (truePositive + falseNegative > 0):
tpr = truePositive / (truePositive + falseNegative)
tnr = 1
if (trueNegative + falsePositive > 0):
tnr = trueNegative / (trueNegative + falsePositive)
return ppv, npv, acc, tpr, tnr, truePositive, falsePositive, trueNegative, falseNegative
div. by zero error refers to the line acc = acc / (acc + falseNegative + falsePositive)
I added if ( )!=0 else acc = 0
but I didn’t run this version yet - a run takes a week and a half
- 2nd error
the run ended successfully, except for the div. by zero error
I try to view the output results, but wandb announces - looks like you’ve stumbles on an empty page
thanks for any assistance for both errors
Hello @aaff56776 !
For the first error, you seem to have a grasp of the error message and have put things in place for it. For the second error message from wandb, “looks like you’ve stumbled on an empty page,” suggests that the page you are trying to access does not have any data or does not exist. This could be due to several reasons:
- Run Not Synced: If the run did not sync correctly with wandb, the data might not be available on the platform. Ensure that your code includes the necessary wandb initialization and logging calls.
- Incorrect Project or Run ID: Check if you are accessing the correct project and run ID. It’s possible that you might have mistyped the URL or selected the wrong project or run.
- Privacy Settings: If the run or project is set to private, you need to be logged in with the correct account that has access to view the data.
- Browser Issues: Sometimes, browser issues can cause this problem. Try clearing your browser cache, using a different browser, or checking if there are any network issues.
Dear Sir
Most kind of you to offer help.
- I understand I solved the 1st error correctly
- I am inclined to believe that the 2nd error is due to option number 1 of your offered solution - Run not synced. “ensure your code includes the necessary wandb initialization and logging calls” - may I ask how that is done? unsure as to how to set the necessary wandb initialization and logging calls - don’t know what these are or how to set them. Thank you very much!!
Certainly! Here is our docs for how to use wandb.init()
. Given that the error is occurring after wandb.init()
and the page is appearing, this is probably done correctly on your end. Since you are logging numbers, I would look in the examples here on how to log to wandb
. If those two are correct, then your division by zero error likely killed our wandb
process before it was able to upload metrics properly.
many thanks for the kind reply