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)

Linear regression


Linear Regression is a linear model that is used to determine and predict numerical values. Linear regression is one of the most basic and important starting points in understanding linear models and predictive analytics. For this recipe, we will use Julia's GLM.jl package.

Getting ready

To get started with this recipe, you have to add the GLM.jl Julia package. It can be added and imported in the REPL using the Pkg.add(" ") command just like we added other packages before. This can be done as follows:

Pkg.add("GLM")

Now, import the package using the using " " command. The DataFrames package is also required to be imported. This can be done as follows:

using GLM
using DataFrames

How to do it...

  1. Here, we will attempt to perform a simple linear regression on two basic arrays, which we have generated on-the-fly. Let's call the two array A and B and then, create a dataframe containing them. This can be done as follows:

    df = DataFrame(A = [3, 6, 9], B = [34, 56, 67])
    

  2. Now the...