Book Image

Julia Cookbook

By : Raj R Jalem, Jalem Raj Rohit
Book Image

Julia Cookbook

By: Raj R Jalem, Jalem Raj 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 (12 chapters)

Basic statistics concepts


In this recipe, you will learn about the StatsBase package, which helps you use basic statistical concepts such as weight vectors, common statistical estimates, distributions, and others.

Getting ready

To get started with this recipe, you have to first install the StatsBase package by executing Pkg.add("StatsBase") in the REPL.

How to do it...

  1. Weight vectors can be constructed as follows:

    w = WeightVec([4., 5., 6.])
    

  2. Weight vectors also compute the sum of the weights automatically. So, if the sum is already computed, it can be added as a second argument to the vector construction so that it saves time required for computing the sum. Here is how to do it:

    w = WeightVec([4., 5., 6.], 15.)
    

  3. Weights can also be simply defined by the weights() function, as follows:

    w = weights([1., 2., 3.])
    

  4. Some important methods that can be used on weight vectors are:

    1. To check whether the weight vector is empty or not, the isemply() function can be used:

      isempty(w)
      
    2. To check the type...