Merge branch 'main' of https://github.com/bkamins/JuliaForDataAnalysis
This commit is contained in:
commit
0e583bca97
60
README.md
60
README.md
@ -2,20 +2,33 @@
|
|||||||
|
|
||||||
This repository contains source codes for the
|
This repository contains source codes for the
|
||||||
["Julia for Data Analysis"](https://www.manning.com/books/julia-for-data-analysis?utm_source=bkamins&utm_medium=affiliate&utm_campaign=book_kaminski2_julia_3_17_22)
|
["Julia for Data Analysis"](https://www.manning.com/books/julia-for-data-analysis?utm_source=bkamins&utm_medium=affiliate&utm_campaign=book_kaminski2_julia_3_17_22)
|
||||||
book that is written by Bogumił Kamiński and is planned to be published in 2022
|
book that has been written by Bogumił Kamiński and has been published by [Manning Publications Co.](https://www.manning.com/)
|
||||||
by [Manning Publications Co.](https://www.manning.com/)
|
|
||||||
|
|
||||||
Extras:
|
## Contents
|
||||||
|
|
||||||
|
* [Additional teaching materials](#additional-teaching-materials)
|
||||||
|
* [Setting up your environment](#setting-up-your-environment)
|
||||||
|
* [General instructions](#general-instructions)
|
||||||
|
* [Note for Linux users](#note-for-linux-users)
|
||||||
|
* [Organization of the code](#organization-of-the-code)
|
||||||
|
* [Running the example codes](#running-the-example-codes)
|
||||||
|
* [Accompanying materials](#accompanying-materials)
|
||||||
|
* [Data used in the book](#data-used-in-the-book)
|
||||||
|
* [Errata](#errata)
|
||||||
|
|
||||||
|
## Additional teaching materials
|
||||||
* in the `/exercises` folder for each book chapter you can find 10 additional
|
* in the `/exercises` folder for each book chapter you can find 10 additional
|
||||||
exercises with solutions (they are meant for self study and are not discussed
|
exercises with solutions (they are meant for self study and are not discussed
|
||||||
in the book)
|
in the book)
|
||||||
* in the `/lectures` folder for each book chapter you can find a Jupyter
|
* in the `/lectures` folder for each book chapter you can find a Jupyter
|
||||||
Notebook file with code from this chapter (note that the code is slightly
|
Notebook file with code from this chapter (note that the code is slightly
|
||||||
adjusted in comparison to code contained in .jl files in the root folder
|
adjusted in comparison to code contained in .jl files in the root folder
|
||||||
to accomodate it for running in Jupyter Notebook).
|
to accommodate it for running in Jupyter Notebook).
|
||||||
|
|
||||||
## Setting up your environment
|
## Setting up your environment
|
||||||
|
|
||||||
|
### General instructions
|
||||||
|
|
||||||
In order to prepare the Julia environment before working with the materials
|
In order to prepare the Julia environment before working with the materials
|
||||||
presented in the book please perform the following setup steps:
|
presented in the book please perform the following setup steps:
|
||||||
|
|
||||||
@ -140,3 +153,42 @@ They are respectively:
|
|||||||
<https://snap.stanford.edu/data/github-social.html> under GPL-3.0 License)
|
<https://snap.stanford.edu/data/github-social.html> under GPL-3.0 License)
|
||||||
* owensboro.zip (for chapter 13, available at The Stanford Open Policing Project
|
* owensboro.zip (for chapter 13, available at The Stanford Open Policing Project
|
||||||
under the Open Data Commons Attribution License)
|
under the Open Data Commons Attribution License)
|
||||||
|
|
||||||
|
## Errata
|
||||||
|
|
||||||
|
### Chapter 2, page 30
|
||||||
|
|
||||||
|
I compare the following expressions:
|
||||||
|
|
||||||
|
```
|
||||||
|
x > 0 && println(x)
|
||||||
|
```
|
||||||
|
|
||||||
|
and
|
||||||
|
|
||||||
|
```
|
||||||
|
if x > 0
|
||||||
|
println(x)
|
||||||
|
end
|
||||||
|
```
|
||||||
|
|
||||||
|
where `x = -7`.
|
||||||
|
|
||||||
|
I write there that Julia interprets them both in the same way.
|
||||||
|
It is true in terms of the fact that in both cases the `println` function is not called (and this is the focus point of the example).
|
||||||
|
However, there is a difference in the value of these expressions.
|
||||||
|
The first expression evaluates to `false`, while the second evaluates to `nothing`.
|
||||||
|
|
||||||
|
Here is how you can check it:
|
||||||
|
|
||||||
|
```
|
||||||
|
julia> x = -7
|
||||||
|
-7
|
||||||
|
|
||||||
|
julia> show(x > 0 && println(x))
|
||||||
|
false
|
||||||
|
julia> show(if x > 0
|
||||||
|
println(x)
|
||||||
|
end)
|
||||||
|
nothing
|
||||||
|
```
|
||||||
|
@ -19,7 +19,7 @@ purpose, require using more functionalities of Julia ecosystem that is covered
|
|||||||
in the book. This is meant to teach you how to use help and documentation,
|
in the book. This is meant to teach you how to use help and documentation,
|
||||||
as this is a very important skill to master.
|
as this is a very important skill to master.
|
||||||
|
|
||||||
The files containing exercises have a naming convention `execricesDD.md`, where
|
The files containing exercises have a naming convention `exercisesDD.md`, where
|
||||||
`DD` is book chapter number for which the exercises were prepared.
|
`DD` is book chapter number for which the exercises were prepared.
|
||||||
|
|
||||||
All the exercises should be possible to solve using project environment setting
|
All the exercises should be possible to solve using project environment setting
|
||||||
|
@ -64,7 +64,7 @@ and the error accumulates when we do addition multiple times.
|
|||||||
than rational 1/7 by increasing the precision of computations using the `big`
|
than rational 1/7 by increasing the precision of computations using the `big`
|
||||||
function:
|
function:
|
||||||
```
|
```
|
||||||
julia> big(1/7) # convert Floa64 to high-precision float
|
julia> big(1/7) # convert Float64 to high-precision float
|
||||||
0.142857142857142849212692681248881854116916656494140625
|
0.142857142857142849212692681248881854116916656494140625
|
||||||
|
|
||||||
julia> 1/big(7) # construct high-precision float directly
|
julia> 1/big(7) # construct high-precision float directly
|
||||||
@ -187,7 +187,7 @@ Note the differences in the code:
|
|||||||
* if there are `0` or `1` element in the collection the function does not do
|
* if there are `0` or `1` element in the collection the function does not do
|
||||||
anything (depending on the context we might want to throw an error instead)
|
anything (depending on the context we might want to throw an error instead)
|
||||||
* in `x[begin], x[end] = x[end], x[begin]` we perform two assignments at the
|
* in `x[begin], x[end] = x[end], x[begin]` we perform two assignments at the
|
||||||
same time to avoid having to use a temporaty variable `f` (this operation
|
same time to avoid having to use a temporary variable `f` (this operation
|
||||||
is technically called tuple destructuring; we discuss it in later chapters of
|
is technically called tuple destructuring; we discuss it in later chapters of
|
||||||
the book)
|
the book)
|
||||||
|
|
||||||
|
@ -302,7 +302,7 @@ julia> for i in 1:40
|
|||||||
20 18.100 μs (0 allocations: 0 bytes)
|
20 18.100 μs (0 allocations: 0 bytes)
|
||||||
```
|
```
|
||||||
|
|
||||||
Notice that execution time for number `n` is roughly sum of ececution times
|
Notice that execution time for number `n` is roughly sum of execution times
|
||||||
for numbers `n-1` and `n-2`.
|
for numbers `n-1` and `n-2`.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
@ -9,11 +9,11 @@
|
|||||||
### Exercise 1
|
### Exercise 1
|
||||||
|
|
||||||
Random.org provides a service that returns random numbers. One of the ways
|
Random.org provides a service that returns random numbers. One of the ways
|
||||||
how you can use it is by sending HTTP GET reguests. Here is an example request:
|
how you can use it is by sending HTTP GET requests. Here is an example request:
|
||||||
|
|
||||||
> https://www.random.org/integers/?num=10&min=1&max=6&col=1&base=10&format=plain&rnd=new
|
> https://www.random.org/integers/?num=10&min=1&max=6&col=1&base=10&format=plain&rnd=new
|
||||||
|
|
||||||
If you want to understand all the parameters plese check their meaning
|
If you want to understand all the parameters please check their meaning
|
||||||
[here](https://www.random.org/clients/http/).
|
[here](https://www.random.org/clients/http/).
|
||||||
|
|
||||||
For us it is enough that this request generates 10 random integers in the range
|
For us it is enough that this request generates 10 random integers in the range
|
||||||
|
@ -385,7 +385,7 @@ plot([bar(string.(g.n), g.mv;
|
|||||||
yerror=(g.mv - g.lo95, g.hi95-g.mv)) for g in gdf]...)
|
yerror=(g.mv - g.lo95, g.hi95-g.mv)) for g in gdf]...)
|
||||||
```
|
```
|
||||||
|
|
||||||
As expected error bandwidth gets smaller as `k` encreases.
|
As expected error bandwidth gets smaller as `k` increases.
|
||||||
Note that as `n` increases the estimated value tends to `1-exp(-1)`.
|
Note that as `n` increases the estimated value tends to `1-exp(-1)`.
|
||||||
|
|
||||||
</details>
|
</details>
|
||||||
|
Loading…
Reference in New Issue
Block a user