How to get confidence score for classification and data extraction in variable?

Hello,

i ma extracting data from invoices and vehicle damage reports using studio.
have below doubts -
1] I need to add condition after classify document scope activity where i have created variable for output as -DocClassificationResult

so conditio like DocClassificationResult > 8 ( i hope it shows value sfrom 1-10) then skip present clasification station and train classifier scope.

but when i am cehcking with write line, value for DocClassificationResult, it is not giving result in number instead giving like below.
image

how to extract that number?same question i have for data extarction scope.

2] this i am doing fro my undersatnding about DU using studio but when i need to do in production then can i use same structure of different? how it it will go to action center if any validation required? any helpfull video is there for production steps?

help me on same.

Hi @Mathkar_kunal,

For DocClassificationResult, it is an object rather than a direct numeric confidence value. You can access the confidence using:

DocClassificationResult(0).Confidence

The confidence value is between 0 and 1. For example, 0.90 means 90% confidence. So you can use a condition like:

DocClassificationResult(0).Confidence >= 0.8

For extraction, confidence is available at the individual field level. If the confidence is below your defined threshold, you can route the document to a Validation Station / Action Center for human validation.

For production, I would recommend using the Document Validation activities with Action Center rather than relying only on a training station. The exact threshold should also be tested with your real production documents.

Hope this helps and you find it useful! :slightly_smiling_face:

how to route to Validation Station / Action Center for human validation?
Document Validation- can you name one?
for production any video is available?

Hi @Mathkar_kunal,

Sure. For a typical production flow, you can use the following approach:

For extraction validation:

  • Use Extract Document Data to extract the invoice/damage report fields.
  • Use Create Document Validation Task to send the extracted data for human validation.
  • The validation action can be handled in UiPath Action Center.
  • After the user validates/corrects the data, use Wait for Document Validation Action and Resume so the workflow can continue with the validated output.

For example, you can put a condition before creating the validation task:

InvoiceData.Fields(“InvoiceNumber”).Confidence < 0.80

If the confidence is below your threshold → create the validation task → Action Center → human validates → workflow resumes.

For classification, you can similarly use Create Classification Validation Task when the classification confidence is below your threshold.

For production, I would recommend following UiPath’s Document Understanding + Action Center tutorials/learning materials, because they cover the complete flow from processing the document to human validation and resuming the automation.

Hope this helps you understand how the production flow works! :slightly_smiling_face:

Hi @Mathkar_kunal ,
DocClassificationResult is an array of ClassificationResult objects, not a numeric value, which is why Write Line shows the type name. The confidence is stored inside each classification result. UiPath examples show confidence as a decimal such as 0.6170391, not a 1-10 score.

So your condition should be based on the required result’s Confidence, for example compare it against 0.8 for an 80% threshold, rather than DocClassificationResult > 8.

For production, use Action Center when human validation is required:

  • Classification: Create Document Classification Action → Wait for Document Classification Action and Resume.
  • Extraction: Create Document Validation Action → Wait for Document Validation Action and Resume. The automatic extraction result comes from Data Extraction Scope.

This lets high-confidence documents continue automatically while documents requiring review can be sent for human validation.

Thanks

do you talking about below activity? cant find exact with name - Create Document Validation Task

what we need to select here in input and project?

as in my project i have done like to work on each doc present in folder with foreach

Hi @Mathkar_kunal,

DocClassificationResult is a collection of ClassificationResult objects, so you need to access the Confidence property first.

For example:

DocClassificationResult(0).Confidence

This returns a value between 0 and 1, not 1–10. So 0.90 means 90% confidence.

For example, if you want to check whether the classification confidence is at least 90%:

DocClassificationResult(0).Confidence >= 0.9

Also, the results are sorted by confidence, so index 0 represents the highest-confidence classification result.

For data extraction, the same concept applies, but confidence is available for each extracted field. With the newer DocumentData output, you can use:

DocumentData.Data.GetFieldValue(“FieldName”).Confidence

This also returns the confidence as a value between 0 and 1.

One more option is to configure the Minimum Confidence directly in Classify Document Scope / Data Extraction Scope, so results below your threshold are not accepted.

Hope this helps!

ok thanks for this infor but what about extract document data.as in my project i have done like to work on each doc present in folder with foreach
what need to provide in input and doc understanding project?

Hi @Mathkar_kunal,

If you are processing each document inside a For Each loop, you can pass the current document as the input to the Document Understanding activities.

For example, if you are getting the files from a folder using Directory.GetFiles(), your For Each will process each file one by one. Inside the loop, you can use:

Read Document → pass the current file path
Classify Document Scope → use the Document Object Model (DOM) from Read Document
Extract Document Data → pass the required Document Object Model and configure your taxonomy/extractor.

The main point is that each iteration should pass the current document to the DU workflow.

If you share a screenshot of your current For Each structure and activities, I can suggest exactly what to put in each input/output.

@Mathkar_kunal

in input give the foreach loop variable which would be the single file

as it needs localresource you need to pass localresource.FromPath(CurrentItem)

Here currentitem is the loop variable containing the file path..if youa re getting resource directly then just pass the resource

cheers

like below i am doing


and what to select in doc understanding project? is we need to publish workflow and select?

Hi @Mathkar_kunal,

Yes, if you are processing each document using a For Each loop, you can pass the current file/document to the Document Understanding workflow.

For example:
Directory.GetFiles() → For Each file → Extract Document Data

In Extract Document Data, you can use the current file as the Input. If you have already used Classify Document, then pass its Document Data output to Extract Document Data instead of passing the file again. This also avoids re-digitizing the document.

Then select your Document Understanding Project and configure the required extractor/document type and fields.

So, inside the loop, the basic flow can be:
Current File → Classify Document → Extract Document Data → Process Extraction Result.

If you share your For Each workflow, I can suggest exactly what to put in the Input and Output fields.