Publications by Daniel Oehm

Adding Custom Fonts to ggplot in R

15.03.2019

ggplot – You can spot one from a mile away, which is great! And when you do it’s a silent fist bump. But sometimes you want more than the standard theme. Fonts can breathe new life into your plots, helping to match the theme of your presentation, poster or report. This is always a second thought for me and need to work out how to do it again,...

3529 sym R (4815 sym/9 pcs) 14 img

Martingale strategies don’t work, but we knew that – Simulation analysis in R

05.04.2019

It’s generally accepted that Martingale betting strategies don’t work. But people still gravitate towards them because they are intuitive. I was curious to find out how they actually perform. Disclaimer: I do not encourage gambling, nor do I gamble myself but the games are good examples of stochastic processes. At a glance The classic and Re...

7064 sym R (2727 sym/1 pcs) 36 img 3 tbl

Applying gradient descent – primer / refresher

18.04.2019

Every so often a problem arises where it’s appropriate to use gradient descent, and it’s fun (and / or easier) to apply it manually. Recently I’ve applied it optimising a basic recommender system to ‘unsuppressing’ suppressed tabular data. I thought I’d do a series of posts about how I’ve used gradient descent, but figured it was wo...

3246 sym R (2491 sym/13 pcs) 38 img

Queensland road accidents mapped with Shiny and leaflet in R

02.05.2019

The Queensland government collects data on road accidents dating back to 1st January 2001 and details characteristics of the incident including, Location of the crash (lat / long coordinates)ABS statistical area codes (SA2-4, LGA, remoteness)Atmospheric and road conditions (weather, lighting, sealed / unsealed roads, speed limit zone, etc)Severit...

2799 sym R (2431 sym/3 pcs) 2 img

Bayesian estimation of fatality rates and accidents involving cyclists on Queensland roads

23.05.2019

In my previous post I built a Shiny app mapping accidents on Queensland roads which was great at showing the problematic areas within cities and regional areas. I have added to this by estimating the fatality rate given the observed accidents and the rate of accidents involving cyclists for SA3 and SA4 areas. I have also updated the filters makin...

5723 sym R (5465 sym/6 pcs) 12 img

Fun with progress bars: Fish, daggers and the Star Wars trench run

15.08.2019

If you’re like me, when running a process through a loop you’ll add in counters and progress indicators. That way you’ll know if it will take 5 minutes or much longer. It’s also good for debugging to know when the code wigged-out. This is typically what’s done. You take a time stamp at the start – start <- Sys.time(), print out some i...

2905 sym R (1935 sym/9 pcs) 6 img

Use more of your data with matrix factorisation

12.09.2019

Previously I posted on how to apply gradient descent on linear regression as an example. With that as background it’s relatively easy to extend the logic to other problems. One of those is matrix factorisation. There are many ways to factorise a matrix into components such as PCA, singular value decomposition (SVD), but one way is to use gradie...

6225 sym R (2606 sym/19 pcs) 66 img

Simulating data with Bayesian networks

15.10.2019

Bayesian networks are really useful for many applications and one of those is to simulate new data. Bayes nets represent data as a probabilistic graph and from this structure it is then easy to simulate new data. This post will demonstrate how to do this with bnlearn. Fit a Bayesian network Before simulating new data we need a model to simulate d...

6190 sym R (9086 sym/21 pcs) 10 img

Some basics and intuition behind GAN’s in R and Python

15.04.2020

Generative Adversarial Networks are great for generating something from essentially nothing and there are some interesting uses for them. Most uses are some sort of image processing. Nvidia’s GauGAN is an impressive example, giving the user an MS paint-like interface and generating landscapes. You can give the beta a shot here. I wanted to take...

8073 sym R (1181 sym/6 pcs) 24 img

Evolve new colour palettes in R with evoPalette

07.06.2020

What’s that saying? Choice is the enemy of happiness, or something like that. There are so many colour palettes out there, that saying tends to resonate when either choosing one, or creating a new one. So, I started to think about a way I could make this more organic, and came up with the idea for evoPalette. evoPalette allows for the discover...

6863 sym R (520 sym/6 pcs) 26 img