r/MachineLearning • • May 08 '15

Julia, the scripting language of the future. Really.

http://polystat.blogspot.ca/2015/05/of-programming-for-machine-learning.html
81 Upvotes

57 comments sorted by

7

u/rm999 May 08 '15

Julia is a great, modern language. But I worry it's too late to the game, and at best will fracture an already-crowded field. After a lot of initial excitement a couple years ago, I don't know a single person who actively even plays around with Julia. Meanwhile, R and Python work really well for most problems I encounter, and Spark works in distributed environments. Are any of these as good as Julia? Maybe not. But that alone doesn't mean Julia will succeed.

1

u/LokiNjord May 10 '15

I think that what Julia really needs, amongst other things, is a wrapper on Theano. That would make it a true ML contender. Importing Python code is easy in Julia, that being said, Theano does some AST analysis to get its symbolic equation system going, which would probably break with the importation in Julia. This might be wrong, and might actually work, I haven't tried it, nor do I no the specifics about Theano's implementation.

10

u/jostmey May 08 '15

I play around with ANN in my spare time, and I've found Julia to be a wonderful language. My code looks clean and compact thanks to the built in matrix operators. For scientific computing it feels like the right tool for the job, except of course that it has few native libraries because the language is so new. My only complaint right now is that Julia is really slow at computing an outer product (Why?), but I expect this to be fixed soon.

5

u/atdk May 09 '15

Python 3.5 has inbuilt matrix multiplication operator.

27

u/kjearns May 08 '15

I think Julia is a really nice language, but imo it still has a long way to go before it is ready for use.

The last time I checked in (maybe 6 months ago now?) they were still arguing over whether or not the language should be allowed to have a mutating += operator. I'm glad they're taking language design seriously (look at R or PHP for examples of what happens when you don't do that) but the fact that such basic things are still in flux is a really strong signal of not-ready-ness.

17

u/csp256 May 08 '15

The title did say "of the future".

8

u/kebabmybob May 09 '15

I honestly don't see what's wrong with Rs design.

11

u/Lycur May 09 '15 edited May 09 '15

It's pretty unintuitve/inconsistent with how it's commands are implemented. It's fine as a base platform for which people release imperative statistical analysis packages (which is mostly how it's used), but as a programming language it's pretty painful to use relative to its more carefully designed cousins.

4

u/[deleted] May 09 '15

Hmm, yeah me either. It wasn't really designed to make any part of a web app stack or pretty desktop software. It's a statistical computing language.

3

u/[deleted] May 09 '15

The problem is when you need to do more than use a black box library with a ready made algorithm. When you need to actually implement your own algorithms and data process pipelines, the lack of proper language engineering is a pain.

For importing libraries, reading files, calling a few functions and plotting the results R is OK. Anything a bit more involved than this is a pain.

1

u/[deleted] May 10 '15

It's pretty rare I have to do that in practice, usually I only need what's already available because we have other things doing heavy lifting (Redshift, MySQL/PHP scripts). I can see your point though. Object oriented programming in R is a real pain, and there's no formal language definition.

At least you can call out to C I guess.

-2

u/[deleted] May 09 '15

Yeah, R is more ugly, confusing, and scary to outsiders than it is poorly designed. Once you get the hang of it, it is the absolute best-designed language in the world for general-purpose statistical learning and data analysis.

4

u/kjearns May 09 '15

You are confusing the language design with the availability of libraries. R has a ton of really powerful statistical tools, in spite of being a terrible language.

3

u/[deleted] May 09 '15 edited May 09 '15

whether or not the language should be allowed to have a mutating += operator.

What are the arguments against it?

Edit: After googling, there's a discussion here: https://github.com/JuliaLang/julia/issues/7052

I'm not going to even attempt to summarise.

4

u/Foxtr0t May 08 '15

