News for hackers. Stuff that matters.
Re:Flashlight: Fast and flexible machine learning in C++ by dynamite-ready on Friday April 16, 2021 @05:03PM (#26839060)
Does anyone else think that C++ makes more sense for ML work than Python? I'd been thinking so for years. Both for deployment/performance and data wrangling purposes.
Re:Flashlight: Fast and flexible machine learning in C++ by teruakohatu on Friday April 16, 2021 @06:24PM (#26839724)
Take a look at Julia's Flux.jl. It has a really nice API and is quite intuitive to use at a low level, and has higher level components as well.

Julia has a fast maturing data wrangling super-project (Queryverse).

Re:Flashlight: Fast and flexible machine learning in C++ by dynamite-ready on Saturday April 17, 2021 @02:20AM (#26842011)
I'm guessing you'd have (slightly) fewer deployment options with Julia though.
Re:Flashlight: Fast and flexible machine learning in C++ by flemishgun on Friday April 16, 2021 @09:16PM (#26840798)
100% agree, and there are a number of efforts in the space. mlpack (https://www.github.com/mlpack/mlpack/), Shogun (https://www.shogun-toolbox.org/), and Shark (https://www.shark-ml.org/) are three that have been around for over a decade now. They're a little niche because C++ is not that popular for data science, but they are generally pretty fast (especially mlpack, which focuses on speed).
Re:Flashlight: Fast and flexible machine learning in C++ by codebolt on Friday April 16, 2021 @05:30PM (#26839288)
Absolutely. In 2010 I used FANN for my Msc thesis research, and found it pretty easy to make my own little training sim for stock price data on top of it. Haven't done any ML work since, but I always scratched my head over how Python became the most popular language for this domain.
Re:Flashlight: Fast and flexible machine learning in C++ by person_of_color on Friday April 16, 2021 @08:10PM (#26840424)
stock price ml? why aren’t you rich?
Re:Flashlight: Fast and flexible machine learning in C++ by dynamite-ready on Saturday April 17, 2021 @02:17AM (#26842001)
Who says they're not...
Re:Flashlight: Fast and flexible machine learning in C++ by whimsicalism on Friday April 16, 2021 @05:05PM (#26839083)
In general, I think languages with static typing are preferable.

C++ seems ideal for me right now because it is the only other language with a somewhat mature stack (perhaps Julia as well, but I haven't played too much around with that).

Re:Flashlight: Fast and flexible machine learning in C++ by eigenspace on Friday April 16, 2021 @05:22PM (#26839219)
Julia is dynamically typed FYI. However, I find that usually when people say they want a statically typed language, they don't actually want static typing (which is just a restriction of language semantics), but instead they want a language with a powerful type system that does work for them.

In this case, julia absolutely is worth checking out. It does static analysis on it's intermediate representation to automatically identify and isolate statically inferrable regions of programs and then stitches them together if it ever encounters any dynamism.

Julia's type system is extremely powerful and expressive and can do a lot of things that are incredibly difficult in fully static languages precisely because it does allow dynamism.

Re:Flashlight: Fast and flexible machine learning in C++ by antpls on Friday April 16, 2021 @07:26PM (#26840142)
In my opinion, no, it makes no sense to write ML in C++ :

- Python allows for higher level description of algorithms, which means researchers can focus more on the ML stuff and less on low level details.

- There is no performance gain in going from Python to C++, because in both cases the models are compiled to specific binary formats to be executed on dedicated hardwares. TensorFlow enables accelerators not only for training, but also for data transformations and preprocessing.

Re:Flashlight: Fast and flexible machine learning in C++ by v8dev123 on Friday April 16, 2021 @10:43PM (#26841201)
You will see Modern C++ more like Python these days. It has really neat stuff. A comment is not enough to describe this.
Re:Flashlight: Fast and flexible machine learning in C++ by beltsazar on Saturday April 17, 2021 @12:37AM (#26841616)
> There is no performance gain in going from Python to C++

The backend of TF/PyTorch is written in C++ anyway, so the more complex the model, the less time it needs to spend in the glue code (frontend) that is written in Python. Therefore, rewriting complex models in full C++, for example by using TF/PyTorch C++ API, probably won't much improve the performance.

In this paper the author rewrites some ML models in Rust using tch-rs (Rust binding for PyTorch C++ API) and finds the performance not that much better (even some models perform worse):

https://www.aclweb.org/anthology/2020.nlposs-1.4/

Re:Flashlight: Fast and flexible machine learning in C++ by mpfundstein on Friday April 16, 2021 @06:32PM (#26839784)
yes. especially with AI on the edge.