rie_score#

skfp.metrics.rie_score(y_true: ndarray | list[int], y_score: ndarray | list[float], alpha: float = 20) float#

Robust Initial Enhancement (RIE).

Exponentially weighted alternative to enrichment factor (EF), aimed to fix the problem of high variance with small number of actives. The exponential weight alpha is roughly equivalent to 1 / fraction from EF. See [1] [2] [3] for details.

We have n actives, N test molecules, weight alpha, and r_i is the rank of the i-th active from the test set. Then, RIE is defined as:

\[RIE(\alpha) = \frac{N}{n} \frac{\sum_{i=1}^n e^{-\alpha r_i / N}} {\frac{1 - e^{-\alpha}}{e^{\alpha/N} - 1}}\]

Minimal and maximal value depend on n, N and alpha:

\[ \begin{align}\begin{aligned}RIE_{min}(\alpha) = \frac{N}{n} \frac{1 - e^{\alpha n/N}}{1 - e^{\alpha}}\\RIE_{max}(\alpha) = \frac{N}{n} \frac{1 - e^{-\alpha n/N}}{1 - e^{-\alpha}}\end{aligned}\end{align} \]
Parameters:
  • y_true (array-like of shape (n_samples,)) – Ground truth (correct) target values.

  • y_score (array-like of shape (n_samples,)) – Target scores, e.g. probability of the positive class, or similarities to active compounds.

  • alpha (float, default=20) – Exponential weight, roughly equivalent to 1 / fraction from EF.

References

Returns:

score – RIE value.

Return type:

float

Examples

>>> import numpy as np
>>> from skfp.metrics import rie_score
>>> y_true = [0, 0, 1]
>>> y_score = [0.1, 0.2, 0.7]
>>> rie_score(y_true, y_score)  
2.996182104771572