Re-posted from: http://sdobber.github.io/movingtojulia11/
Finally, all files in the GitHub repository have been updated to be able to run on Julia 1.1. In order to be able to run them (at the time of writing), the developmental versions of the Tensorflow.jl and PyCall.jl packages need to be installed. Some notable changes are listed below:
General
- The
shuffle
command has been moved to the Random package asRandom.shuffle()
. linspace
has been replaced withrange(start, stop=..., length=...)
.- To determine the length of a matrix, use
size(...,2)
instead oflength()
. - For accessing the first and last part of datasets,
head()
as been replaced withfirst()
, andtail()
withlast()
. - For arithmetic calculations involving constants and arrays, the better syntax
const .- array
needs to be used instead ofconst - array
. In connection with this, a space might be required before the operator; i.e. to avoid confusion with number types use1 .- array
, and not1.-array
. - Conversion of a dataframe
df
to a matrix can be done viaconvert(Matrix, df)
instead ofconvert(Array, df)
.
Exercise 8
- The creation of an initially undefined vector etc. now requires the
undef
keyword as inactivation_functions = Vector{Function}(undef, size(hidden_units,1))
. - An assignment of a function to multiple entries of a vector requires the dot-operator:
activation_functions[1:end-1] .= z->nn.dropout(nn.relu(z), keep_probability)
Exercise 10
- For this exercise to work, the MNIST.jl package needs an update. A quick fix can be found in the repository together with the exercise notebooks.
- Instead of
flipdim(A, d)
, usereverse(A, dims=d)
. indmax
has been replaced byargmax
.- Parsing expressions has been moved to the Meta package and can be done by
Meta.parse(...)
.
Exercise 11
- The behaviour of taking the transpose of a vector has been changed – it now creates an abstract linear algebra object. We use
collect()
on the transpose for functions that cannot handle the new type. - To test if a string contains a certain word,
contains()
has been replaced byoccursin()
.