Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

24
Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014

Transcript of Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Page 1: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Zurich Julia Users Group

Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor26th June 2014

Page 2: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Agenda

• 18:00 – Arrival and warm-up• Pizzas / drinks

• 18:45 Pre-Session• Introduction / JuliaCon• A short overview of the performance of Julia compared to MATLAB and R

(Dominik)

• 19:30 Session 1 on general aspects - comparison with R, Python etc., and Julia's relation w.r.t. Data Science (Malcolm)• 20:30 Session 2 one on more specific topics such as Big Data, NoSQL

and parallelization (Malcolm)

Page 3: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

JuliaCon – June 26 and27 in Chicago

http://juliacon.org/

The first-ever Julia conference will take place June 26 and 27 (Thursday and Friday) at the University of Chicago Gleacher Center in Chicago, Illinois. Expect two days of cutting-edge technical talks, a chance to rub shoulders with Julia's creators, and a weekend in a city known for its beautiful lakefront and world-class architecture.

Page 4: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Julia ResourcesThe Julia LanguageJulia (programming language) - Wikipedia, the free encyclopediaJulia Documentation — Julia Language 0.2.0 documentationThe Julia Manual — Julia Language 0.2.0 documentationThe Julia Standard Library — Julia Language 0.2.1 documentationAvailable Packages — Julia Language 0.2.0 documentationNoteworthy Differences from other Languages — Julia Language 0.2.1 documentationJulia DownloadsThe Julia BlogJulia PublicationsUsing Julia in the classroomJuliaCon 2014: June 26-27, Chicago, IL.juliabloggers.com - A Julia Language Blog AggregatorLearn julia in Y Minutesjulia-dev - Google Groupsjulia-users - Google Groups(99+) julia-stats – Google Groups(16) julia-opt – Google GroupsLesezeichen verwalten

Page 5: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Julia - PerformanceCompared to MATLAB, R , (and bit to Python)

Page 6: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Julia Compared to MATLAB, R (and Python)• Functions compared• Recursive Fibonacci• Parse Integer• Array Constructors• Smallest number divisiable by all numbers of a factorial• Numeric vector sort• Slow pi series• Slow pi series, vectorized• Random matrix statistics• Large random number generation and matrix multiplication

Page 7: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Win 7 Pro, 32 bit > 1 = slower than Julia< 1 = faster than JuliaTimings in seconds

Page 8: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Win 8.1,64 bit

Page 9: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Compared to PythonFun With Just-In-Time Compiling: Julia, Python, R and pqRhttp://www.juliabloggers.com/fun-with-just-in-time-compiling-julia-python-r-and-pqr/

function smallestdivisall(n::Int64) for i = 1:factorial(n) for j = 1:n if i % j !=0 break elseif j == n return i end end endend

def smallestdivisall(n): for i in xrange(1, math.factorial(n)+1): for j in xrange(1, n+1): if i % j != 0: break elif j == n: return i

Julia Python

This problem is calculating the smallest number that is divisible by all of the numbers in a factorial. For example, for the numbers in 5!, 60 is the smallest number that is divisible by 2, 3, 4 and 5.

Julia is about 3-6 x faster than Python

but…

Page 10: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

… it is important to know of which

Python version we are talking about!

Page 11: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Julia Benchmark (Table)C performance = 1.0, smaller is better

Page 12: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Julia Benchmark (Chart)

Page 13: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

@timeit – A quick Look at Macros# using the macro@timeit fib(25) "fib" "Recursive fibonacci"

# the macromacro timeit(ex,name,desc,group...) quote t = zeros(ntrials) for i=0:ntrials e = @elapsed $(esc(ex)) if i > 0 # warm up on first iteration t[i] = e end end @output_timings t $name $desc $group endend

macro output_timings(t,name,desc,group) quote (… hided code …) elseif print_output @printf "%s,%f\n" $name minimum($t) end gc() endend

1. The expression gets evaluated and the elapsed time is measured an stored in e

2. Skip the first measure because it is always sloweras Julia has to initialise the JIT first

1

2

Page 14: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Fast Numeric Computation with Julia

• Devectorize espressions – the opposite to MATLAB• Merge computations into a single loop• Write cache-friendly code• Avoid creating arrays in loops• Use BLAS• Use a 64 bit machine• Julia is faster on Linux and OSX than on Windows

Page 15: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Invitation: NLP++ Community

• NLP++• A programming language for Natural Language Processing• Based on C++• Much easier to learn and understand than C++

• VisualText: An NLP++ IDE• NLP++ Community (http://dev.nlpcloud.net/)• Growing the number of NLP++ developers• Sharing tips & tricks• Improve our analyzers

• If enough interest exists: New MeetUp Group for NLP++ in Zurich!

Page 16: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Start with Julia

Page 17: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Julia Binaries and IDEs

• Download and install the binaries• http://julialang.org/downloads/• Current stable version (May 2014): v0.2.1

• Choose an IDE (both are available for Linux/OSX/WIN)

• JuliaStudio by forio (the one I am using)

• http://forio.com/products/julia-studio/download /• Based on Qt

• LightTable• http://www.lighttable.com/• Based on the Clojure (JVM)• A very interesting approach, it’s worth to give it a try

Page 18: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Julia Docs

The Julia Manual: http://docs.julialang.org/en/release-0.2/manual/

The Julia Standard Library:http://docs.julialang.org/en/release-0.2/stdlib/

Available Packages:http://docs.julialang.org/en/release-0.2/packages/packagelist/

Page 19: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Julia Community

Google Groups• julia-users• julia-dev• julia-stats• julia-opt

Very friendly and no question is too basic .

We use GitHub to track our source code and for trackingand discussing issues and commits. There is also a list of packages for Julia, many of which are also hosted on and developed using GitHub.

Page 20: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Let’s Start with Julia

• Vectors, Matrices, Arrays• Simple Calculations• Functions• Devectorization• Types

http://learnxinyminutes.com/docs/julia/

Page 21: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Where does Julia come from?

Page 22: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

The Creators of Julia

Jeff BezansonStefan Karpinski

Viral ShahAlan Edelman

MIT students and researchers

Page 23: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

«Why we created Julia»

Interactive

Compiled

Keep hackers happyEasy to learn

Easy to install

Linux / OSX / WIN

Gluing programs together like in a shell

Linear Algebra like in MATLAB

String processing like Perl

Statistics like R

Mathematical notation like MATLAB

Macros like Lisp

Dynamism like Ruby

Speed of COpen Source

Liberal licence (MIT)

Page 24: Zurich Julia Users Group Meetup 2 @Stamford Consultants – Meeting Room 2nd Floor 26th June 2014.

Some noteworthy features