mirror of
https://github.com/data-privacy-stack/presidio.git
synced 2026-07-30 06:40:44 -05:00
* new tutorial * updated index.md * . * updated toc * adding "models" to the languages section Co-authored-by: omri374 <omri.mendels@microsoft.com>
35 lines
1.1 KiB
Markdown
35 lines
1.1 KiB
Markdown
# Example 7: Tracing the decision process
|
|
|
|
Presidio-analyzer's decision process exposes information on why a specific PII was detected. Such information could contain:
|
|
|
|
- Which recognizer detected the entity
|
|
- Which regex pattern was used
|
|
- Interpretability mechanisms in ML models
|
|
- Which context words improved the score
|
|
- Confidence scores before and after each step
|
|
And more.
|
|
|
|
For more information, refer to the [decision process documentation](https://microsoft.github.io/presidio/analyzer/decision_process/).
|
|
|
|
Let's use the decision process output to understand how the zip code value was detected:
|
|
|
|
<!--pytest-codeblocks:cont-->
|
|
```python
|
|
from presidio_analyzer import AnalyzerEngine
|
|
import pprint
|
|
|
|
analyzer = AnalyzerEngine()
|
|
|
|
results = analyzer.analyze(
|
|
text="My zip code is 90210", language="en", return_decision_process=True
|
|
)
|
|
|
|
decision_process = results[0].analysis_explanation
|
|
|
|
pp = pprint.PrettyPrinter()
|
|
print("Decision process output:\n")
|
|
pp.pprint(decision_process.__dict__)
|
|
```
|
|
|
|
When developing new recognizers, one can add information to this explanation and extend it with additional findings.
|