Julia 1.0 Programming Complete Reference Guide

Book description

Learn dynamic programming with Julia to build apps for data analysis, visualization, machine learning, and the web

Key Features

  • Leverage Julia's high speed and efficiency to build fast, efficient applications
  • Perform supervised and unsupervised machine learning and time series analysis
  • Tackle problems concurrently and in a distributed environment

Book Description

Julia offers the high productivity and ease of use of Python and R with the lightning-fast speed of C++. There's never been a better time to learn this language, thanks to its large-scale adoption across a wide range of domains, including fintech, biotech and artificial intelligence (AI).

You will begin by learning how to set up a running Julia platform, before exploring its various built-in types. This Learning Path walks you through two important collection types: arrays and matrices. You'll be taken through how type conversions and promotions work, and in further chapters you'll study how Julia interacts with operating systems and other languages. You'll also learn about the use of macros, what makes Julia suitable for numerical and scientific computing, and how to run external programs.

Once you have grasped the basics, this Learning Path goes on to how to analyze the Iris dataset using DataFrames. While building a web scraper and a web app, you'll explore the use of functions, methods, and multiple dispatches. In the final chapters, you'll delve into machine learning, where you'll build a book recommender system.

By the end of this Learning Path, you'll be well versed with Julia and have the skills you need to leverage its high speed and efficiency for your applications.

This Learning Path includes content from the following Packt products:

  • Julia 1.0 Programming - Second Edition by Ivo Balbaert
  • Julia Programming Projects by Adrian Salceanu

What you will learn

  • Create your own types to extend the built-in type system
  • Visualize your data in Julia with plotting packages
  • Explore the use of built-in macros for testing and debugging
  • Integrate Julia with other languages such as C, Python, and MATLAB
  • Analyze and manipulate datasets using Julia and DataFrames
  • Develop and run a web app using Julia and the HTTP package
  • Build a recommendation system using supervised machine learning

Who this book is for

If you are a statistician or data scientist who wants a quick course in the Julia programming language while building big data applications, this Learning Path is for you. Basic knowledge of mathematics and programming is a must.

