lasso-net / lassonet

Feature selection in neural networks

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

LassoNet for Cox question

dianashams opened this issue · comments

commented

Hi,
thank you for this model and especially for the extension to the Cox/survival outcomes.

I am trying to test LassoNetCoxRegressor() for the example with the Hnscc data in python 3.9 (and for my own datasets),

I appreciate if you could help with the questions/issues:

  1. It runs model.path() and produces reasonable plots (attached), but the returned model.score(X_test,y_test) is zero (?), which is confusing, also 0 for model.fit(train), model.score(test). Is model.score only works with CV?..
  2. Also, model.path() or model.fit() do not accept data frames, only work with np.array(X_test), np.array(y_test) - but as I write this is probably expected.
  3. A bit more general question - the LassoNet would zero out any input from a predictor, which results with 0 Lasso-optimized weight in the outer loop (i.e. with no linear contribution to the outcome)?
X = pd.read_csv("x.csv")
y = pd.read_csv("y.csv")
model = LassoNetCoxRegressor(
    hidden_dims=(32,),     lambda_start=1e-2,     path_multiplier=1.02,    
     gamma=1,    verbose=True, tie_approximation="breslow")
X_train = np.array(X_train)
X_test = np.array(X_test)
y_train = np.array(y_train)
y_test = np.array(y_test)
path = model.path(X_train, y_train)
plot_path(model, path, np.array(X_test), np.array(y_test))
model.score(X_test,y_test) #0.0

Screenshot_model_score

  1. If you want .fit to produce a good model out of the box you should use LassoNetCoxRegressorCV instead. The LassoNetCoxRegressor.fit function trains on a full path and is not really useful to make predictions.
  2. I just pushed some fix to master. install the latest version with pip install git+https://github.com/lasso-net/lassonet
  3. I don't understand your question