Michael Wooley's Homepage
Occaisional writing on whatever I'm working on at the moment.
Understanding Expections: A New Tool
I’ve had a microsite lurking around here for some time and I thought I’d acknowledge it as a legitimate child. The site is a proof-of-concept for questions that elicit the subjective beliefs of respondents. For example, let’s say I wanted to ask someone how much an average Uber driver makes per average hour. I could just ask you to give me an estimate like, “$15.” I’ve come across hugely-varying estimates. A paper by authors that included Uber employees put mean earnings at $21.07 (Cook et al., 2018, Table 1). An independent survey by Ridester put the figure at $13.70 (pre-tip). I haven’t tried to ferret out the source of the disparity. It may have to do with differing normalizations of the cost of living across cities. It could also just be a survey issue. But think about what happens in your head when someone asks you that question. You probably weighed a lot of factors then answered with something like the mean of your beliefs. If I just ask you for a point estimate (i.e. one number) then I’m potentially leaving a lot of information concerning the extent of your uncertainty on the table. Are you almost certain it is $15 or do you think it could pretty much be anywhere between $10 and $20? Do you maybe think it is either $15 or $17? Each of these cases generates a whole new interpretation of question response. The site demonstrates a method of capturing all of this uncertainty.
A Time- and Memory-Efficient Solution to $\text{cholesky}\left[A\otimes B\right]\varepsilon$
This post discusses an efficient solution to $\text{cholesky}\left[A\otimes B\right]\varepsilon$, where $A$ and $B$ are real, symmetric, positive definite matrices of while $\varepsilon$ is an appropriately-sized vector. Why would anyone ever want to compute this thing? Basically, an expression like this is going to pop up if you want to sample from a multivariate normal distribution with covariance matrix $A\otimes B$.
(Really) Tight Bounding Boxes
I’ve created a simple method to determine precise bounding boxes for characters and text elements within an SVG. Why would this be necessary? Can’t we just get the bounding box for an element by calling node.getBBox()
? It depends on how much precision you need. For text characters and strings this method will assign the same bounding box for every character. So, for example, the bounding boxes for “a”, “g”, and “f” will all be the same. For a lot of applications this will do. However, if you need to know exactly where a character is located it would be preferable to have a bit more precision.
Drawing With D3.js Part 4: Data Extraction
In the fourth installment of this series I’m going to focus on extracting data from our drawing. What are we trying to do? Suppose that we have a picture of a table on our canvas. We’ll draw a bunch of bounding boxes/rectangles around different elements of the canvas (e.g. a “row”-type bounding box around a row). When we’re done annotating the table we’ll hit “submit” and the program will extract information about the bounding boxes and put them in a data structure that we can use later. This is much easier to understand with an example.
Drawing With D3.js Part 3: Moving and Resizing
We’re going build on the foundation we’ve created in posts 1 and 2 of this series by adding the ability to move, resize, and delete rectangles that we’ve already added to the canvas. The basic idea will be to add additional, invisible rectangles at the corners and edges of the rectangles. We’ll then attach behaviors to these bounding rectangles in order to resize, reshape, and delete.
Scraping Dynamic Web Content
I have a project in mind that is going to involve a lot of scraping from the websites of U.S. soccer leagues. While the leagues offer a lot of data about each match, we’re going to have to do some slightly non-standard tricks to get the data to load. Once that’s done we can use BeautifulSoup to extract the html elements.
Drawing With D3.js Part 2: Zooming and Panning
This post adds features to the drawing app that we started in part 1. In particular, we’re going to make it easy to zoom and pan the canvas. Again D3.js will simplify our job substantially. In fact, there is a built-in feature/command (d3-zoom) that would ordinarily allow us to zoom with a scrolling/pinching gesture and pan with a click-and-drag gesture. The main wrinkle that we’re going to encounter is that the click-and-drag gesture is already taken: we click and drag to add rectangles.
Drawing With D3.js Part 1: Rectangles
In this post I am going to take a first step towards a sort of drawing app with the D3.js
library. By the end of this post we’ll have a functioning-but-limited drawing app. In particular, we’ll be able to add rectangles to an svg canvas via a click-and-drag gesture.