MCPcopy Create free account
hub / github.com/Open-Quant/openquant / _std

Function _std

python/openquant/feature_diagnostics.py:238–243  ·  view source on GitHub ↗
(values: Sequence[float])

Source from the content-addressed store, hash-verified

236
237 if scoring == "f1":
238 tp = sum(w for y, p, w in zip(y_true, pred, weights) if y > 0.5 and p > 0.5)
239 fp = sum(w for y, p, w in zip(y_true, pred, weights) if y <= 0.5 and p > 0.5)
240 fn = sum(w for y, p, w in zip(y_true, pred, weights) if y > 0.5 and p <= 0.5)
241 precision = tp / (tp + fp) if tp + fp > 0 else 0.0
242 recall = tp / (tp + fn) if tp + fn > 0 else 0.0
243 return 2.0 * precision * recall / (precision + recall) if precision + recall > 0 else 0.0
244
245 raise ValueError("scoring must be one of: neg_log_loss, accuracy, f1")
246

Callers 2

_importance_tableFunction · 0.70
feature_screen_reportFunction · 0.70

Calls 1

_meanFunction · 0.85

Tested by

no test coverage detected