Skip to content

Commit

Permalink
Add _ridge function for ridge regression
Browse files Browse the repository at this point in the history
  • Loading branch information
FOUCHARD Denis committed Jan 19, 2024
1 parent f85b1c6 commit 9b38655
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions fmralign/hyperalignment/linalg.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,14 @@ def ridge(X, Y, alpha):
return betas


def _ridge(X, Y, alpha):
from sklearn.linear_model import Ridge

ridge = Ridge(alpha=alpha, fit_intercept=False)
ridge.fit(X, Y)
return ridge.coef_.T


def procrustes(X, Y, reflection=True, scaling=False):
r"""
The orthogonal Procrustes algorithm.
Expand Down

0 comments on commit 9b38655

Please sign in to comment.