I was reading some Rust code today and I found out that break in Rust can return a value. I thought this was a really useful feature and I wondered if Ruby was the same. Sure enough ➜ irb irb ( main ): 001 * ( 0 .. 10 ) . each do | i | irb ( main ): 002 * p i irb ( main ): 003 * break "broke" if i > 5 irb ( main ): 004 > end 0 1 2 3 4 5 6 => "broke" irb ( main ): 005 * ( 0 .. 10 ) . each do | i |…
It’s been a weekend so what do you do? You implement a ray tracer of course. Ray Tracing in One Weekend The article is really well done. It builds up from a red circle to the image above in easily digestible steps. I’m pretty sure there are a couple of bugs but the way the subject is presented makes it easy to reason your way past them. I highly recommend giving this a go. It’s kind of crazy how…
Early on I added a configuration file ( config.json ) that enabled me to play with the network parameters. In machine learning parlance the parameters to the model are called hyper-parameters. Now I have a complete and reasonably fast 1 neural network I can play with the hyper-parameters to see if I can get a more accurate model. Hyper-parameter tuning TLDR: It seems I might have accidentally hit…
It’s a bit unusual to talk about type coercion in Ruby. Being a dynamically typed “message passing” language you generally don’t need to think about types too much. But a couple of days ago I was implementing my own “number like” class and I needed to be able to sum a large list. In Ruby overloading operators is easy and intuitive but there is one case that’s a bit more complicated. It’s pretty…
This is insane! Marathon | Reveal Cinematic Short As soon as I started watching I knew it was from Alberto Mielgo . He wrote and directed The Witness for Netflix’s anthology Love, Death & Robots which I absolutely loved. As someone commented on the Youtube video, if Marathon sucks at least we got this! As for Marathon; I love the art style and the design. It gives me Oni flashbacks which is a…
As I have mentioned several times, there is a problem with the training algorithm where I have been processing each digit one by one. Instead, I should have been leveraging matrix math and processing batches of images in a single operation. It’s now time to tackle this problem. But first some bike shedding / procrastination. I gave NetworkConfig a work over. Layers The way layers are defined in…
After the ndarray diversion I’m back following the book 1 . This time I’m implementing mini batch gradient descent and dataset standardisation. 2 Mini Batch Gradient Descent Mini-batch gradient descent is an optimisation technique that, instead of using the entire dataset for each update, it splits the data into small subsets (mini-batches) of the data, computes the gradient, and updates the…
In Part 3 of this series I presented some stats for the neural network using a Softmax activation function on the hidden layer. Unfortunately I showed the wrong output. The ouput I showed was for a network with two hidden layers not one as I have been using for the other stats. The 16m 34s run time and the 100% accuracy was because of the extra hidden layer. These are the actual training and…
Software update (the one in System Settings) failed on my laptop because I didn’t have enough disk space. The UI doesn’t give you the ability to chose which updates to run. But there’s a command line version that does. ❯ softwareupdate --list Software Update Tool Finding available software Software Update found the following new or updated software: * Label: Command Line Tools for Xcode-15.3…
In Machine Learning Part 2 I talked about how the Rust neural network code works, but I forgot the stats that show how well it works. They were in my original post, but here they are again for reference. Training took 10 minutes and 13 seconds for 30 epochs and finished the training set with 98.40%. Here are the tests stats. Confusion Matrix: Predicted Actual 0 1 2 3 4 5 6 7 8 9…