himalaya.scoring.r2_score_split_svd

himalaya.scoring.r2_score_split_svd(y_true, y_pred)[source]

Split the R2 score into individual components using relative weights.

When estimating a linear joint model, the predictions of each feature space are summed:

Yhat_joint = Yhat_A + Yhat_B + ... + Yhat_Z

The joint model R2 can be computed as:

R2_joint = R2(Yhat_joint, Y)

This function estimates the contribution of each feature space to the joint model R2 such that:

R2_joint = R2_A + R2_B + ... + R2_Z

This function differs from r2_score_split in the method used to decompose the variance. The function r2_score_split is based on the product measure method, while the function r2_score_split_svd is based on the relative weights method.

This function assumes that y_true is zero-mean over samples.

Parameters
y_truearray of shape (n_samples, n_targets)

Observed data. Has to be zero-mean over samples.

y_predarray of shape (n_kernels, n_samples, n_targets) or (n_samples, n_targets)

Predictions.

Returns
r2array (n_kernels, n_targets) or (n_targets, )

Individual feature space R2 scores.