Just about a week ago, I taught colleagues in my organisation (Roche,
Basel Headquarters) “DataFrames, Strings and Plots”. With the necessity
of teaching, the learning did indeed transmit. We covered
types
in Julia such as Dict
,
Pairs
, Arrays
and reviewed the purpose of
.toml
files as an ambition that our students will
eventually collaborate with the Julia programming language. Conscience
that the recycled example of the DataFrames
package was a
eurocentric one (the DataFrame “German” was a universal one from this
package DataFrame.jl
) I created a DataFrame
type of the ten countries belonging to South East Area, and those who
participated in the SEA Games (South Eastern Games) and those who aren’t
as an example of a binary variable. Furthermore, I added another binary
variable of Indigenous
to represent whether or not that
country had Indigenous population. Most did and hopefully made the
lesson more diverse and interesting for a European-resident audience.
This data frame was purposely erroneous in that it had Switzerland which
does not belong to South East Asia so as a deliberate exercise, we
manipulated this data frame to correct this error. All proved to be
planted seeds for a more diversity inclusive instruction.
I continue to learn from my co-instructors for this in-house course lasting till June 2024 this year where we will continue to cover more statistics related material. A grass-roots effort I am so happy to be part of.
Two weeks ago, I stumbled across Julia
the language from
a simple google search on making R
faster. I had a goal
initially to start my C++ courses, due to a Triumphant year that was
2023, I did not get to it, until I discovered some extra headspace where
the language Julia
took a priority due to its intuitive
syntax, ease and promise of faster performance. My criteria for picking
teachers is not so stringent, and with Julia for Nervous beginners, the
criterion of a welcoming intent was met with the instructor.
Pictured : Lac Leman, Canton de Vaud (2023)
Within the Julia Academy, I found a course
by Henri Laurie (2021), a retired professor from the University of
Cape Town, ZA who gave a 4 weeks course ranging from 1 hour to 3 hours
per week. Illustrations were via the terminal of Henri’s computer and
promised exercises were in the end absent. According to the
stackoverflow, Henri neither had the funding nor energy to complete the
course with exercises as well. However, coupled with my advanced
R
skills (~5-7 years), I breezed through Week 1 and 2 of
the course, and relied on the qualities of a good teacher to push
through the topics of reading and manipulating text files in
Julia
which I did not find so interesting.
My relative smooth start with Julia has helped me appreciate R at the
same time. Week 2-3 focussed on the nature of Julia. The type system of
R was something I never focussed on until (working in software
engineering) and now, learning about Julia. Other examples include :
what is a block scope, what is scope in relation to functions, what are
type strings versus characters, concepts I never thought too deeply
about when writing in R. Neither did I attend to the differences made in
Julia between single quotation (for character) and double quotation
marks (for string) in which R is the same. The similarities are also
such as the filter
call in the tidyverse
package of R make for neat manipulations or strings or arrays.
Conversely, my background in R
helped me understand the
lessons about If
and Else
blocks,
While
loops and For
loops. It introduced
Anonymous function which are unnamed functions but like one, maps
variables it will iterate over. What are its future potentials ? An
undiscovered territory for me.
As I learn with hands-on application, I searched quickly for a Julia
IDE and found a web-based one called
Replit
which automatically requested a link to my
github
account which I did not see relevance nor aid to my
learning. The said IDE likened to the one of VS Code however when I ran
the code, I would always be led into a foreign window of which felt like
a point of no return. Discovering a new IDE and its workflow is often a
prohibitive step for a novice, but I still wanted to concertedly do the
in-lecture exercises of Julia for Nervous beginners so I resorted to
doing it via my good old Mac terminal. It was so pleasant.
Determined to get Visual Studio Code (VS) app working, I downloaded
it and its Julia extension and found a frustrating block on finding my
Julia.exe path in order that the code ran. I finally googled “How to
find my MAC application path” and it was another solution via the Mac
terminal : whereis Julia
. The short cut commands to run
code line-by-line on the VS Code app are different between a Windows
machine and a Mac, so many tutorials that I watched catered for the
former which extra internet searches was required to help me see that a
option+Enter
or shift+Enter
would do just
that. Whereas Alt+Enter
will evaluate all the code in the
entire file. These short cut keys will automatically open the Julia REPL
where you should see julia>
appearing.
julia> exit()
will close the REPL and expand the window
of the editor.
Further to that, only files in the VS code workspace would be executed and not just any new file within the bounds of the VS code application. I am still understanding how this is so.
I discovered some more courses in coursera, such as Scientific Computing With Julia, however the current focus of mine differs to its learning objectives. There aren’t many statistical use cases which is precisely the direction of my Julia learning. Thus I hesitated from starting another course, albeit be run by the same, kind teacher.
The next steps include re-running the Turing
code on my .jl
files as an exercise to familliarise
myself with the VS Code app, and eventually linking it to my github
account. I have yet to discover the Weave feature of the Julia
extension, no internet source has explained why I haven’t discovered my
Julia markdown file format, even if I forcefully save .txt
files as .jmd
. I found importing packages within Julia a
bit slow, and within R a bit faster. At the end of the course, Henri
Laurie spoke about future outlooks of Julia, and how with just the
knowledge of this course, one can run an MCMC experiment. More than,
other IDEs were introduced such as Juno and IJulia
Those will be my next steps to understand a comfortable setting to write
and run Julia. There are undiscovered potentials as a statistical
software engineer within Julia, and I can’t wait to integratively
understand the said benefits of this language such as its type system
and multiple dispatches. The learning is long-term and seemingly
compoundable when reflecting between programming languages. Future
experiences will nourish these planted seeds.
References
Julia for Nervous beginners : https://juliaacademy.com/
Turing Lanaguage : https://turinglang.org
Julia for Visual Studio Code : https://code.visualstudio.com/docs/languages/julia
How to use Julia in VS Code : https://www.youtube.com/watch?v=FcgIvWb7gO0