lasso-net / lassonet

Feature selection in neural networks
MIT License
207 stars 52 forks source link

Passing in lambda_seq does not change default value of lambda_start, causing bug in path() #18

Closed p-smirnov closed 2 years ago

p-smirnov commented 2 years ago

This line here: https://github.com/lasso-net/lassonet/blob/adf0aaf7131a57d8427ae40db7a19e608d6809a4/lassonet/interfaces.py#L450 will evaluate to True if lambda_seq is passed in without setting lambda_start to None. It expects self.lambda_start_ to exist, but that only gets set if lambda_seq is None.

Note setting lambda_start to None in init wouldn't work since lambda_seq can also be passed to path.

louisabraham commented 2 years ago

Hey! I wrote that code quite fast before the NeurIPS deadline.

Here is another way to describe the issue:

What do you think? Could you implement it? I really don't have the bandwidth to even code 3 lines and check whether they work those days...

Also, did you test that new "auto" heuristic? It was something I had been wanting to try for a long time, I implemented it with random constants (for _ in range(10000):, if torch.abs(beta - new_beta).max() < 1e-5, start = 1e-6) and it seemed to work well on all examples.

louisabraham commented 2 years ago

I used this fun trick:

        # extract first value of lambda_seq
        lambda_seq = iter(lambda_seq)
        lambda_start = next(lambda_seq)

        for current_lambda in itertools.chain([lambda_start], lambda_seq):