Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Julia Talk

Julia Talk

Talk on Julia for statistical programming

Arindam Basu

May 06, 2018
Tweet

More Decks by Arindam Basu

Other Decks in Education

Transcript

  1. Julia Workshop // Add the venue and timing information Timetable

    9:00am: Workshop begins 10:30am: Morning tea 1.00pm: End of workshop Materials All materials are kept in the github and you can download them directly on your computer. We shall use juliabox and IJulia for this workshop. You can download and play with Julia and IJulia either fromom the best- Inernet or from the provided usb stick. For the workshop, please do as follows: 1. Visit http://www.juliabox.org 2. Log in with your google account 3. Upload the files directly to the filespace and follow along 4. Or, you can clone your git (see for instructions below)
  2. 2 Outline of Presentation – I am more of a

    user – I am not a developer What is Julia? – Interactive – Compiled in Julia – High level and very fast – Write in code easier to understand – Easy to convert from R to julia – Sophisticated type system – Dob’t have to mention types and it just works – Multiple dispatch – Functions recognise what type arguments are – Sophisticated meta programming facilities – like R and Lisp – You can use or invent your own syntax – Most of the standardised libraries implemented as Julia code
  3. 3 – Users are developers Why Julia – high level

    language – eAsy to learn – just in time compiled – interactive and dynamic – designed from the start to be compiled just in time – feels like python or R but performance wise like C – Having everything in the same language – Users are developers – You are writing codes at the level of standard library – open source, free, worldwide community –
  4. 4 Why shall we use it? How to use –

    REPL (Read, eval, print loop) – Install julia and then click on julia and this will lead to this window – How to install julia >> install the current version >> Go to the Julia lang github repository and clone the repository >> make and get to compile that – What is a timeline? (it seems six months ... they make the major release) – Language for early adopters – Juliacon Using julia – Show first REPL, help, semicolon
  5. 5 Using Ijulia – I shall use Juliabox – Or

    I shall send instructions to use Julia – How to obtain and install julia? – No installation needed, use juliabox.org – Download Juno, the Julia IDE – Download Julia from http://julialang.org and install, and use the REPL interface – Type Julia commands in a text file and use “include(“my- file.jl”)” in the REPL – Download Anaconda Installer after Julia download and use the Anaconda Installer to install Jupyter notebook. – To start jupyter use “jupyter notebook” at the command prompt
  6. 6 How to obtain help and learn about Jupyter? –

    Docs.Julialang.org – This is the most comprehensive source of learning Julia and its inner structure – Individual “Readme.md” files at the Git repository of indi- vidual packages – Julia discussion groups – Julia users – Julia developers – Juno users – For a comprehensive listing check the Julia language community page – Julia-stats is useful for statistical programming related issues – Using “?” within REPL or in the console, for example ? Using Julia – Everything in Julia is an expression
  7. 7 – You can use Packages to extend the function

    of Julia - List of Packages in Julia – Use the web to get a list: https://github.com/JuliaOpt/JuMP.jl – From within REPL or other console, type: Pkg.available() – You can see how many packages are installed and what are they by typing: Pkg.installed() – You can update packages by typing: Pkg.update() – You can install new packages by typing: Pkg.add("type the package name"), so for example if you want to install the package “Winston”, do: Pkg.add("Winston") Julia will then install the package and all its dependencies
  8. 8 – You can add a package if it is

    not in the list by typing: Pkg.clone("git URL of the package name ending in .jit"), for example, you can install a tables package this way, Pkg.clone("git://github.com/nalimilan/ Tables.jl.git") – You can remove a package from Julia by doing: Pkg.rm("name of the package") – For a more in-depth introduction to packages in Julia, read http://docs.julialang.org/en/release-0.4/manual/packages/ Expressions in Julia – It is part of metaprogramming – A good resource to learn more about expressions in Julia is http://gray.clhn.org/dl/macros_etc.pdf http://docs.julialang.org/en/release-0.4/manual/metaprogram- ming/ https://en.wikibooks.org/wiki/Introducing_Julia/Metaprogram- ming
  9. 9 Functions in Julia – Follows the general pattern of

    function NameofFunction(arguments)
 Function statements;
 end
 
 call the function by NameofFunction(arguments list) Note that functions are written without needing to write any curly brackets etc. Just statements and name of the function de- clared. An example, function myadd(x,y)
 z = x + y
 end
 
 If I called myadd(2,2) somewhere else, it’d produce 4.
  10. 10 Reading a Data Frame Doing tabulations and cross tabulations

    Summary Statistics Graphics in Julia Shortcomings and way forward Thoughts and Next Steps