# Precision, Recall, and F-Score for Green Classify

The precision and recall are calculated with the data that is not used for training the tool. F-Score is the harmonic mean of the precision and the recall and that being so it is also based on the data that are not in the training set. You can manually figure out the same values as the ones in the Confusion Matrix table using Display Filter.

| Predicted Class
Bauble | Beef | Grizzly | Key | Nuts
Actual Class | Bauble | 18 | 2 | 2 | 2 |
Beef |  | 23 |  |  | 1
Grizzly |  |  | 24 |  |
Key | 6 |  |  | 18 |
NutsF-Score Calculation |  | 2 |  |  | 22

- Precision calculation example for the class "Beef" (Display Filter Syntax)

  - True Positives: best_tag='Beef' and tag![name='Beef'] and not trained

  - False Positives: best_tag='Beef' and tag![name!='Beef'] and not trained

  - Precision = True Positives / (True Positives + False Positives)

- Recall calculation example for the class "Beef" (Display Filter Syntax)

  - True Positives: best_tag='Beef' and tag![name='Beef'] and not trained

  - False Negatives: best_tag!='Beef' and tag![name='Beef'] and not trained

  - Recall = True Positives / (True Positives + False Negatives)

- F-Score calculation example for the class "Beef"

### Precision Calculation

For the Green Classify tool, Precision is calculated as the percentage of detected classes that match the labeled class.

The tool calculates Precision as the percentage of correctly classified views predicted as class i:

For example, a Precision of 90% for the class "Breast" means that the neural network will confuse an image of chicken breasts with a different class 1 out of 10 times.

| Predicted Class
Breast | Drumstick | Filet | Flaps | Leg | Neck | Skewer | Sliced Breast | Thigh | Wings
Actual Class | Breast | 19 |  |  |  |  |  |  | 1 |  |
Drumstick |  | 14 |  |  | 2 |  |  | 2 | 2 |
Filet |  |  | 20 |  |  |  |  |  |  |
Flaps |  |  |  | 19 | 1 |  |  |  |  |
Leg |  |  |  |  | 18 |  |  |  |  |
Neck |  |  | 2 |  |  | 17 |  |  |  |
Skewer | 1 |  |  |  |  |  | 13 |  |  |
Sliced Breast | 4 |  | 4 |  |  |  |  | 14 |  |
Thigh |  |  |  |  | 1 |  |  | 2 | 16 |
Wings |  |  |  |  |  |  |  |  |  | 20

### Recall Calculation

For the Green Classify tool, the Recall is a percentage of the labeled classes that are correctly identified by the tool.

The tool calculates Recall by the fraction of classified views labeled as class i that are correctly classified as class i:

For example, a Recall of 90% for the class "Breast" means that the neural network will correctly classify an image of chicken breasts 9 out of 10 times.

| Predicted Class
Breast | Drumstick | Filet | Flaps | Leg | Neck | Skewer | Sliced Breast | Thigh | Wings
Actual Class | Breast | 19 |  |  |  |  |  |  | 1 |  |
Drumstick |  | 14 |  |  | 2 |  |  | 2 | 2 |
Filet |  |  | 20 |  |  |  |  |  |  |
Flaps |  |  |  | 19 | 1 |  |  |  |  |
Leg |  |  |  |  | 18 |  |  |  |  |
Neck |  |  | 2 |  |  | 17 |  |  |  |
Skewer | 1 |  |  |  |  |  | 13 |  |  |
Sliced Breast | 4 |  | 4 |  |  |  |  | 14 |  |
Thigh |  |  |  |  | 1 |  |  | 2 | 16 |
Wings |  |  |  |  |  |  |  |  |  | 20

### F-Score Calculation

For the Green Classify tool, the F-Score provides a harmonic mean of Recall and Precision values. The F-Score tends to be the best measure of the overall accuracy of the tool.

To optimize the tool, consider the following:

- To avoid False Positives absolutely, target a Precision score of 100
- To avoid False Negatives absolutely, target a Recall score of 100

Otherwise, target the following:

- For unbalanced problems where sparse classes matter, go by the F-Score.
- Use the F-Score averaged over all classes.
- Set the Threshold Processing parameter to 0% to avoid a varying rate of non-classified views.

Note: If you face an unexpected underperformance of results and suspect mislabeling or noisy labels as the cause of the underperformance, you can examine the quality level of the label for each view and correct the wrong label. See for more details.