Elegant SciPy by Juan Nunez-Iglesias
Author:Juan Nunez-Iglesias
Language: eng
Format: epub
Publisher: O'Reilly Media
Published: 2017-08-17T04:00:00+00:00
import numpy as np pred = np.array([0, 1, 0, 0, 1, 1, 1, 0, 1, 1])
You can check how well you’ve done by comparing it to a vector of ground truth, classifications obtained by inspecting each message by hand.
gt = np.array([0, 0, 0, 0, 0, 1, 1, 1, 1, 1])
Now, classification is hard for computers, so the values in pred and gt don’t match up exactly. At positions where pred is 0 and gt is 0, the prediction has correctly identified a message as nonspam. This is called a true negative. Conversely, at positions where both values are 1, the predictor has correctly identified a spam message and found a true positive.
Then, there are two kinds of errors. If we let a spam message (where gt is 1) through to the user’s inbox (pred is 0), we’ve made a false negative error. If we predict a legitimate message (gt is 0) to be spam (pred is 1), we’ve made a false positive prediction. (An email from the director of my scientific institute once landed in my spam folder. The reason? His announcement of a postdoc talk competition started with “You could win $500!”)
If we want to measure how well we are doing, we have to count the above kinds of errors using a contingency matrix. (This is also sometimes called a confusion matrix. The name is apt.) For this, we place the prediction labels along the rows and the ground truth labels along the columns. Then we count the number of times they correspond. So, for example, since there are 4 true positives (where pred and gt are both 1), the matrix will have a value of 3 at position (1, 1).
Generally:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Hello! Python by Anthony Briggs(9928)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9803)
The Mikado Method by Ola Ellnestam Daniel Brolund(9787)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8310)
Sass and Compass in Action by Wynn Netherland Nathan Weizenbaum Chris Eppstein Brandon Mathis(7791)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7772)
Grails in Action by Glen Smith Peter Ledbrook(7705)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7567)
Windows APT Warfare by Sheng-Hao Ma(6946)
Layered Design for Ruby on Rails Applications by Vladimir Dementyev(6675)
Blueprints Visual Scripting for Unreal Engine 5 - Third Edition by Marcos Romero & Brenden Sewell(6541)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6424)
Kotlin in Action by Dmitry Jemerov(5074)
Hands-On Full-Stack Web Development with GraphQL and React by Sebastian Grebe(4323)
Solidity Programming Essentials by Ritesh Modi(4060)
Functional Programming in JavaScript by Mantyla Dan(4044)
WordPress Plugin Development Cookbook by Yannick Lefebvre(3851)
Unity 3D Game Development by Anthony Davis & Travis Baptiste & Russell Craig & Ryan Stunkel(3795)
The Ultimate iOS Interview Playbook by Avi Tsadok(3772)
