The Successor Representation #1: Generalising between states

Jessica YungMachine Learning

In this post we will discuss a way of representing a state that has exciting connections with how our brain seems to work. First, we’ll briefly look at some foundational ideas (representation and generalisation). Next, we’ll introduce the Successor Representation (SR), which is motivated by finding a representation that generalises across states, and that might be useful in reinforcement learning. … Read More

How to run scripts in the background

Jessica YungProgramming

When running machine learning experiments, you might want to run multiple scripts simultaneously, hide printouts for a script or just do things in a terminal window while running a Jupyter Notebook in the background. In this post, we will go through how to run scripts in the background, bring them back to the foreground, and check if the scripts are … Read More

How Python implements dictionaries

Jessica YungProgramming

Python Dictionaries: Not even a space-time tradeoff If you could choose to store things that you’d want to look up later in a Python dictionary or in a Python list, which would you choose? It turns out that looking up items in a Python dictionary is much faster than looking up items in a Python list. If you search for … Read More

Numpy Views vs Copies: Avoiding Costly Mistakes

Jessica YungData Science, Programming

In this post we will talk about the differences between views and copies. It’s really important you’re aware of the difference between the two. Otherwise you might run into problems like accidentally modifying arrays. What are views and copies? With a view, it’s like you are viewing the original (base) array. The view is actually part of the original array even though … Read More

LSTMs for Time Series in PyTorch

Jessica YungMachine Learning, Uncategorized

I can’t believe how long it took me to get an LSTM to work in PyTorch! There are many ways it can fail. Sometimes you get a network that predicts values way too close to zero. In this post, we’re going to walk through implementing an LSTM for time series prediction in PyTorch. We’re going to use pytorch’s nn module … Read More

Generating Autoregressive data for experiments

Jessica YungData Science, Machine Learning

In this post, we will go through how to generate autoregressive data in Python, which is useful for debugging models for sequential prediction like recurrent neural networks. When you’re building a machine learning model, it’s often helpful to check that it works on simple problems before moving on to complicated ones. I’ve found this is especially useful for debugging neural … Read More

What makes Numpy Arrays Fast: Memory and Strides

Jessica YungMachine Learning, Programming

How is Numpy so fast? In this post we find out how Numpy’s ndarray is stored and how it is usually manipulated by Numpy functions using strides. Getting to know the ndarray A NumPy ndarray is a N-dimensional array. You can create one like this:

These arrays are homogenous arrays of fixed-sized items. That is, all the items in … Read More