Skip to content

Banded Ridge TRFs#222

Open
vinaysraghavan wants to merge 52 commits intomainfrom
banded_ridge
Open

Banded Ridge TRFs#222
vinaysraghavan wants to merge 52 commits intomainfrom
banded_ridge

Conversation

@vinaysraghavan
Copy link
Collaborator

Reference Issues/PRs

What does this implement/fix? Explain your changes.

Adds BandedTRF class for modeling features using TRFs trained with banded ridge regression.
Includes examples showing 1. That banded regularization outperforms standard TRFs by determining regularization separately for each feature and 2. BandedTRFs are dependent on the order of features used

Any other comments?

Copy link
Collaborator

@gavinmischler gavinmischler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty useful functionality! Just a few comments, and we should try to get the doc-render working

@codecov
Copy link

codecov bot commented Feb 24, 2026

Codecov Report

❌ Patch coverage is 91.39785% with 16 lines in your changes missing coverage. Please review.
✅ Project coverage is 74.41%. Comparing base (8be3445) to head (c84e256).
⚠️ Report is 50 commits behind head on main.

Files with missing lines Patch % Lines
naplib/encoding/banded_trf.py 90.53% 16 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #222      +/-   ##
==========================================
+ Coverage   74.03%   74.41%   +0.37%     
==========================================
  Files          58       60       +2     
  Lines        4287     4718     +431     
==========================================
+ Hits         3174     3511     +337     
- Misses       1113     1207      +94     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vinaysraghavan vinaysraghavan marked this pull request as ready for review February 25, 2026 00:26
vinaysraghavan and others added 3 commits February 25, 2026 13:53
Copy link
Collaborator

@gavinmischler gavinmischler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, last things I didn't realize before, otherwise I think it's ready!

processed_trials.append(delayed.reshape(delayed.shape[0], -1))
return processed_trials

def fit(self, data, feature_order, target='resp'):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, forgot to comment this earlier, but in general it's better if arguments to functions like this which take data also specify all the other args. See TRF.fit() or TRF.predict() for an example. This is helpful because it explicitly shows all the columns of data that are required by the model, otherwise it's unclear what the data should look like. And all args should be kwargs, so data=None is the default. Then, the user can call the function by passing data, or by passing each arg separately, or a combination. This is the purpose of the _parse_outstruct_args function.

This should be done for this and for predict()

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.

2 participants