data_science_in_julia_for_hackers
data_science_in_julia_for_hackers copied to clipboard
Chp 02 Review
Align expectations
- [ ] done
Chapter 1 puts a lot of emphasis on application, but then Chapter 2 has no applications at all, and it seems that's also the case for Chapter 3 (except for the last section). This is not bad at all, just mentioning there is a strong contrast between the expectation set in chapter 1 and the content of these two chapters. An easy way to reduce this contrast could be to add one or two sentences at the end of chapter 1 states that before going into applications we are going to have an intro/primer to Julia (Chapter 2) and to Probability (Chapter 3). YOu already do something like this at the beginning of chapter 3 when saying "...But we first need an intuitive conceptual basis to build on top of that." You may want to mention that readers can skip these chapters if they are already familiar but they may to still check Section "3.8 Example: Bayesian Bandits"
Undefined version
- [ ] done
Could you specify the version of Julia? Maybe a good place is at the beginning of the section "2.3 Installation".
Introduce variable assignment earlier
- [ ] done
Later in the book (Fibonacci code), there is a sentence saying " Variables are assigned simply by writing the name of the variable followed by an ‘equal’ sign, and followed finally by the value you want to store in that variable."
But the first assignment appears way earlier in the chapter when doing "β = 5"
Typo
- [ ] done
change:
"The ⌀ of the circle is $β "
into:
"The ⌀ of the circle is $β"
Possible rendering/typo error.
- [ ] done
!: "not" logical operator &: "and" logical operator |: "or" logical operator ==: "equal to" logical operator !=: "different to" logical operator
: "greater than" operator <: "less than" operator =: "greater or equal to" operator <=: "less or equal to" operator
Keep the focus
- [ ] done
Change:
"This is called slicing, and it will be very useful later when working with arrays."
Into:
"This is called slicing"
Typo
- [ ] done
Change:
"This is usually done by writing a dollar symbol $ $ $ followed by the expression between parentheses."
Into:
"This is usually done by writing a dollar symbol $ followed by the expression between parentheses."
Maybe expand the explanation
- [ ] done
Maybe add one sentence explaining what an array is.
"It’s time now to start introducing collections of data in Julia. We will start by talking about arrays."
Show, don't tell
- [ ] done
In the itemization after
"You can see that in the pattern that the Julia REPL prints out:"
I suggest you describe just what readers can see or expand the example. Instead of saying
- "When dealing with higher dimensionality arrays, the shape will be informed."
- "If this is not the case, type ‘Any’ will appear, meaning that the collection of objects inside the array is not homogeneous in its type."
- "Later, we will introduce matrices and, naturally, a 2 will appear in this place instead of a 1."
Omit those or show them with an example
Fibonacci sequence
- [ ] done
Maybe add one or two sentences explaining/showing what the Fibonacci sequence is.
Typo
- [ ] done
Change:
"...followed by the name of the function and the arguments between brackets, all separated by commas."
Into:
"...followed by the name of the function and the arguments between parentheses, all separated by commas."
When?
- [ ] done
"The memory allocation for this array is done by initializing the array as we have already seen earlier." When did we see this? maybe omit the sentence.
Omit
- [ ] done
This sentence can be omitted. "Don’t worry too much if you don’t understand all this right now, though."
Typo x 2
- [ ] done
Change:
"bbeginning"
Into:
"beginning"
Fibonacci function explanation may be a little bit clunky
- [ ] done
I suggest you can rewrite it into two parts. First a high-level description of the code, and then some notes. Something like this:
We first assigned the values 0, 1, and 10 to the variables n1
, n2
, and m
. We then defined a function for computing the Fibonacci series. The function starts with the keyword "function"
, followed by the name of the function. Then the arguments in parentheses and separated by commas. In this function, the arguments are the first two numbers of the sequence and the total length of the Fibonacci series. In the body of the function, we created an array of integers with a length of m
and assigned the first two elements of the sequence. We then used a for loop to calculate the rest of the sequence. Finally, we ended the for loop and the function definition with the "end" keyword. Evaluating the function with the previously defined variables n1
, n2
, and m
, gives us the Fibonacci series.
Now that we have a general understanding of the fibonacci function, let's dive into some of the details.
We can see that within the function, we use indentation to make the code more readable. This is not strictly necessary for the code to work, but it is a good practice to have from the beginning.
Instead of initializing the array as an empty array, fib = []
, and filling it later, we initialize it as a one-dimensional array of integers with length m
, by allocating memory. This is also something not required, but it is a good practice for optimized and performant code in Julia. We can do this everything that we know in advance how long our array is going to be
The memory allocation for this array is done by initializing the array as we have already seen earlier. julia {Int64,1}
just means we want a one-dimensional array of integers. The new part is the one between parenthesis, julia (undef, m)
. This just means we are initializing the array with undefined values –which will be later modified by us–, and that there will be a number m of them.
Consider adding subsections
- [ ] done
nitpick, reference to previous content
- [ ] done
maybe Change:
To delete an element we use the delete! method.
Into:
To delete an element we use the delete! method. This is another example of a function that uses the "!" convention to indicate that it modifies the inputs in place.
Move the title
- [ ] done
There is already a plot before the title 2.5.1 Plotting with Plots.jl
Explain the begin-end block
- [ ] done
Starting section 2.5 there are a few begin-end block, but no explanation of why they are used.
flow of information
- [ ] done
I don't know what "It resembles the flow of information." means in this context.
Here we used the pipeline operator |>, which is mainly some Julia syntactic sugar. It resembles the flow of information.
Nitpick
- [ ] done
Split this paragraph from the previous one and use the first person plural.
Once you have worked on the dataframe cleaning data or modifying it, you can write a CSV text file from it and in this way, you can share your work with other people. For example, consider I want to filter one of the species of plants, ‘Iris-setosa,’ and then I want to write a file with this modified data to share it with someone,