Mat's Mind Dump

Mat’s Mind Dump

Adventures in Tech Art, AI & iOS Dev

SymPy to Solve a Low Level ML Training Loop

A few months ago, I overcame a challenging hurdle in my spare time passion project. It seemed like I reached a dead end, but I got past it thanks to discovering a new Python package, SymPy. The Background After going down the rabbit hole with reinforcement learning, I conceded my problem was best solved using a regression algorithm. Still, the best results I saw came from exploiting the training loop in the early days. ...

August 26, 2022 · 5 min · Mat

The Best PyCharm MayaPy Interpreter Setup

There’s no denying - Maya makes development hard. Python is one of the most popular programming languages in the world as of 2022. The language supports many great workflows, but most are off-limits when working with Maya. Even just setting up an IDE with MayaPy has been a challenge through the years. Today I will share how I set up PyCharm to work with MayaPy and how it enables a super-slick workflow for unit testing. ...

June 16, 2022 · 6 min · Mat

CoreData Swift Scalar Optionals

The project I am currently working on has an input form that takes doubles for some of its fields. I am using CoreData to persist my data and was surprised to find optional scalars are not supported. Regardless of whether or not Optional is checked, the type in the Swift codegen will always be Double and never be optional. This behaviour is not a bug, but rather just a difference in how Optionals work in CoreData - it refers to optional at save time. ...

January 22, 2022 · 3 min · Mat

My SwiftUI Currency Field

I’ve been spending a lot of time in SwiftUI lately and, so far, I love it. While it is remarkably flexible and powerful, it is still very young. There are still pain points from what seems to be a lack of coverage in the framework. Worse still, because it is changing and updating so rapidly, I am finding that much advice on StackOverflow and many blog posts are outdated already. ...

January 12, 2022 · 2 min · Mat

Loss vs. reward in reinforcement learning

Reinforcement learning is my area of focus so far when it comes to deep learning. RL is probably not the first stop for most on the machine learning education circuit, but it just happens to be where the problem I am trying to solve has taken me. When starting down the RL road, I was immediately confused by the concept of reward. Nothing was confusing about what it was - giving a dog a treat when it sits after you’ve asked it to sums things up pretty well. Instead, I was confused by its relation to the loss function. Both, at a high level, help inform when the correct thing is happening. ...

October 17, 2021 · 6 min · Mat

Tensorflow to PyTorch

My journey into machine learning is still in its relatively early stages. I began by familiarizing myself with Tensorflow. It was an excellent introduction, whetting my appetite for AI, but I am now ready to make the switch to PyTorch. There are two key drivers behind my decision to make this change. Debugging Process transparency Debugging Debugging in Tensorflow has been problematic, to say the least, being most painful when writing custom loss functions. I’d feed dummy data to the loss function while writing it, pre-vetting what I was creating. However, when something didn’t work as expected during training, troubleshooting was near impossible. Tensors at training time are opaque, acting in some “virtual” fashion if my memory serves (this was a while ago now). ...

October 10, 2021 · 3 min · Mat

Kaggle Courses

I have been dabbling in deep learning recently, and I have completed a few courses and read through and watched many resources during that time. It can be hard to find good help, so I wanted to share my experience with Kaggle quickly. If you’re not familiar with Kaggle, it is an excellent source of datasets for training your models. I believe this is what they are most well known for. They also have a complete set of courses relating to many things data science-related. The topics include data visualization, how to use the Pandas library, and more. ...

August 8, 2021 · 2 min · Mat

Python logging in Maya

The logging module, while something I’ve been using for years, is not something I can say I’ve been clear on. I’ve dug in more recently and thought I would share some quick learnings. Logger Hierarchy The first item to note is that Python’s logging module behaves as an inheritance hierarchy. This hierarchy will automatically kick in by using dot notation in the naming of your logger. For example, “eh.bee.sea” inherits from “eh.bee”, which inherits from “eh”. ...

July 13, 2021 · 2 min · Mat

Applied Software Development Retrospective

Recently, I completed the Applied Software Development part-time studies program at BCIT. It has been a three-year journey, and so I thought I would do a quick write-up about some of my favourite courses and my takeaways. Why go back to school? I had been established in the industry for over ten years, was well experienced with Python, and had some experience in other languages. Why go back to school? Well, I was entirely self-taught through my years on the job. ...

April 5, 2021 · 6 min · Mat

Using the __new__ method in Python classes

The __new__ method is a special method for Python classes. It is essentially the constructor for your class and handles its creation. You may think this is what the __init__ method is for, but the class instance (referred to from here out as “object”) is actually already created by the time __init__ gets called. The __init__ method is just setting initial values for an already created object. The __new__ method is what gets called before the object exists and actually creates and returns the object. ...

March 28, 2021 · 6 min · Mat