Hacker News new | ask | show | jobs
by maaaats 2918 days ago
I don't do much ML (this kind of ML at least), so I know I'm not the target audience for these libraries. But I'd wish they were written in some language with static typing for IDE help. The API interface/tweaks-to-be-done for some of them is enormous, and mostly undiscoverable.

I mean, just looking at the "getting started, 30 seconds to Keras"[0], there are so many magic strings and options. Of course, if one is well-versed in this domain, they make sense. But it's hard to grasp, and Keras is supposed to be the high-level one.

[0]: https://keras.io/

5 comments

I've been recently following the course over at fast.ai and I'm having the same issue. The API is, as you mentioned, undiscoverable, and I don't really want to look at the source code, which is kind of unreadable anyway ([0]). The course itself is littered with poorly readable code ([1]) such as:

to_np(m.ib(V(topMovieIdx)))

Why, just why.

Despite all this, I wholeheartedly recommend this course, it demystified DL for me.

[0]: https://github.com/fastai/fastai/blob/master/fastai/model.py

[1]: https://github.com/fastai/fastai/blob/master/courses/dl1/les...

I kind of agree. I find the way the fastai library (which builds on PyTorch) is written does not match my personal preferences very well. That being said I still really enjoy working with it and the courses do guide one along quite well. I'd actually recommend it for anyone who just wants to get started and play around. It's fairly easy to get good results on a gaming box (say 1080 GTX) reasonably quickly. I also like the Jupyter Notebook approach that they use for the lectures. It encourages experimenting around and they also encourage you to dive into the library and read source code which is good. Alas I find the terse style complicates it a bit but that may very well be personal preference. It's also good to know that they try to implement interesting papers quickly.

I think overall if your goal is to use a preexisting architecture to get quick results fastai is a great point to start. If you want to build your own architecture, reach one level of abstraction lower. Edit: I liked this PyTorch youtube series quite a bit: https://www.youtube.com/watch?list=PLlMkM4tgfjnJ3I-dbhO9JTw7...

The terseness is intentional[0], following the idea that "brevity facilitates reasoning". I don't 100% agree with it, but at least there's reasoning behind it instead of just laziness.

[0]: https://github.com/fastai/fastai/blob/master/docs/style.md

I've never seen this code before: to_np(m.ib(V(topMovieIdx)))

but I can guess that topMovieIDx is the index of the top movie, V converts to a vector(?), dunno about m.ib, and to_np is converted to a numpy array.

I fully agree with you. While I can't speak for Keras, after reading [1] it seems Tensorflow would very much benefit from strong types. You'd easily be able to catch most of the errors presented in the article with higher-kinded and linear types, and maybe you don't even need that much power.

[1]: https://jacobbuckman.com/post/tensorflow-the-confusing-parts...

I totally agree, the lack of documentation via types and lack of smart autocomplete (which I rely on very heavily for API discovery) is not only why I never got into tensor flow, it's also why I never got into languages like python. I even went so far as to use typescript instead of Javascript.

I do believe c# has some machine learning libraries, but afaik they aren't anywhere near the level of tensor flow or keras.

Scala and Java both have access to really great ML libraries, MLLib in particular is supposed to be really good. I've used it a little but I'm not really a ML expert to judge.
But I'd wish they were written in some language with static typing

CNTK has a C++ API but the documentation is unfortunately just "read the header file" https://docs.microsoft.com/en-us/cognitive-toolkit/cntk-libr...

Also Python obv, or use it as a backend to Keras (in R).

Try DeepLearning4J, it's based on Java, and is pretty kick-ass.