Table of contents

  1. Title Page
  2. Copyright and Credits
    1. Julia 1.0 Programming Complete Reference Guide
  3. About Packt
    1. Why subscribe?
    2. Packt.com
  4. Contributors
    1. About the authors
    2. Packt is searching for authors like you
  5. Preface
    1. Who this book is for
    2. What this book covers
    3. To get the most out of this book
      1. Download the example code files
      2. Download the color images
      3. Conventions used
    4. Get in touch
      1. Reviews
  6. Installing the Julia Platform
    1. Installing Julia
      1. Windows OS
      2. OS X
      3. Linux OS
      4. Building from source
      5. JuliaPro
    2. Working with Julia's REPL
    3. Startup options and Julia scripts
    4. Packages
      1. Adding a new package
    5. Installing and working with IJulia
    6. Installing Juno
    7. Installing julia-vscode
    8. Installing Sublime-IJulia
    9. Other editors and IDEs
    10. How Julia works
    11. Summary
  7. Variables, Types, and Operations
    1. Variables, naming conventions, and comments
    2. Types
    3. Integers
    4. Floating point numbers
    5. Elementary mathematical functions and operations
    6. Rational and complex numbers
    7. Characters
    8. Strings
      1. Formatting numbers and strings
    9. Regular expressions
    10. Ranges and arrays
      1. Other ways to create arrays
      2. Some common functions for arrays
    11. Dates and times
    12. Scope and constants
    13. Summary
  8. Functions
    1. Defining functions
    2. Optional and keyword arguments
    3. Anonymous functions
    4. First-class functions and closures
    5. functions
    6. Broadcasting
    7. Map, filter, and list comprehensions
    8. Generic functions and multiple dispatch
    9. Summary
  9. Control Flow
    1. Conditional evaluation
    2. Repeated evaluation
      1. for loops
      2. while loops
      3. The break statement
      4. The continue statement
    3. Exception handling
    4. Scope revisited
    5. Tasks
    6. Summary
  10. Collection Types
    1. Matrices
    2. Tuples
    3. Dictionaries
      1. Keys and values – looping
    4. Sets
    5. An example project – word frequency
    6. Summary
  11. More on Types, Methods, and Modules
    1. Type annotations
      1. Type conversions and promotions
    2. The type hierarchy – subtypes and supertypes
    3. Concrete and abstract types
    4. User-defined and composite types
      1. When are two values or objects equal or identical?
      2. A multiple-dispatch example
    5. Types and collections – inner constructors
    6. Type unions
    7. Parametric types and methods
    8. Standard modules and paths
    9. Summary
  12. Metaprogramming in Julia
    1. Expressions and symbols
    2. Evaluation and interpolation
    3. Defining macros
    4. Built-in macros
      1. Testing
      2. Debugging
      3. Benchmarking
      4. Starting a task
    5. Reflection capabilities
    6. Summary
  13. I/O, Networking, and Parallel Computing
    1. Basic input and output
    2. Working with files
      1. Reading and writing CSV files
    3. Using DataFrames
      1. Other file formats
    4. Working with TCP sockets and servers
    5. Interacting with databases
    6. Parallel operations and computing
      1. Creating processes
      2. Using low-level communications
      3. Parallel loops and maps
    7. Summary
  14. Running External Programs
    1. Running shell commands
      1. Interpolation
      2. Pipelining
    2. Calling C and Fortran
    3. Calling Python
    4. Performance tips
      1. Tools to use
    5. Summary
  15. The Standard Library and Packages
    1. Digging deeper into the standard library
    2. Julia's package manager
      1. Installing and updating packages
    3. Graphics in Julia
    4. Using Plots on data
    5. Summary
  16. Creating Our First Julia App
    1. Technical requirements
    2. Defining variables
      1. Constants
      2. Why are constants important?
    3. Comments
    4. Strings
      1. Triple-quoted strings
      2. Concatenating strings
      3. Interpolating strings
      4. Manipulating strings
      5. Unicode and UTF-8
    5. Regular expressions
    6. Raw string literals
    7. Numbers
      1. Integers
      2. Overflow behavior
      3. Floating-point numbers
      4. Rational numbers
      5. Numerical operators
      6. Vectorized dot operators
      7. There's more to it
    8. Tuples
      1. Named tuples
    9. Ranges
    10. Arrays
      1. Iteration
      2. Mutating arrays
      3. Comprehensions
      4. Generators
    11. Exploratory data analysis with Julia
      1. The Iris flower dataset
      2. Using the RDatasets package
    12. Using simple statistics to better understand our data
      1. Visualizing the Iris flowers data
    13. Loading and saving our data
      1. Saving and loading using tabular file formats
      2. Working with Feather files
      3. Saving and loading with MongoDB
    14. Summary
  17. Setting Up the Wiki Game
    1. Technical requirements
    2. Data harvesting through web scraping
      1. How the web works – a crash course
      2. Making HTTP requests
        1. Learning about HTTP methods
        2. Understanding HTTPS
    3. Understanding HTML documents
      1. HTML selectors
        1. Learning about the HTML attributes
      2. Learning about CSS and JavaScript selectors
      3. Understanding the structure of a link
    4. Accessing the internet from Julia
      1. Making requests with the HTTP package
    5. Handling HTTP responses
      1. HTTP status codes
      2. Learning about HTTP headers
      3. The HTTP message body
    6. Understanding HTTP responses
      1. The status code
        1. The headers
        2. The message body
        3. Learning about pairs
    7. Dictionaries
      1. Constructing dictionaries
        1. Ordered dictionaries
        2. Working with dictionaries
    8. Using the HTTP response
      1. Manipulating the response body
      2. Building a DOM representation of the page
      3. Parsing HTML with Gumbo
    9. Coding defensively
      1. The pipe operator
    10. Handling errors like a pro
      1. The try...catch statements
      2. The finally clause
      3. Throwing exceptions on errors
      4. Rethrowing exceptions
    11. Learning about functions
      1. The return keyword
      2. Returning multiple values
        1. Optional arguments
        2. Keyword arguments
      3. Documenting functions
    12. Writing a basic web crawler – take one
      1. Setting up our project
      2. Writing a Julia program
      3. Conditional evaluation of if, elseif, and else statements
      4. The ternary operator
      5. Short-circuit evaluation
        1. Beware of operator precedence
    13. Carrying on with the crawler's implementation
    14. Summary
  18. Building the Wiki Game Web Crawler
    1. Technical requirements
    2. Six Degrees of Wikipedia, the gameplay
      1. Some additional requirements
    3. Organizing our code
      1. Using modules to tame our code
      2. Defining modules
        1. Productive REPL sessions with Julia
      3. Setting up our modules
      4. Referencing modules
        1. Setting up the LOAD_PATH
        2. Loading modules with using
        3. Loading modules with import
        4. Loading modules with include
      5. Nesting modules
    4. Setting up our game's architecture
      1. Checking our code
    5. Building our Wikipedia crawler - take two
      1. Using blocks
    6. Implementing the gameplay
    7. Finishing touches
      1. One more thing
    8. Learning about Julia's type system
      1. Defining our own types
      2. Constructing types
      3. Mutable composite types
      4. Type hierarchy and inheritance
      5. Type unions
    9. Using article types
      1. Inner constructors
    10. Methods
    11. Working with relational databases
      1. Adding MySQL support
        1. Connecting to the database
      2. Setting up our Article module
        1. Adding the persistence and retrieval methods
        2. Putting it all together
    12. Summary
  19. Adding a Web UI for the Wiki Game
    1. Technical requirements
    2. The game plan
    3. Learning about Julia's web stack
      1. Beginning with a simple example – Hello World
    4. Developing the game's web UI
      1. Defining our routes
      2. Preparing the landing page
    5. Starting a new game
      1. Extracting the difficulty settings from the page URL
      2. Starting a new game session
      3. Rendering the first Wikipedia article from the chain
      4. Setting up in-article navigation
      5. Displaying information about the game session
    6. Displaying a Wikipedia article page
      1. Navigating back up the article chain
    7. Showing the solution
    8. Handling any other requests
    9. Wrapping it up
    10. Summary
  20. Implementing Recommender Systems with Julia
    1. Technical requirements
    2. Understanding recommender systems
    3. Classifying recommender systems
      1. Learning about non-personalized, stereotyped, and personalized recommendations
        1. Understanding personalized recommendations
          1. Explicit and implicit ratings
        2. Understanding content-based recommender systems
        3. Beginning with association-based recommendations
        4. Learning about collaborative filtering
          1. Understanding user-item CF
          2. Item-item CF
    4. Summary
  21. Machine Learning for Recommender Systems
    1. Technical requirements
    2. Comparing the memory-based versus model-based recommenders
      1. Learning about the model-based approach
      2. Understanding our data
        1. A first look at the data
        2. Loading the data
        3. Handling missing data
      3. Data analysis and preparation
        1. Training our data models
        2. Scaling down our dataset
        3. Training versus testing data
    3. Machine learning-based recommendations
      1. Making recommendations with Recommendation
        1. Setting up the training data
        2. Building and training the recommender
          1. Matrix Factorization
        3. Making recommendations
    4. Testing the recommendations
    5. Learning about hybrid recommender systems
    6. Summary
  22. Other Books You May Enjoy
    1. Leave a review - let other readers know what you think

Product information

  • Title: Julia 1.0 Programming Complete Reference Guide
  • Author(s): Ivo Balbaert, Adrian Salceanu
  • Release date: May 2019
  • Publisher(s): Packt Publishing
  • ISBN: 9781838822248