> For the complete documentation index, see [llms.txt](https://docs.raga.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.raga.ai/ragaai-prism/test-inventory/ocr/missing-value-test.md).

# Missing Value Test

### Execute Test:

The code snippet provided outlines the process of setting up and executing a Missing Value Test in RagaAI, focusing on detecting data points where text detection and recognition have been missed.

**Step 1: Define the Outlier Detection Rules**

Begin by establishing the criteria for detecting missing values in your dataset.

```
rules = OcrRules()
rules.add(expected_detection={"invoice_date": 1,"total_gross_worth": 1})


ocr_test = ocr_missing_test_analysis(test_session=test_session,
                             dataset_name = "Invoices_Test",
                             test_name = "OCR Missing Value Test",
                             model = "dbnet",
                             type = "ocr",
                             output_type="missing_value",
                             rules = rules)

test_session.add(ocr_test)

test_session.run()

```

* `OCRRules()`: Initialises the rules for missing value detection for OCR Usecases.&#x20;
  * `rules.add()`: Adds a rule for detecting missed values:
    * `expected_detection`: Sets the expected classes to be present in each datapoint.&#x20;

* `ocr_missing_test_analysis()`: Configures the missing value test with the following parameters:
  * `test_session`: The session object tied to your RagaAI project.
  * `dataset_name`: The name of the dataset you are analysing, "Invoices\_Test" here.
  * `test_name`: A name for the test, "OCR Missing Value Test" in this case.
  * `model`: Specifies the OCR model used for inferences, "dbnet" here.
  * `type`: Specify the usecase, "ocr" here.
  * `output_type`: For OCR use cases use output\_type = "missing value".
  * `rules`: The previously defined rules for missing value detection.

* `test_session.add()`: Registers the outlier detection test within the session.

* `test_session.run()`: Starts the execution of all tests in the session, including the outlier detection test.

By completing these steps, you have initiated a Missing Value Test for OCR application on the RagaAI Testing Platform.&#x20;

After the test, carefully review the identified missing values and do a root cause analysis to take remedial actions.

### Analysing Test Results

#### Test Overview

* **Pie Chart**: Provides an overview of the test results using a pie chart compares the percentage of Bbox of classes accurately detected in a dataset according to the expected values set by the user

**Failed Cases Per Class**

* **Bar Graph**: This helps users visualise the count of missing values per class.&#x20;

<figure><img src="/files/IZkoNWKsw2Qi7EUHqozO" alt=""><figcaption></figcaption></figure>

#### Assessing and Visualising Data

* **Datagrid View**: Examine images in the grid view. View datapoints where detections are being missed and drill down to gain more insights.

<figure><img src="/files/ky1VnKzf0fSUesHRUU7Q" alt=""><figcaption></figcaption></figure>

#### Interpreting Results

<figure><img src="/files/I8izozl2Y2iin3kOjpfO" alt=""><figcaption></figcaption></figure>

* **Expected values:** Number of expected bounding boxes of a class in a datapoint. This information is set by the user while executing the test
* **Actual:** Number of bounding boxes detected of a class in a datapoint.

By adhering to these steps, you can effectively utilise RagaAI to detect and analyse datapoints where detections are being missed in your OCR datasets.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.raga.ai/ragaai-prism/test-inventory/ocr/missing-value-test.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