I agree. The devil is in the details. When I tried Julia recently, it took 10 or 15 seconds to start on Windows and it forced its own terminal colors (I'd be fine with my defaults, no need to set text to grey, thank you). When they iron out such things, there will be adoption.

1

u/[deleted] May 09 '15

Oh my god, who cares? It's mildly convenient and mildly ugly. Maybe there are subtleties about the compiling or some such, but the well-designedness of a language cannot possibly depend on the existence of +=.

C did it one way and Python did it the other way, they're both great languages, make a decision for crying out loud.

Sounds like the old chestnut about academia, where the heatedness of an argument is inversely proportional to its importance.

2

u/kjearns May 09 '15

I think you completely missed the point of my post. The fact that they are still arguing about something so basic is what's worrying, not specifically the lack of a mutating +=.

-1

u/farsass May 09 '15

Sounds like the old chestnut about academia, where the heatedness of an argument is inversely proportional to its importance.

aka bikeshedding, nothing academia related. your personal frustrations are leaking.

2

u/[deleted] May 09 '15

oops, your correct prediction rate about me is 0%, find a better model...

7

u/cafedude May 09 '15 edited May 10 '15

I did a couple of work projects (image processing) in Julia recently. I really like the language. Multi-methods required a bit of a thought-shift initially, but now I think they're a really nice feature. The REPL is great, it has a lot of features that I now miss when I'm in Python's (being able to search through history and get the signature(s) for any functions, tab completion, are a few examples. You can even get a dump of the LLVM and machine code for a function). Lots of stuff to like.

There is one glaring problem that I ran into: anonymous functions (closures, lambdas, whatever your preferred term is) are very much slower than regular functions and lots of memory gets allocated (this is due to the interaction of untyped anonymous functions with Julia's type inferrence which has to deal with multi-methods). If you're used to programming in a very functional style (maps instead of for-loops, for example) you're going to find that performance sucks. The good news is that the Julia devs are aware of this and there are some proposals on the table for fixing this problem - I suspect by the end of this year it won't be as much of an issue.

2

u/[deleted] May 09 '15 edited May 09 '15

Can you explain multi-methods please.

Edit: Okay I googled to answer myself: http://en.wikipedia.org/wiki/Multiple_dispatch

1

u/[deleted] May 09 '15

that I now miss when I'm in Python's ( being able to search through history

Just enable readline in the python repl. This should be default since python 3.4

You can even get a dump of the LLVM and machine code for a function

You can't get LLVM or machine code dump of Python because it's not LLVM based but you can get bytecode for any function in python using dis library, which has been in python since forever.

2

u/geggo98 May 08 '15

A little bit OT, but I am really surprised that Java and JavaScript performed so good when compared with Fortran and C. So ML in Scala (Java based) should perform OK on the CPU. Of course things are completely different when one takes the GPU into account.

5

u/LokiNjord May 08 '15

The huge commercial importance of these languages has caused huge investments in quality optimizing compiler/interpreter solutions

1

u/wilsoniya May 08 '15

This is the right answer. Google has poured likely billions into V8. Sun poured billions into the hotspot JVM.

1

u/Smallpaul May 14 '15

Billions? No. Tens of millions: that's more likely.

V8 has 207 contributors.

https://www.openhub.net/p/v8-js

Let's double that to include shadow contributors like project managers and community evangelists. So now we're at 414.

To have spent a single billion, Google would have had to have paid those people 2,415,458 on average.

Google is way too saavy to spend billions on any single software development project, especially something as tight and controlled as a language runtime.

7

u/kevjohnson May 09 '15

Speed doesn't matter when there's no libraries. Most of the time labor is more costly than computational time. I'm not going to spend time writing a standard algorithm from scratch when I can load up an R package or a Python library that does it all for me with more features.

I'm not disagreeing with the blog post. I agree with the final statement.

All in all, even though Julia is still a bit too young to be fully considered for production code, it is an extremely promising project that I would watch really closely.

Julia's not there yet, but it has potential to be a big player. I've had my eye on it for a while and to be honest progress has been slow. It's been 3 years now and it's not even close to being ready to take over. R is extremely mature and Rcpp allows you write pretty fast code if you need to. I like Julia better from a language design perspective but speed alone is not going to cut it.

13

u/hntd May 08 '15

See that's the thing, if I'm scripting on my local work machine then I'm not gonna plug TBs of data through, I know this isn't gonna work at all. With small data you probably aren't gonna notice any difference in program performance and you probably don't want to write production machine learning code in a scripting language. Besides, most of the Python implementations are C backed or the Java/Scala ones use the JNI, rarely is it pure Python/Java behind it.

Don't get me wrong julia looks fantastic, but the reasons for adopting it aren't necessarily the ones I'd want. I'd take a performance hit for clean interfaces, functionality and easy/naturally written code, which I think Python or R is better for. When I wanna write production stuff, I'm gonna go Scala/Java or C/C++ every single time.

4

u/wiekvoet May 08 '15

does Scala have matrices? With a reasonable set of functions for them?

7

u/hntd May 08 '15

There is Breeze, which is a pretty complete linear algebra library. It also uses netlib, which is backed by the BLAS/Lapack on top of JNI. It's what apache spark uses for it's linear algebra and it's what we use in production. It's pretty complete in my opinion, but what your specific needs are may vary.

https://github.com/scalanlp/breeze

3

u/PracticalPilot May 09 '15

I've been actively using Julia every day for the past two months and find the code elegant, terse, and easy to compose. I think the ccall interface is incredibly easy to use and I don't touch Python or R anymore.

3

u/[deleted] May 09 '15 edited May 09 '15

Julia is interesting but the speed comparisons are complete strawmen. No mature practitioner of the compared languages would use the implementations they did.

I hope Julia succeeds at what it is trying to do. But AFAICT right now there is no reason whatsoever to use Julia, unless you're an extremely eager early adopter personality. The best that can be said is this might, N years from now, be a highly productive language for some niches in machine learning and related fields. Even if the language took off today it would probably take at least a decade to develop the libraries that make R and Python the reigning champions.

2

u/[deleted] May 09 '15

Give me CUDA arrays like https://github.com/torch/cutorch and I'm all game.

3

u/ICABasic May 09 '15

Did they have to give it the name of my ex girlfriend?
Looks interesting though.

1

u/lozj May 09 '15

if they can get people writing neuralnet packages on it, then i'll start using it.

2

u/jobbu May 11 '15

Nicely designed CUDA backed NN lib (inspired by Caffe): https://github.com/pluskid/Mocha.jl

1

u/mszlazak May 11 '15

Why would I use Julia over Torch 7 ??

-16

u/[deleted] May 08 '15

IMO, the fact that there are so many computer programming languages in the world is a sign that there is something fundamentally wrong with computing. We took a wrong turn a while back.

2

u/[deleted] May 09 '15

I think is is more a sign that we are stuck.

1

u/[deleted] May 09 '15

Eh, I'm pretty hopeful by the signs of data manipulations becoming more standardized. Scala, Python and R now all have pretty consistent dataframe operations, so we must be doing something right.

-9

u/[deleted] May 09 '15

No. A computer program is a sensorimotor, behaving machine. We should be thinking in terms of sensors, effectors, environment (data), stimulus, response, action, reaction, etc. The idea that the computer is for the execution of algorithms is a bankrupt idea and should be retired.

3

u/yoyEnDia May 09 '15

Looks like that model is working pretty well from where I'm standing.

0

u/[deleted] May 09 '15

The linguistic approach to programming is hopelessly wrong. We would be several orders of magnitude more productive if we had the right compositional model. The current model sucks because it was not originally designed with parallel processes in mind. Now it's the tower of Babel, a big messy kludge.

2

u/[deleted] May 09 '15

LOL. This is an orgy of hate.

0

u/[deleted] May 09 '15

[deleted]

2

u/LokiNjord May 10 '15

the key word here I think is "easily". Of course you can have an elevated level of abstraction in C++. Being a software engineer, this feels like it would be fairly easily achieved. The truth of the matter however is that a significant portion of the field of Machine learning/Data science/Machine intelligence/Big data is composed of people with a math/statistics background instead of a CS/Soft. Eng./Comp. Eng. background, and that the low level gotchas of C/C++ and the groundwork necessary to obtain the desired high level expressive features might feel overwhelming / unattainable to them.

0

u/[deleted] May 10 '15

[deleted]

2

u/LokiNjord May 10 '15

let's agree to disagree.

2

u/[deleted] May 09 '15

Haskell in machine learning or in industry in general? I disagree with the article on the point about C++ but it'll be interesting to see where Julia goes. It's still a work in progress but it may provide an alternative to Cpp for those who are more comfortable with the pythonic-style Julia offers.

0

u/[deleted] May 08 '15

[deleted]

7

u/LokiNjord May 08 '15

Of course. When your problem scales up though, that 15-50 x acceleration rate is pretty useful, as I'm sure you'll agree.

1

u/swilts May 08 '15

depends on application, but yes in principle.

0

u/[deleted] May 08 '15

[deleted]

3

u/swilts May 08 '15

Data.table alone has kept me from porting large projects because it's just easier to do in R. My sense is that for a lot of things whinging about slowness is from people who don't know how to use R to its fullest potential.

0

u/[deleted] May 08 '15

[deleted]

4

u/swilts May 09 '15

Did you mean recursion?

5

u/JanneJM May 09 '15

Please re-read the parent comment.

1

u/[deleted] May 09 '15

I second this. Writing Rcpp code inside Rstudio 0.99 preview has become amazingly easy.

It's almost as easy as writing an R function, with a few extra annotations. No makefiles, builds, etc. -- Ctrl-Shift-Enter is all one needs to do to run the code.

2

u/[deleted] May 09 '15

You will probably use C++ before you use Python. Rcpp is great.

1

u/swilts May 09 '15

What would be something I would want to do with it for example?

1

u/[deleted] May 09 '15

Speed and scalability.