gallantlab / himalaya

Multiple-target linear models - CPU/GPU
https://gallantlab.github.io/himalaya
BSD 3-Clause "New" or "Revised" License
80 stars 13 forks source link

Getting Tuned Alphas for each Feature Band in GroupRidgeCV #23

Closed sreejank closed 2 years ago

sreejank commented 2 years ago

For this code,

from himalaya.ridge import GroupRidgeCV
import numpy as np 
X=np.random.rand(100,100)
X0=np.random.rand(100,100)
Y=np.random.rand(100,5)
model=GroupRidgeCV(groups='input')
model.fit([X,X0],Y)
print(model.predict([X,X0],split=True).shape)
print(model.best_alphas_.shape)

I get a (5,) when I expected (2,5), one for each feature set. Is it possible to get the tuned regularization strength for each individual feature set?

sreejank commented 2 years ago

to add on: I've been using np.exp(model.deltas_) for now, but not exactly sure if I can consider these the "alphas" (as in, the regularization strength of the different bands in banded ridge regression).

TomDLT commented 2 years ago

The regularization strength for each band can be computed with 1. / np.exp(model.deltas_).

sreejank commented 2 years ago

Got it, thanks!