# Extraction Precision, Recall and F1 Calculator

> Source: https://netray.co/tools/extraction-precision-recall-f1-calculator
> Publisher: Netray (netray.co), AI and integration engineering for ERP and manufacturing systems.
> Section: Free Tools

## Short answer

Score a document extraction or classification model with precision, recall and F1 from a labeled sample.

## Category

ai-automation

## Industry

Manufacturing

## Audience

- AI engineer
- Quality engineer
- Data analyst

## Tool

**Kind:** calculator

**Inputs:**

#### Correct extractions (true positives)

**Key:** tp

**Type:** number

**Default:** 940

**Min:** 0

**Step:** 10

**Unit:** fields

**Help:** Fields the model extracted with the right value.

#### Wrong extractions (false positives)

**Key:** fp

**Type:** number

**Default:** 35

**Min:** 0

**Step:** 5

**Unit:** fields

**Help:** Fields the model extracted with a wrong value, or extracted where none exists.

#### Missed fields (false negatives)

**Key:** fn

**Type:** number

**Default:** 25

**Min:** 0

**Step:** 5

**Unit:** fields

**Help:** Fields present in the document that the model did not return.

#### Cost of an undetected wrong value

**Key:** cost_error

**Type:** number

**Default:** 18

**Min:** 0

**Step:** 1

**Unit:** $

**Help:** Rework, payment error or scrap cost when a wrong value is accepted.

#### Cost of a missed field

**Key:** cost_miss

**Type:** number

**Default:** 2

**Min:** 0

**Step:** 0.5

**Unit:** $

**Help:** Manual keying cost when a field is absent.

**Outputs:**

#### Precision

**Key:** precision

**Expr:** tp / (tp + fp) * 100

**Format:** percent

**Primary:** true

**Description:** Of the values returned, the share that are right.

#### Recall

**Key:** recall

**Expr:** tp / (tp + fn) * 100

**Format:** percent

**Primary:** true

**Description:** Of the values that exist, the share the model found.

#### F1 score

**Key:** f1

**Expr:** 2 * tp / (2 * tp + fp + fn) * 100

**Format:** percent

#### Miss rate

**Key:** miss_rate

**Expr:** fn / (tp + fn) * 100

**Format:** percent

#### Wrong share of returned values

**Key:** wrong_share

**Expr:** fp / (tp + fp) * 100

**Format:** percent

#### Cost exposure for this sample

**Key:** exposure

**Expr:** fp * cost_error + fn * cost_miss

**Format:** currency

**Description:** Assumes no human review catches the wrong values.

**Chart:**

#### Precision, recall and F1 vs wrong extractions

**Type:** line

**X:** fp

**From:** 0

**To:** 300

**Steps:** 30

**Series:**

- precision
- recall
- f1

**Disclaimer:** Count results from a labeled sample of your own documents. Define a match rule (exact, normalized) before scoring.

## Content

**Intro:** Accuracy alone hides the trade-off in document extraction between returning wrong values and failing to return values. Precision, recall and F1 separate the two so that you can tune a model or threshold with intent.

**Sections:**

#### How to use the calculator

**Body:** Take a labeled sample, such as 100 invoices or certificates with the correct values entered by hand. Count fields the model got right, fields it returned wrong and fields it missed. Enter the counts, and add the cost of an undetected wrong value and of a missed field to see financial exposure for the sample. The chart sweeps the wrong-extraction count so that you can see the effect on precision and F1.

**Bullets:**

- Fix the match rule first: exact match or normalized (dates, currency, whitespace).
- Score per field type, because invoice totals and descriptions behave differently.
- Use a sample that includes your worst suppliers and scan quality.

#### The definitions

**Body:** Precision is true positives divided by true positives plus false positives. Recall is true positives divided by true positives plus false negatives. F1 is their harmonic mean, which simplifies to twice true positives over twice true positives plus false positives plus false negatives. A miss is cheap in a system where people fill gaps; a wrong value is costly where nobody checks it. That is why cost weights matter more than a single score.

#### How to read the result

**Body:** High recall with low precision means the model returns values for almost everything but some are wrong, which is dangerous without review. High precision with low recall means it is cautious and leaves work to people. A confidence threshold moves a model along this trade-off: raising it improves precision and lowers recall. Choose the point from the cost of each error type, not from the F1 alone.

#### Common mistakes

**Body:** Scoring on a sample that is too clean gives optimistic results. Counting a field returned with the wrong value only as a false positive is a convention, and some teams also count it as a miss, so state your rule. Finally, a single overall F1 hides the fields that matter: report the critical fields separately.

**Cta:** If you need an evaluation harness that scores an extraction model against your labeled documents on-prem, Netray can build one with you.

**Faq:**

#### What is the difference between precision and recall?

**Answer:** Precision asks how many returned values are right. Recall asks how many of the existing values were found. A model can be strong on one and weak on the other, which is why both are reported.

#### When should I use F1?

**Answer:** Use F1 as a single comparison number when false positives and false negatives matter roughly equally. When their costs differ greatly, use the cost exposure or weight the metrics accordingly.

#### How big should the evaluation sample be?

**Answer:** Large enough to cover the main suppliers, layouts and scan qualities, and to give a stable count for each field you care about. A few hundred documents is common, but rare fields may need targeted sampling.

#### How does the confidence threshold relate to these metrics?

**Answer:** Raising the threshold removes low-confidence values, which usually increases precision and reduces recall. Plot both against several thresholds on your sample and pick the point that fits your review capacity.

## Search terms

precision recall f1 calculator, document extraction evaluation, OCR model evaluation metrics, document AI precision and recall, F1 score calculator, false positive false negative extraction, evaluating intelligent document processing

---
Talk to an engineer: https://netray.co/contact?intent=erp_ai | Machine catalog: https://netray.co/agent/catalog.json
