:py:mod:`medcat.rel_cat` ======================== .. py:module:: medcat.rel_cat Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: medcat.rel_cat.RelCAT .. py:class:: RelCAT(cdb, tokenizer, config = ConfigRelCAT(), task='train', init_model=False) Bases: :py:obj:`medcat.pipeline.pipe_runner.PipeRunner` The RelCAT class used for training 'Relation-Annotation' models, i.e., annotation of relations between clinical concepts. :param cdb: cdb, this is used when creating relation datasets. :type cdb: CDB :param tokenizer: The Huggingface tokenizer instance. This can be a pre-trained tokenzier instance from a BERT-style model. For now, only BERT models are supported. :type tokenizer: TokenizerWrapperBERT :param config: the configuration for RelCAT. Param descriptions available in ConfigRelCAT docs. :type config: ConfigRelCAT :param task: What task is this model supposed to handle. Defaults to "train" :type task: str, optional :param init_model: loads default model. Defaults to False. :type init_model: bool, optional .. py:attribute:: name :value: 'rel_cat' .. py:attribute:: log .. py:method:: __init__(cdb, tokenizer, config = ConfigRelCAT(), task='train', init_model=False) .. py:method:: save(save_path) Saves model and its dependencies to specified save_path folder. The CDB is obviously not saved, it is however necessary to save the tokenizer used. :param save_path: folder path in which to save the model & deps. :type save_path: str .. py:method:: _get_model() Used only for model initialisation. .. py:method:: load(load_path = './') :classmethod: .. py:method:: _create_test_train_datasets(data, split_sets = False) .. py:method:: train(export_data_path = '', train_csv_path = '', test_csv_path = '', checkpoint_path = './') .. py:method:: evaluate_(output_logits, labels, ignore_idx) .. py:method:: evaluate_results(data_loader, pad_id) .. py:method:: pipe(stream, *args, **kwargs) .. py:method:: __call__(doc)