top of page

Say Hello to “Julia”

We are all overwhelmed by the programming /scripting language options we have for implementing AI/DL/ML. In this blog post, I am covering the landscape of available options and in specific giving away some beginners dope on Julia.

There are several open source and commercial Machine learning frameworks and tools in the market that have evolved over the last few decades. While the field of Machine learning itself is evolving in building powerful algorithms for diverse requirements across domains, we now see a surge of open source options for large-scale Machine learning that have reached a significant level of maturity and are being widely adopted by the data science and Machine learning communities. [embed][/embed]

The model has changed significantly in the recent past, and the researchers are encouraged to publish their software under an open source model. Since there are problems that authors face while publishing their work in using algorithmic implementations for Machine learning, any work that is reviewed and improvised through usage by the data science community is considered to be of more value.

The following concept map depicts some important commercial and open source Machine learning frameworks and tools in the market.

Some of these libraries are around specific programming languages such as Java, Python, C++, Scala, and so on. Some of these libraries like Julia, Spark, and Mahout already support distributed, and parallel processing and others such as R and Python can run as MapReduce functions on Hadoop.


Julia, in the recent times, has gained much popularity and adoption in the Machine learning and data science fields as a high-performance alternative to Python. Julia is a dynamic programming language that is built to support distributed and parallel computing, thus known to be convenient and fast.

Performance in Julia is a result of the JIT compiler and type interfacing feature. Also, unlike other numeric programming languages, Julia does not enforce vectorization of values. Similar to R, MATLAB, and Python, Julia provides ease and expressiveness for high-level numerical computing.

Following are some key characteristics of Julia:

  1. The core APIs and mathematical primitive operations are written in Julia

  2. It consists rich types for constructing and describing objects

  3. Julia supports for multiple dispatch that enables using functions across many combinations of arguments

  4. It facilitates the automation of specialized code generation for different argument types

  5. Proven performance is on par with statically compiled languages like C

  6. It is a free and open source programming language (MIT licensed)

  7. User-defined types are as fast and compact as built-ins

  8. It does not enforce or require vectorisation code for performance

  9. It is designed for distributed and parallel computation

  10. Julia comes with co-routines, lightweight threading

  11. Julia supports the ability to invoke the C functions directly

  12. Shell-like capabilities for managing processes.

  13. It provides Lisp-like macros

Setting up Julia

We will be using Julia’s latest version that was available at the time of writing this book-v 0.3.4. Julia programs can be built and executed:

  1. Using Julia command line

  2. Using Juno-an IDE for Julia

  3. Using a ready-to-use environment at, where the Julia environment can be accessed using browser

Programming Syntax

Julia compiles the code at runtime and translates each method into a machine code using just-in-time (JIT) compilers. Internally, it utilizes Low-Level Virtual Machine (LLVM) for optimization and code generation. LLVM is a full-fledged project that is a collection of standard compiler technologies. This is used as a part of iOS.

From the shell of choice, run the following:


Alternatively, open the Julia console from the Julia command line installation and run the following command:

julia> include(“<<path/to/juliascript>>/myjuliascript.jl”)

Julia comes with several packages that have inbuilt functions and support many out-of-box features for implementing Machine learning algorithms as well. Following is the list: Images.jl, Graphs.jl, DataFrames.jl, DimensionalityReduction.jl, Distributions.jl, NLOpt.jl, ArgParse.jl, Logging.jl, FactCheck.jl, METADATA.jl

More details on Julia packages can be accessed at


This section covers the integration aspects of Julia with various pother programming languages.

Integrating with C

Julia is flexible and without any wrappers, supports invoking C functions directly. Following is an example that demonstrates how this is done:

julia> ccall(:clock, Int32, ())2292761julia> ccall(:getenv, Ptr{Uint8int8}, (Ptr{Uint8},), “SHELL”)Ptr{Uint8} @0x00007fff5fbffc45julia> bytestring(ans)”/bin/bash”

Integrating with Python

Similar to the C function calls, Julia supports invoking Python functions directly. It is important that we have the PyCall package installed to be able to do so. PyCall.jl offers automatic type conversion between Julia and Python. For example, Julia arrays are converted to NumPy arrays.

Following is an example that demonstrates invoking Python functions from the Julia code:

julia> using PyCall # Installed with Pkg.add(“PyCall”)julia> @pyimport mathjulia> math.sin(math.pi / 4) — sin(pi / 4)0.0julia> @pyimport pylabjulia> x = linspace(0,2*pi,1000); y = sin(3*x + 4*cos(2*x));julia> pylab.plot(x, y; color=”red”, linewidth=2.0, linestyle=” — “)julia>

Integrating with MATLAB

Following example demonstrates integrating Julia to invoke MATLAB functions:

using MATLABfunction sampleFunction(bmap::BitMatrix)@mput bmap@matlab bmapthin = bwmorph(bmap, “thin”, inf)convert(BitArray, @mget bmapthin)end

I hope this blog helped you get acquainted with what Julia is and how that can be executed. In the next blog to follow, will cover how to build and run supervised and unsupervised learning algorithms within Deep learning using Julia. [embed][/embed]

4 views0 comments

Recent Posts

See All
bottom of page