Skip to content

Commit 73d343f

Browse files
committed
CU-8699049kf: Fix a few more v2 vs v2 access issues
1 parent 423dab9 commit 73d343f

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

medcat/evaluate_mct_export/mct_analysis.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ def concept_summary(self, extra_cui_filter: Optional[str] = None) -> pd.DataFram
147147
concept_count_df['variations'], 3)
148148
if self.cat:
149149
fps,fns,tps,cui_prec,cui_rec,cui_f1,cui_counts,examples = get_stats(self.cat,
150-
data=self.mct_export,
150+
data=self.mct_export, # type: ignore
151151
use_project_filters=True,
152-
extra_cui_filter=extra_cui_filter)
152+
# extra_cui_filter=extra_cui_filter
153+
)
153154
concept_count_df['fps'] = concept_count_df['cui'].map(fps)
154155
concept_count_df['fns'] = concept_count_df['cui'].map(fns)
155156
concept_count_df['tps'] = concept_count_df['cui'].map(tps)
@@ -262,11 +263,11 @@ def rename_meta_anns(self, meta_anns2rename: dict = dict(), meta_ann_values2rena
262263
return
263264

264265
def _eval_model(self, model: nn.Module, data: List, config: ConfigMetaCAT, tokenizer: TokenizerWrapperBase) -> Dict:
265-
device = torch.device(config.general['device']) # Create a torch device
266-
batch_size_eval = config.general['batch_size_eval']
267-
pad_id = config.model['padding_idx']
268-
ignore_cpos = config.model['ignore_cpos']
269-
class_weights = config.train['class_weights']
266+
device = torch.device(config.general.device) # Create a torch device
267+
batch_size_eval = config.general.batch_size_eval
268+
pad_id = config.model.padding_idx
269+
ignore_cpos = config.model.ignore_cpos
270+
class_weights = config.train.class_weights
270271

271272
if class_weights is not None:
272273
class_weights = torch.FloatTensor(class_weights).to(device)
@@ -360,11 +361,11 @@ def full_annotation_df(self) -> pd.DataFrame:
360361
# and thus using it for loading is trivial
361362
# but here we need to manually load the config from disk
362363
config_path = os.path.join(meta_model_path, "meta_cat", "config")
363-
cnf: ConfigMetaCAT = deserialise(config_path)
364+
cnf: ConfigMetaCAT = deserialise(config_path) # type: ignore
364365
_meta_model = MetaCATAddon.load_existing(
365366
cnf, self.cat._pipeline._tokenizer, meta_model_path)
366-
_meta_model = meta_cat.mc
367-
meta_results = self._eval(_meta_model, self.mct_export)
367+
meta_cat = _meta_model.mc
368+
meta_results = self._eval(meta_cat, self.mct_export)
368369
_meta_values = {v: k for k, v in meta_results['meta_values'].items()}
369370
pred_meta_values = []
370371
counter = 0

0 commit comments

Comments
 (0)