top of page

Julia Notebooks

As I work through more machine learning algorithms, I'll add their corresponding notebooks.  If you haven't ever used Julia, I highly recommend it.  They have very interesting types (including complex and rational numbers) and the language is very, very fast (see a speed demo at the bottom of this page).

LinReg.png

Linear Regression

In this notebook we'll look at a very basic implementation of linear regression in Julia.

In future notebooks we'll revisit the theory I skipped, and we'll also look at other forms of regression like multiple regression, polynomial regression, and eventually we'll compare least squares logistic regression to cross entropy and softmax gradient descent.

Note: I'm still learning Julia and it's highly likely one can implement faster code by taking advantage of Julia's types and methods.  That said, I had no issues with speed here and unless efficiency is necessary, I prefer readability anyway.

Julia Speed Test

I've used Python for most of my classes.  Some day I'll learn C because everything meaningful is done in C, but I certainly enjoy using Julia more than any other language I've used.

To the right, we can see a speed test in Julia and in Python.  Julia is about 100 times faster. For reference, I ran a similar speed test in C using VS code and it took 2 seconds.  I don't know enough about C to know if I can make it faster, but I find it extremely unlikely that that's as fast it can go.  Still, interesting data point all the same.

Screen Shot 2024-02-23 at 5.27.48 PM.png
Screen Shot 2024-02-23 at 5.27.55 PM.png
CEa2.png

Many thanks to Prof. O'Connell for his humor and excellent lecture notes.

Machine Learning

Two of my favorite labs in my machine learning course were labs 3 and 4. 

In lab 3, we implemented perceptron, least squares, cross entropy, and soft-max learning algorithms from scratch using PyTorch.  We then generated linearly-separable data which we partition into a train/test split using the scikit-learn library.  After training, we test the algorithms' accuracy.  In lab 4, we train on real world data using the algorithms from lab 3.

Edit: I'm reviewing ML material (use it or lose it) and while doing so, I've started to build some familiarity with the Flux library in Julia.  I'll update my code as I go, which you can find on my Julia page via the button below:

Edit edit: This work is somewhat outdated.  At this point, it mostly exists to demonstrate my growth in the study of ML.  See my stat learning theory section for more up to date material.

bottom of page