Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation: expand sparse least squares example to other algorithms (Douglas-Rachford) #79

Open
patwa67 opened this issue Mar 16, 2022 · 7 comments

Comments

@patwa67
Copy link

patwa67 commented Mar 16, 2022

I managed to get most algorithms running on the Sparse regression example, but not the DRLS algorithm. I guess it should be applicable to sparse regression, but what needs to be done with:
drls = ProximalAlgorithms.DRLS(tol=1e-4,verbose=true)
solution_dr, iterations_dr = drls(x0=zeros(n_features+1),f=training_loss, g=reg,gamma=1e-7)

@lostella
Copy link
Member

In that example, a function can be passed as f argument to the proximal-gradient-based algorithms, since gradients will be taken with respect to f via automatic differentiation.

For other algorithms, including DouglasRachford and DRLS, the proximal mapping of f is needed. Therefore a regular Julia function will not work. Instead, you can construct an equivalent function using eg ProximalOperators. For this specific example, something along the lines of this should work, for appropriate A and b and scaling coefficient: this is used a little below exactly with DRLS.

I think this is once again a documentation issue: feel free to leave this open, I’ll just adjust the title.

@lostella lostella changed the title The DRLS algorithm Documentation: expand sparse least squares example to other algorithms (Douglas-Rachford) Mar 16, 2022
@patwa67
Copy link
Author

patwa67 commented Mar 19, 2022

It seems as if ProximalAlgorithms.DRLS(tol = 10 * TOL, directions=acc) doesn't care about the values of the tol parameter.

@lostella
Copy link
Member

It seems as if ProximalAlgorithms.DRLS(tol = 10 * TOL, directions=acc) doesn't care about the values of the tol parameter.

Do you have an example?

It definitely cares about the value of tol, but like other Newton-type methods it may suddenly converge fast to the solution, and therefore appear to be insensitive to the tolerance.

@patwa67
Copy link
Author

patwa67 commented Mar 20, 2022

It's a rather large data set, can I send it by email? I have tested your test_small_lasso.jl and DRLS works fine on that small data, but not on my larger data. The interesting point is that all other methods from that file works fine on my data.

@lostella
Copy link
Member

How big is it? Otherwise you could upload the data somewhere and share the link here, in case it’s fine to have the data publicly available

@patwa67
Copy link
Author

patwa67 commented Mar 24, 2022

test_lasso.zip

@lostella
Copy link
Member

lostella commented Apr 8, 2022

@patwa67 looks like there is a bug in the way DRLS displays progress:

default_display(it, ::DRLSIteration, state::DRLSState) = @printf(
"%5d | %.3e | %.3e | %.3e\n", it, state.gamma / state.gamma, norm(state.res, Inf), state.tau,
)

Fixing it, thanks!

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

No branches or pull requests

2 participants