medcat.utils.regression.results
Module Contents
Classes
str(object='') -> str |
|
- class medcat.utils.regression.results.FailReason
Bases:
str
,enum.Enum
str(object=’’) -> str str(bytes_or_buffer[, encoding[, errors]]) -> str
Create a new string object from the given object. If encoding or errors is specified, then the object must expose a data buffer that will be decoded using the given encoding and error handler. Otherwise, returns the result of object.__str__() (if defined) or repr(object). encoding defaults to sys.getdefaultencoding(). errors defaults to ‘strict’.
- CONCEPT_NOT_ANNOTATED = 'CONCEPT_NOT_ANNOTATED'
The concept was not annotated by the model
- INCORRECT_CUI_FOUND = 'INCORRECT_CUI_FOUND'
A different CUI with the same name was found
- INCORRECT_SPAN_BIG = 'INCORRECT_SPAN_BIG'
The concept was a part of an annotation made by the model
- INCORRECT_SPAN_SMALL = 'INCORRECT_SPAN_SMALL'
Only a part of the concept was annotated
- CUI_NOT_FOUND = 'CUI_NOT_FOUND'
The CUI was not found in the context database
- CUI_PARENT_FOUND = 'CUI_PARENT_FOUND'
The CUI annotated was the parent of the concept
- CUI_CHILD_FOUND = 'CUI_CHILD_FOUND'
The CUI annotated was a child of the concept
- NAME_NOT_FOUND = 'NAME_NOT_FOUND'
The name specified was not found in the context database
- UNKNOWN = 'UNKNOWN'
Unknown reason for failure
- class medcat.utils.regression.results.FailDescriptor
Bases:
pydantic.BaseModel
- cui: str
- name: str
- reason: FailReason
- extra: str = ''
- classmethod get_reason_for(cui, name, res, translation)
Get the fail reason for the failure of finding the specifeid CUI and name where the resulting entities are presented.
- Parameters:
cui (str) – The cui that was expected
name (str) – The name that was expected
res (dict) – The entities that were annotated
translation (TranslationLayer) – The translation layer
- Returns:
FailDescriptor – The corresponding fail descriptor
- Return type:
- class medcat.utils.regression.results.SingleResultDescriptor
Bases:
pydantic.BaseModel
- name: str
The name of the part that was checked
- success: int = 0
Number of successes
- fail: int = 0
Number of failures
- failures: List[FailDescriptor] = []
The description of failures
- report_success(cui, name, success, fail_reason)
Report a test case and its successfulness
- Parameters:
cui (str) – The CUI being checked
name (str) – The name being checked
success (bool) – Whether or not the check was successful
fail_reason (Optional[FailDescriptor]) – The reason for the failure (if applicable)
- Return type:
None
- get_report()
Get the report associated with this descriptor
- Returns:
str – The report string
- Return type:
str
- class medcat.utils.regression.results.ResultDescriptor
Bases:
SingleResultDescriptor
- per_phrase_results: Dict[str, SingleResultDescriptor]
- report(cui, name, phrase, success, fail_reason)
Report a test case and its successfulness
- Parameters:
cui (str) – The CUI being checked
name (str) – The name being checked
phrase (str) – The phrase being checked
success (bool) – Whether or not the check was successful
fail_reason (Optional[FailDescriptor]) – The reason for the failure (if applicable)
- Return type:
None
- get_report(phrases_separately=False)
Get the report associated with this descriptor
- Parameters:
phrases_separately (bool) – Whether to output descriptor for each phrase separately
- Returns:
str – The report string
- Return type:
str
- class medcat.utils.regression.results.MultiDescriptor
Bases:
pydantic.BaseModel
- property success: int
The total number of successes.
- Returns:
int – The total number of sucesses.
- Return type:
int
- property fail: int
The total number of failures.
- Returns:
int – The total number of failures.
- Return type:
int
- name: str
The name of the collection being checked
- parts: List[ResultDescriptor] = []
The parts kept track of
- get_report(phrases_separately, hide_empty=False, show_failures=True)
Get the report associated with this descriptor
- Parameters:
phrases_separately (bool) – Whether to include per-phrase information
hide_empty (bool) – Whether to hide empty cases
show_failures (bool) – Whether to show failures
- Returns:
str – The report string
- Return type:
str