In a previous post I deployed a Flask app with Docker. This time around I wanted to see if it was any different to host a Django app. It turns out that it wasn’t that much different.
I thought I’d show some examples of solving some common statistical word problems using Python. Today I’ll look at exponential random variables; this is a continuous random variable used to model the waiting time between independent events. Sometimes this is posed as the waiting time for the first event in a Poisson process.
I keep forgetting how to do this:
brew install imagemagick convert out/*.png out.pdf
This adds integers using bit-wise operations. I tried to provide a lot of print statements so that you could see what’s going on with each step.
A co-worker was interested in segmenting a list of data points, and I went down a rabbit hole on one dimensional segmentation. I found an article on the Jenk’s natural breaks optimization on Wikipedia. I found another article that had some examples. This is used to bin data points so that clusters are always binned together. There is an iterative method that takes unordered data, but this implementation just sorts the data before binning.
For a while I’ve wanted to work on a typed spreadsheet application. This weekend I started working on an interpreter for it using David Beazley’s PLY. So far, this is able to store data and type information in cells in a data store, and perform operations using numbers or references to cells. It also supports limited type checking.
A few weeks ago, I had trouble accessing aliases in bash scripts. It turns out that aliases are not expanded in scripts, only when the shell i interactive. However, we can get around this by using
expand_aliases at the top o our script.
#!/bin/bash shopt -s expand_aliases ...