Hello Marques Chacon,
Welcome to the Microsoft Q&A and thank you for posting your questions here.
I understand that you would like to run a composed model with only one extraction algorithm.
Putting into consideration the limitation that Azure Form Recognizer requires at least two unique extraction models in a composed model. I am providing you a feasible solution below by suggesting a programmatic approach to separate classification and extraction processes. Since you cannot set a confidence threshold for the null class directly in a composed model or reuse the same extraction model for multiple classifications.
The best approach:
- Separate Classification and Extraction:
- Use the Form Recognizer classification model to identify whether a document is "irrelevant" or "relevant."
- Set a high confidence threshold in your application logic for the irrelevant/null class. Only proceed with extraction if the confidence for the relevant class is above a certain level.
- Single Extraction Model:
- Train one extraction model for the relevant document type.
- If the classification confidence indicates the document is relevant, run the document through the extraction model.
- Skip the extraction step entirely for irrelevant documents.
- Alternative: You can duplicate the Extraction Model:
- If you must use a composed model for classification and extraction combined, create a duplicate of your relevant extraction model.
- Assign one to the relevant class and the other to the irrelevant/null class. Set the confidence threshold for the null class to a very high value (close to 1) in your composed model’s evaluation.
Your implementation outline will be similar to the followings:
- Train and publish a classification model.
- Train and publish your extraction model for relevant documents.
- Combine these models programmatically:
- First, classify the document.
- If classification confidence for the relevant class exceeds your threshold, run the document through the extraction model.
- Skip processing for null/irrelevant documents.
The reason this will work is simply because:
- It separates concerns (classification vs. extraction) and gives you control over handling documents classified as null or irrelevant.
- It avoids creating unnecessary complexity in the composed model and aligns with the current capabilities of Azure Form Recognizer.
I hope this is helpful! Do not hesitate to let me know if you have any other questions.
Please don't forget to close up the thread here by upvoting and accept it as an answer if it is helpful.