1. Confusion Matrix
time limit per test
1 second
memory limit per test
256 megabytes
input
standard input
output
standard output

When assessing the quality of binary classification, a confusion matrix is often used. Let's explain what it is. Suppose we have $$$N$$$ objects belonging to one of two classes (0 or 1). For example, the objects are X-ray images, where class 1 means the patient is sick, and class 0 means healthy. Let there be some algorithm that predicts the class of an object. Knowing the actual and predicted classes, we can construct the following table to evaluate the quality of the prediction:

Predicted class = 1Predicted class = 0
Actual class = 1TPFN
Actual class = 0FPTN

Here, the value TP (True Positive) is the number of objects for which the model predicted class 1, and they actually belong to class 1. The value TN (True Negative) is the number of objects for which the model predicted class 0, and they actually belong to class 0. The value FP (False Positive) is the number of objects for which the model predicted class 1, but they actually belong to class 0. The value FN (False Negative) is the number of objects for which the model predicted class 0, but they actually belong to class 1.

From the values in this table, we can compute two more characteristics—precision and recall.

Precision is calculated using the formula $$$precision = TP / (TP + FP)$$$, which indicates the proportion of objects that our algorithm classified as class 1 that actually belong to class 1.

Recall is calculated using the formula $$$recall = TP / (TP + FN)$$$, which indicates the proportion of class 1 objects among all class 1 objects that our algorithm found.

Suppose there were a total of 99 objects, of which 35 are class 0 and 64 are class 1. It is known that the model correctly identified the class for 51 objects. Find the answers to the following four questions.

  1. What is the maximum precision that could be achieved?
  2. What is the minimum precision?
  3. Suppose it is additionally known that precision equals recall. What is the maximum recall that could be achieved in this case?
  4. What is the minimum recall?

Enter four real numbers, rounded to three decimal places, as your answer. Place each number on a separate line. Use a period as the decimal separator. If you do not know any of the answers, enter zeros instead. In the "Language" field, select PHP (you do not need to know this language; it is simply a feature of the grading system) and click the "Submit" button.

Note

Scoring system: each correct answer is worth 25 points.