:py:mod:`medcat.utils.ner` ========================== .. py:module:: medcat.utils.ner Submodules ---------- .. toctree:: :titlesonly: :maxdepth: 1 deid/index.rst helpers/index.rst metrics/index.rst model/index.rst Package Contents ---------------- Functions ~~~~~~~~~ .. autoapisummary:: medcat.utils.ner.metrics medcat.utils.ner.make_or_update_cdb .. py:function:: metrics(p, return_df=False, plus_recall=0, tokenizer=None, dataset=None, merged_negative={0, 1, -100}, padding_label=-100, csize=15, subword_label=1, verbose=False) Calculate metrics for a model's predictions, based off the tokenized output of a MedCATTrainer project. :param p: The model's predictions. :param return_df: Whether to return a DataFrame of metrics. :param plus_recall: The recall to add to the model's predictions. :param tokenizer: The tokenizer used to tokenize the texts. :param dataset: The dataset used to train the model. :param merged_negative: The negative labels to merge. :param padding_label: The padding label. :param csize: The size of the context window. :param subword_label: The subword label. :param verbose: Whether to print the metrics. :Returns: **Dict** -- A dictionary of metrics. .. py:function:: make_or_update_cdb(json_path, cdb = None, min_count = 0) Creates a new CDB or updates an existing one with new concepts if the cdb argument is provided. All concepts that are less frequent than min_count will be ignored. :param json_path: The json path :type json_path: str :param cdb: The CDB if present. Defaults to None. :type cdb: Optional[CDB] :param min_count: Minimum count to include. Defaults to 0. :type min_count: int :Returns: **CDB** -- The same or new CDB.