MCPcopy Index your code
hub / github.com/pathwaycom/pathway / classifier_accuracy

Function classifier_accuracy

python/pathway/stdlib/ml/utils.py:13–27  ·  view source on GitHub ↗
(predicted_labels, exact_labels)

Source from the content-addressed store, hash-verified

11
12
13def classifier_accuracy(predicted_labels, exact_labels):
14 pw.universes.promise_is_subset_of(predicted_labels, exact_labels)
15 comparative_results = predicted_labels.select(
16 predicted_label=predicted_labels.predicted_label,
17 label=exact_labels.restrict(predicted_labels).label,
18 )
19 comparative_results = comparative_results + comparative_results.select(
20 match=comparative_results.label == comparative_results.predicted_label
21 )
22 accuracy = comparative_results.groupby(comparative_results.match).reduce(
23 cnt=pw.reducers.count(),
24 value=comparative_results.match,
25 )
26 pw.universes.promise_is_subset_of(predicted_labels, accuracy)
27 return accuracy
28
29
30P = ParamSpec("P")

Callers

nothing calls this directly

Calls 5

restrictMethod · 0.80
countMethod · 0.80
selectMethod · 0.45
reduceMethod · 0.45
groupbyMethod · 0.45

Tested by

no test coverage detected