Computing Accuracy From Raw Predictions
The neat summary counts from the big Larkspur Mail bake-off do not exist yet for the newest model. What comes out of an overnight run is what evaluations actually look like before anyone tidies them: two plain lists, one entry per test email.
The two lists line up position by position: the first entry of one describes the same email as the first entry of the other, and so on to the end. A 1 means spam and a 0 means ordinary mail, so the first list is the human's verdict and the second is the filter's. Spam - the 1 label - is the positive class.
The overnight job runs against whichever test set is current, so the lists are as long as that night's set and no longer. Some of these runs are smoke tests of a dozen emails or fewer, and the team knows a run that small is not an evaluation - but it still has to be scored.
Task: Print the model's accuracy over the whole run. Print the raw number - no rounding is asked for.
Input
Two lines. The first holds the human labels, each 0 or 1, separated by single spaces. The second holds the model's predictions in the same form. The two lines always hold the same number of entries, and there is at least one.
Output
One line holding the accuracy as a float, printed raw - 0.7, and 0.6666666666666666 when the division does not terminate.
Example:
Input:
1 0 1 1 0 1 0 0 1 1
1 0 1 0 1 1 0 0 1 0
Output:
0.7
Sign in to solve this problem
Reading problems is free for everyone — solving them (Run, Submit, and tracking what you've solved) needs an account.
Sign in