LSTMs for Time Series in PyTorch

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

Counterintuitive Probabilities: Typical Sets from Information Theory

Suppose we have a coin that has a 3/4 chance of landing on heads (call this 0) and a 1/4 chance of landing on tails (1). Which of the 16-toss sequences below is most likely? 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 0 0 … Read More

How to Tackle Programming Problems (Google Code Jam 2017 Qualification Round, Problem A)

This is a walkthrough of how one might start thinking about Problem A (small input) of Google Code Jam’s 2017 Qualification Round (April 8-9). Google posts excellent solutions to their problems, so the focus here will be that of the idea generation process or how one might begin to tackle such problems. Full problem statements can be found here. Problem A (Oversized … Read More

How to use AWS EC2 GPU instances with BitFusion

If you want to train neural networks seriously, you need more computational power than the typical laptop has. There are two solutions: Get (buy or borrow) more computational power (GPUs or servers) or Rent servers online. GPUs cost over a hundred dollars each and top models like the NVIDIA TESLA cost thousands, so it’s usually easier and cheaper to rent … Read More

What is a Game Theoretic Best Choice? Part I

The aim of this series is to come up with some formalisation of what a game theoretic best choice is without reference to established results before the material is covered in lectures. I will then compare my formalisation to established results. Notation In Dr. Elliott’s lectures we defined a Nash Equilibrium to be when for all and for all . stands … Read More

Two ways CodeWars trumps HackerRank

Disclaimer: I am a fan of HackerRank’s contests and wide range of problems across languages and domains. Here I discuss two ways CodeWars is better than HackerRank. (Both are sites where you can do programming problems competitively.) Theme: CodeWars is better for beginner – intermediate learning. CodeWars emphasises testing throughout. While you’re working on the problem, there is a code … Read More

Creating Networks with Cytoscape

With so many ideas in Cambridge’s Part I Economics course, it’s crucial to be able to fit the pieces together. To do this, I looked for software to easily create a stylised network. Cytoscape is an open source (free) software platform for visualising and interacting with complex networks. It’s easy to pick up and import data into and looks pretty. … Read More

Data Visualisation, an Outline

Collect your data. My datasource was Mitchell et al (2011). I copied the figures off the PDF and converted them into column data via the free comma delimiter Delim.co. I then transferred the data to Google Sheets. Format your data. I deleted the rows with years in them with a formula (see below), and then deleted all extra rows with … Read More