Accuracy result for all negatives on Emphysema seems incorrect

get_accuracy(valid_results[“Emphysema”].values, np.zeros(len(valid_results)))

returns Accuracy of 0.0 and not 97 percent as the lab says…

“As you can see above, such a model would be 97% accurate! Even better than our deep learning based model.”

Hi @getjaidev ,

When I run the cell you mention, I am getting 97%, as you say. If you are getting 0% then you may have an issue with your get_accuracy function, even if you passed the test the first time. I would like to suggest to carefully review the formulas you implemented in the get_accuracy formula. Please let me know if you succeed or still find an issue.



Hi @getjaidev
The get_accuracy function compares the predicted values from the model with the true values, and returns the accuracy as a percentage. If the output of the function is returning 0.0, this means that the predicted values from the model are not matching the true values at all.

It is possible that there is an issue with how the model’s predictions are being passed to the get_accuracy function. The first argument to the function should be the predicted values, and the second argument should be the true values.

In the provided code, valid_results[“Emphysema”].values is passed as the first argument and np.zeros(len(valid_results)) is passed as the second argument. If the above line of code is trying to get the accuracy of a model which is predicting that all the patients doesn’t have Emphysema, it will give an accuracy of 100% in the case where all of the patients in the validation set indeed don’t have Emphysema, but in other cases it will give an accuracy of 0%.

It is possible that the statement “Even better than our deep learning based model” is a mistake or refers to a different model or data set. It’s also possible that the valid_results passed to this function is not the one that is expected or that the model which is being evaluated is not the one that is expected.

I recommend double-checking the input data and the function calls to ensure that the correct data is being passed to the get_accuracy function and that the expected model is being evaluated.

Hope so this answers your questions

Muhammad John Abbas