Preface
Julia is a new programming language offering a unique combination of performance and productivity that promises to change scientific computing, and programming in general.
Julia picks the best parts of existing programming languages, providing out-of-the-box features such as a powerful REPL, an expressive syntax, Lisp-style metaprogramming capabilities, powerful numeric and scientific programming libraries, a built-in package manager, efficient Unicode support, and easily called C and Python functions.
It has C-like execution speed with excellent applications in multi-core, GPU, and cloud-based computing. Julia Programming Projects explains all this with the support of Julia v1.0.
After six years in development as an open source project, Julia is now ready to take the stage with the release of v1.0.
Who this book is for
Data scientists, statisticians, business analysts, and developers who are interested in learning how to use Julia to crunch numbers, analyze data, and build apps will find this book useful. A basic knowledge of programming is assumed.
What this book covers
Chapter 1, Getting Started with Julia Programming, introduces you to the Julia language, covering what it is and what its strengths are. Then, the chapter guides you through setting up a working Julia environment, looking at the various options for running Julia, locally and online. We'll cover installation,REPL, and IDE options, as well as the basics for extending the language through the integrated package manager.
Chapter 2, Creating Our First Julia App, will show you how to perform data analysis against the Iris dataset with Julia. We take a look at RDatasets, a package that provides access to 700 learning datasets distributed with the R language. We'll load the Iris dataset and we'll manipulate it using standard data analysis functions. We also look more closely at the data by employing common visualization techniques using Gadfly. In the process, we cover strings and regular expressions, numbers, tuples, ranges, and arrays. Finally, we'll see how to persist and (re)load our data with CSV, Feather, and MongoDB.
Chapter 3, Setting Up the Wiki Game, introduces our first fully featured Julia project, a Wikipedia web crawler disguised as a popular game. In the first iteration, we will build a program that gets a random web page from Wikipedia. Then we'll learn about parsing the HTML response using CSS selectors. We'll use this to introduce key concepts such as functions, pairs, dictionaries, exceptions, and conditional evaluation.
Chapter 4, Building the Wiki Game Web Crawler, will build upon the foundations set in the previous chapter, and we'll build a Wikipedia web scraper that implements the requirements of the wiki game.
Chapter 5, Adding a Web UI for the Wiki Game, will see us finish the Wiki Game by adding a web UI. We'll build a simple web app that will allow the player to start a new game, render the Wikipedia articles picked by the game engine, and navigate between linked Wikipedia articles. The UI will also keep track of and display current game progress and determine a session as a win or a loss.
Chapter 6, Implementing Recommender Systems with Julia, will have you take on a more challenging example project and build a few basic recommender systems. We'll set up a supervised machine learning system powered by Julia and we will develop some simple movie recommenders.
Chapter 7, Machine Learning for Recommender Systems, will show you how to implement a more powerful recommender system using the Recommender.jl
package. We will use a sample dataset to train our system and generate book recommendations as we'll learn about model-based recommenders.
Chapter 8, Leveraging Unsupervised Learning Techniques, will teach you how to perform unsupervised machine learning, namely clustering, using Julia. We will practice by using the San Francisco businesses registry. We'll use the powerful DataFrames
package in combination with Query.jl
to slice and dice the dataset, and we'll get more insight using visualizations. In the process, we will learn about metaprogramming and Clustering.jl
.
Chapter 9, Working with Dates, Time, and Time Series, is the first of two chapters about dates, time, and time series. Here we introduce you to the basics of working with dates, time zones, and time series. We'll use the TimeSeries.jl
package and Plots.jl
to analyze time series data, and we'll learn about the TimeArray
data structure.
Chapter 10, Time Series Forecasting, is where we will perform analysis on the EU unemployment data and forecast unemployment numbers. You will learn how to develop a forecasting model, train it, and generate predictions.
Chapter 11, Creating Julia Packages, is the final chapter and walks you through developing a fully featured Julia package. We'll discuss more advanced package management features, unit testing, benchmarking, and performance tips, adding and generating documentation for Julia software, and package publishing and registration.
To get the most out of this book
Familiarity with another programming language is assumed, as the book focuses on Julia specifics without introducing general programming and computer science concepts.
You'll need a computer with an internet connection running Windows, macOS, or a popular Linux flavor, as well as the ability to install and start programs (a command shell, an integrated development environment (IDE), an editor, and so on).
Download the example code files
You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.
You can download the code files by following these steps:
- Log in or register at www.packt.com.
- Select the
SUPPORT
tab. - Click on
Code Downloads & Errata
. - Enter the name of the book in the
Search
box and follow the onscreen instructions.
Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:
- WinRAR/7-Zip for Windows
- Zipeg/iZip/UnRarX for Mac
- 7-Zip/PeaZip for Linux
The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Julia-Programming-Projects. In case there's an update to the code, it will be updated on the existing GitHub repository.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!
Download the color images
We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/9781788292740_ColorImages.pdf.
Conventions used
There are a number of text conventions used throughout this book.
CodeInText
: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "The difficulty levels are already defined in the Gameplay
module, so don't forget to declare that we're using Gameplay
."
A block of code is set as follows:
function articleinfo(content) dom = articledom(content) (extractcontent(dom.root), extractlinks(dom.root), extracttitle(dom.root), extractimage(dom.root)) end
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
@from i in df begin
@where i.Parking_Tax == true
@select i
@collect DataFrame
end
Any command-line input or output is written as follows:
pkg> add [email protected] pkg> add [email protected]
Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "But versicolor and virginica? Not so much."
Note
Warnings or important notes appear like this.
Note
Tips and tricks appear like this.
Get in touch
Feedback from our readers is always welcome.
General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected]
.
Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.
Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected]
with a link to the material.
If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.
Reviews
Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!
For more information about Packt, please visit packt.com.