Skip to main content
`Ctrl`+`K`

# skbio.stats.ordination.MMvecResult.score

MMvecResult.score(X, Y)

  Compute Q-squared (coefficient of prediction) on held-out data.

  \(Q^2\) measures predictive performance on test data, analogous to \(R^2\) but for cross-validation. Values range from -inf to 1, where 1 indicates perfect prediction and 0 indicates prediction no better than the mean.

  \[Q^2 = 1 - \frac{SS_{res}}{SS_{tot}} = 1 - \frac{\sum(y - \hat{y})^2}{\sum(y - \bar{y}_j)^2}\]

  where \(\bar{y}_j\) is the per-target mean across samples.

  Parameters:
    X table_like of shape (n_samples, n_features_x)

      Feature abundance table of the conditioning (X) modality. Columns must match the features used during training.

    Y table_like of shape (n_samples, n_features_y)

      Feature abundance table of the conditioned (Y) modality.

  Returns:
    q2 float

      Q-squared score. Higher is better, with 1.0 being perfect prediction.