quantlab.model.evaluation.ic_panel_metrics#

quantlab.model.evaluation.ic_panel_metrics(pred, target, *, return_series=False)[source]#

Return the four IC metrics keyed ic, rank_ic, icir, rank_icir.

The IC half of regression_panel_metrics, which calls it: the mean and the information_ratio of one cross_sectional_ic_series and of one cross_sectional_rank_ic_series. It suits predictions whose scale means nothing, such as an ensemble’s average of z-scores, where an error metric would compare units that differ from the target’s.

Parameters:
predarray_like

A 2-D [T, S] panel of predictions.

targetarray_like

A 2-D [T, S] panel of realised values.

return_seriesbool, default False

Also return the two per-row series, as {"ic": ..., "rank_ic": ...} (length T, NaN on a skipped row).

Returns:
dict or tuple

The metrics, or (metrics, series) when return_series is True.

Examples

On the panel from cross_sectional_ic, whose two rows have the same IC, so the ICIR is undefined:

>>> ic_panel_metrics(pred, target)
{'ic': 0.989743318610787, 'rank_ic': 1.0, 'icir': nan, 'rank_icir': nan}