557658 (1) [Avatar] Offline
In listing D.4, false positives are defined with the following code:

false_positives=((y_pred != y_true) & (y_true==1)).sum()

This seems against what is mentioned immediately above listing D.6: "false positives are the negative examples that you mislabeled as positive"

Shouldn't the code actually be as follows?

false_positives=((y_pred != y_true) & (y_true==0)).sum()

Thank you for this valuable book!
hobs (58) [Avatar] Offline
You are right! Stop the presses! Thanks to your contribution we've corrected it at the last minute and the book should be correct and more clear. We also changed the y_true use in the true_positive and true_negative calculation to be consistent and clear. The nlpia package has an example for appendix D with your name on it (forum id). Thank you so much. It's people like you that will use NLP and ML to make the world a better place.