MCPcopy Index your code
hub / github.com/RingBDStack/GDAP / extraction_metrics

Function extraction_metrics

seq2seq/constrained_seq2seq.py:56–64  ·  view source on GitHub ↗
(pred: EvalPrediction)

Source from the content-addressed store, hash-verified

54 return decode_tree_str(pred.predictions, tokenizer), decode_tree_str(pred.label_ids, tokenizer)
55
56 def extraction_metrics(pred: EvalPrediction) -> Dict:
57 pred_str, label_str = decode_pred(pred)
58 extraction = get_extract_metrics(pred_lns=pred_str, tgt_lns=label_str, label_constraint=decoding_type_schema,
59 decoding_format=decoding_format)
60 # rouge: Dict = calculate_rouge(pred_str, label_str)
61 summ_len = np.round(np.mean(lmap(non_pad_len, pred.predictions)), 1)
62 extraction.update({"gen_len": summ_len})
63 # extraction.update( )
64 return extraction
65
66 compute_metrics_fn = extraction_metrics
67 return compute_metrics_fn

Callers

nothing calls this directly

Calls 3

get_extract_metricsFunction · 0.90
lmapFunction · 0.90
decode_predFunction · 0.70

Tested by

no test coverage detected