bits of sklearn in golang

195 views
Skip to first unread message

Pascal MASSCHELIER

unread,
May 15, 2018, 6:21:41 AM5/15/18
to gonum-dev
Hi gophers,

Hi I'm a french 49yo engineer, developer living near Paris (fr)

I started to port some bits of a sklearn in golang, relying (obviously) heavily on gonum.

Since I've got only two hands an old limited head, it's very incomplete, but you may find some bits useful.

Suggestions and pull requests are very welcome.


Best regards
Pascal

Sebastien Binet

unread,
May 15, 2018, 7:47:00 AM5/15/18
to pascal.ma...@gmail.com, gonum-dev
Hi Pascal,
I've only skimmed through the docs and a few of the types+funcs.
it sure is a lot of code and features you've implemented.

really happy to see Gonum (and Gorgonia!) being leveraged that way.

I'd even be tempted to try it out (even more if there was a DBSCAN equivalent [1])
I guess it could even be integrated into a few packages under Gonum... (after some due code review process to follow Gonum coding rules)
I'd be voting +1 for it.

have you been using it in some work at Centrale ?

cheers,
-s

Pascal MASSCHELIER

unread,
May 15, 2018, 7:33:30 PM5/15/18
to gonum-dev
Hi Sebastien,

I used gorgonia to evaluate it. The idea behind it (autodifferentiation, theano) looked very promising to me and chewxy has done a beautiful piece of code, but unfortunately, poor timings of my attempts made me reject it for all cases where i know how to differentiate loss function with respect to weights.

So I plan to remove this dependency for sklearn, even if i keep the idea in a corner of my head. Perhaps someone will help chewxy with ideas for a faster lispmachine.

I've not done dbscan but I started sklearn/cluster this evening with kmeans I needed for a project. I was not even aware this dbscan algorithm existed. But it has interest for me too and I'll do it, possibly this week end.

I'll reread gonum coding rules

I left Centrale in 1993 when I got my engineering degree. I worked in 3 small companies, doing software for finance, e-learning, e-commerce and search engine with C, Perl, C++, Coldfusion, Java, PHP, C++ php modules, nodejs

The story in the last one is ending because company has been sold and I want to change employer and do more a more useful work.

I plan to enter in a few weeks in a new company working on energy saving systems, and it is this new project which drove me to take some AI courses (v achievements on my linkedin) discover python theano keras and scikit-learn. I've been impressed with the vast amount of high quality python modules but when I started to do real work with it, I found that python was slow (for not cythonized parts) and mostly one-thread-bounded. The joblib or multiprocess modules can help when workflow can be splitted but they have a non-negligible launch-process overhead.

Go has been thought for modern architectures, has a clean design, a comprehensive tooling, is a compiled language, seems easier/faster to code than C++ and more arch-agnostic. I tried it, and loved it, even if I miss templates.

Unfortunately Go has not today the module richness of python.
gonum is a good numpy-like. 
golearn looks good but I wanted to make my own, as an exercise, more closer to sklearn api and without relying on C libs. I can't pretend it's better (and it is probably not, today), I did'nt really try golearn.

cheers,
Pascal









Dan Kortschak

unread,
May 15, 2018, 7:43:38 PM5/15/18
to Pascal MASSCHELIER, gonum-dev
Hi Pascal,

I had a brief look through and it seems that there is a fair amount of
duplication of code in sklearn that we already provide in gonum (or
have near matches that could be changed/extended to match what you
have). If you'd like me to go through that in more detail, please let
me know.

Dan

On Tue, 2018-05-15 at 03:21 -0700, Pascal MASSCHELIER wrote:
> Hi gophers,
>
> Hi I'm a french 49yo engineer, developer living near Paris (fr)
>
> I started to port some bits of a sklearn in golang 
> <https://github.com/pa-m/sklearn>, relying (obviously) heavily on

Pascal MASSCHELIER

unread,
May 16, 2018, 4:00:50 AM5/16/18
to gonum-dev
Hi Dan,
Yes please, ideas for improovement are very welcome.
Best regards
Reply all
Reply to author
Forward
0 new messages