mlnext.score.eval_sigmoid#

mlnext.score.eval_sigmoid(y: ndarray, *, invert: bool = False, threshold: float = 0.5) ndarray[source]#

Turns a binary-class sigmoid prediction into 0-1 class labels.

Parameters:
  • y (np.ndarray) – Array with sigmoid probabilities

  • invert (bool) – Whether to invert the labels. (0->1, 1->0)

  • threshold (float) – Threshold in [0, 1]. Default: 0.5

Returns:

Returns the binary class labels.

Return type:

np.ndarray

Example

>>> eval_sigmoid(y=np.array([0.1, 0.6, 0.8, 0.2]))
np.ndarray([[0],[1],[1],[0]])