Book Image

Julia Cookbook

By : Raj R Jalem, Rohit
Book Image

Julia Cookbook

By: Raj R Jalem, Rohit

Overview of this book

Want to handle everything that Julia can throw at you and get the most of it every day? This practical guide to programming with Julia for performing numerical computation will make you more productive and able work with data more efficiently. The book starts with the main features of Julia to help you quickly refresh your knowledge of functions, modules, and arrays. We’ll also show you how to utilize the Julia language to identify, retrieve, and transform data sets so you can perform data analysis and data manipulation. Later on, you’ll see how to optimize data science programs with parallel computing and memory allocation. You’ll get familiar with the concepts of package development and networking to solve numerical problems using the Julia platform. This book includes recipes on identifying and classifying data science problems, data modelling, data analysis, data manipulation, meta-programming, multidimensional arrays, and parallel computing. By the end of the book, you will acquire the skills to work more effectively with your data.
Table of Contents (7 chapters)

Dimensionality reduction


In this recipe, you will learn about the concept of dimensionality reduction. This is the set of algorithms used by statisticians and data scientists when data has a large number of dimensions. It helps make computations and model designing easy. We will use the Principal Component Analysis (PCA) algorithm for this recipe.

Getting ready

To get started with this recipe, you have to have the MultivariateStats Julia package installed and running. This can be done by entering Pkg.add("MultivariateStats") in the Julia REPL. When using it for the first time, it might show a long list of warnings; however you can safely ignore them for the time being. They in no way affect the algorithms and techniques that we will use in this chapter.

How to do it...

  1. Firstly, let's simulate about a hundred random observations, as a training set for the PCA algorithm which we will use. This can be done using the randn() function:

    X = randn(100,3) * [0.8 0.7; 0.9 0.5; 0.2 0.6]
    

  2. Now, to fit...