calculate_predictive_index#
- cinnabar.stats.calculate_predictive_index(y_true: ndarray, y_pred: ndarray) float[source]#
Compute the predictive index as introduced by Pearlman et al. between true and predicted values. [1]
- Parameters:
y_true (ndarray with shape (N,)) – True values
y_pred (ndarray with shape (N,)) – Predicted values
Note
The predictive index measures the correlation between the true and predicted values with a higher weight given to ligand pairs with larger true differences. The final value is between -1 and 1, where 1 indicates perfect ranking and -1 indicates perfectly anti-correlated ranking. It is calculated as:
\[PI = \frac{\sum^n_{j>i}\sum^n_{i}{W_{ij}C_{ij}}}{\sum^n_{j>i}\sum^n_{i}{W_{ij}}}\]where \(W_{ij} = abs(E_{j} - E_{i})\) is a weight based on the true difference between the ligand pairs and \(C_{ij}\) indicates if the rank ordering of the true differences agree with the predicted differences:
\[\begin{split}C_{ij} = \begin{cases} 1 & \text{if } (E_{j} - E_{i})/(P_{j} - P_{i}) > 0 \\ 0 & \text{if } (P_{j} - P_{i}) = 0 \\ -1 & \text{if } (E_{j} - E_{i})/(P_{j} - P_{i}) < 0 \end{cases}\end{split}\]- Returns:
pi – Predictive index between true and predicted values between -1 and 1.
- Return type:
float
References