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

translate coordinate descent to cython #104

Open
jasmainak opened this issue May 20, 2016 · 12 comments
Open

translate coordinate descent to cython #104

jasmainak opened this issue May 20, 2016 · 12 comments

Comments

@jasmainak
Copy link
Member

I just chatted with @rvraghav93 and he is willing to help us with cython code.

This might be a good starting point: https://github.com/scikit-learn/scikit-learn/blob/master/sklearn/linear_model/cd_fast.pyx

it might also be easier to benchmark with R / scikit-learn that way.

Also, he mentioned this to check scikit-learn compatibility: https://github.com/scikit-learn-contrib/scikit-learn-contrib

@pavanramkumar
Copy link
Collaborator

sounds great! thanks @rvraghav93

I'm also dropping here is alex gramfort's PR for gap safe screening rules in case we add it to our coordinate descent implementation: https://github.com/scikit-learn/scikit-learn/pull/5075/files

@pavanramkumar
Copy link
Collaborator

Just fyi, I have implemented and tested newton coordinate descent in pure python for the poisson case. It works well, by 5-10x slower than current batch gradient descent code. I'll make a WIP PR of the pure python version once I've done it for other distr. Soon!

Meanwhile, I've been trying to accelerate by jit compiling with numba but it seems less straightforward than I thought. Could use an extra pair of brains and eyes for this once the pure python version is ready.

@jasmainak
Copy link
Member Author

we're going to experiment with cython in the coming weekend hopefully. It's a 4 day weekend here ;) Neither me or @raghavrv have experience with numba though ... WIP PRs are always welcome :)

@pavanramkumar
Copy link
Collaborator

Sounds great! My WIP PR will give you a pure python code so that you can focus on translating to cython or numba. I'll aim to get it in to you guys for Bastille day.

@pavanramkumar
Copy link
Collaborator

Ok, PR is now updated to solve the multinomial case with the cdfast method.

@jasmainak
Copy link
Member Author

Thanks @pavanramkumar ! We almost sat down with the intention of hacking cython today but ended up enjoying food in a delicious asian veg restaurant instead. I blame it on Paris! We'll try to get down to it soon ... hopefully tomorrow :)

@pavanramkumar
Copy link
Collaborator

Hey guys! @jasmainak @raghavrv I haven't been able to carve out time for cython experiments myself, but I ran into SWIG today: http:https://www.swig.org/tutorial.html

A useful alternative to cython could be:

  • write the cdfast() functions directly in C
  • wrap using SWIG

In any case, if you guys want to take a stab at Cython let me know!

@jasmainak
Copy link
Member Author

@pavanramkumar sorry I haven't been able to look into cython yet. But maybe it's a good thing that we don't rush premature optimization.

Do we already have comparable performance (in terms of accuracy) to scikit-learn and R?

@pavanramkumar pavanramkumar changed the title implement coordinate descent translate coordinate descent to cython Sep 21, 2016
@themantalope
Copy link
Contributor

I can start working on this during the weekend.

@jasmainak
Copy link
Member Author

@pavanramkumar I fear we may have to do this before 0.2 release to get respectable timings compared to other packages ... I can dig into this if it's something we really need to prioritize

@sjkoelle
Copy link

Was this ever knocked off?

@jasmainak
Copy link
Member Author

unfortunately not ... we haven't been actively developing. Please feel free to make a PR if you have the bandwidth!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants