Skip to content

Conversation

@chiuhoward
Copy link
Contributor

Add cross-validation function for brain vs covariate comparison

Summary

This PR adds a new function compare_brain_covariates_cv that performs cross-validation to compare brain features (with optional covariate regression) against covariates-only models.

Changes

  • Added IdentityTransformer class for no-op transformations in pipelines
  • Added compare_brain_covariates_cv function that:
    • Compares brain features vs covariates across CV folds
    • Optionally uses CovariateRegressor to remove covariate effects from brain data
    • Returns detailed metrics for each fold including R², MAE, and model coefficients
  • Added comprehensive tests for both new functions
  • Updated __all__ exports

Usage

from afqinsight.pipeline import compare_brain_covariates_cv

results = compare_brain_covariates_cv(
    X_brain, X_covariates, y,
    regress_covariates=True,  # Use CovariateRegressor
    n_repeats=5, n_splits=10
)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant