Evaluation
Once we have trained a model, to evaluate, it is highly necessary to check its overall validity. In a binary classification problem, setting the evaluation is done by using the following output values. Here, we want to evaluate the model's performance for category A:
- True positive (TP): Given a sample from label A, the output is also categorized as A
- True negative (TN): Given a sample from label A, the output is categorized into B
- False positive (FP): Given a sample from label B, the output is categorized into A
- False negative (FN): Given a sample from B, the output is also categorized into B
This is done for the evaluation set, and based on it, we compute the following parameters.
Precision
The precision value tells us how much the result is relevant to our goal in accuracy. This is computed as follows:

Using scikit-learn, we can do this as:
from sklearn.metrics import precision_score true_y = .... # ground truth values pred_y = .... # output of the model precision = precision_score...