nueramic_mathml.ml.metrics.best_threshold#
- best_threshold(x, y_true, model, metric='f1', step_size=0.01)[source]#
Returns best threshold by metric by linear search
- Parameters:
x (Tensor) – training tensor
y_true (Tensor) – target tensor. array with true values of binary classification
model (Module) – some model that returns a torch tensor with class 1 probabilities using the call: model(x)
metric (Literal['f1', 'by_roc']) – name of the target metric that we need to maximize. by_roc - difference between TPR and FPR
step_size (float) – step size of linear search
- Returns: