RSS Amplifier

Blog

David Owen’s blog

Forward motion

blog.fugue88.wsSource feed ↗15 posts

Dormant Last read · last published · next check
Read 8 days ago and current, but nothing has been published for 21 months.

Written by

Latest posts

PCA for Classification Is as Bad as Random

Basically, PCA (Principle Component Analysis) finds projection axes based on total population variance. Because that is not correlated with classes, that means that adding PCA into your classification pipeline is essentially adding a random variable. Or, more exactly, it's like using a set of random, orthogonal projection axes. Here's a simple example of PCA making classification harder……

In-order responses for asynchronous work

Sometimes we end up executing some asynchronous function several times in a row, but we need only the results of the last call. The difficulty is that some earlier invocations may finish after the latest. I encounter this most often in Javascript, when I call an API in response to ongoing user input, like for looking up an address. While debouncing can help reduce this problem (and should be done…

Pipelines in Lisp

Better averages for online machine-learning

Averages are used, in some form or other, and many machine-learning algorithms. Stochastic gradient descent is a great example of an average in disguise, thin though it may be. Picking the right kind of average can be critical. As learning algorithms explore sub-optimal choices, the resulting negative impact on backed-up state values can persist over epochs, hampering performance. Alternatively,…

Action-selection and learning-rates in Q-learning

Implementing a Q-table reinforcement-learner is in many ways simple and straight-forward and also somewhat tricky. The basic concept is easy to grasp; but, as many have mentioned, reinforcement-learners almost want to work, despite whatever bugs or sub-optimal math might be in the implementation. Here are some quick notes about the approach I've come to use, specifically about action-selection…

Simulating deck-shuffling

I recently worked on a small project simulating random events that were far too numerous to enumerate. In such cases, every bit of speed matters. The project in this case was similar to determining likelihood of five-card Poker hands in seven-card draws. Simulation of shuffling the deck and drawing cards can take a large part of the runtime if not done well, but there's a trick that makes it…

Exact random sums

Sometimes, you need a list of random numbers that sum to a known constant. There's a known algorithm to provide this list of numbers with the proper distribution, but a straight-forward implementation may give a list that doesn't sum exactly to the desired constant because of rounding error. This article describes the basic algorithm, why the rounding error happens, and the solution. Continue…

Precision of random numbers

In some sense, random numbers uniformly-distributed in the range \([0, 1)\) are the easiest class of random number to generate. Because of the internal representation of floating-point numbers, all you need to do is fill the significand with random bits, set the exponent to -1, and the sign bit to positive. Some language run-times do this better than others. This article shows how to check your…

certbot and tinydns

Let's Encrypt now supports wildcard certificates. To confirm DNS control, they support several different DNS providers and dynamic DNS protocols, but they don't yet have a plugin for tinydns by DJ Bernstein. Luckily, the excellent designs of both certbot and tinydns make it very easy to support on your own. Continue reading "certbot and tinydns"

von Neumann's 4-player {1/3, 1/3, -1/3, -1/3} imputation

In Theory of Games and Economic Behavior , von Neumann discusses solutions to some kinds of zero-sum four-person games. See section 37.4.2, page 317. There, he finds that one set of imputations is incomplete, and must have at least another imputation added to it. He writes that [it] seems very difficult to find a heuristic motivation for the steps which are now necessary before giving the…

Exponential Moving Average (EMA) Rates, part 3

In the last post, we created an online implementation of an EMA to measure the rate of a Poisson event. However, it has the “warm-up” period seen in most EMA implementations. This time, we’ll correct that. The technique is similar to what I wrote in The correct way to start an Exponential Moving Average (EMA) . Continue reading "Exponential Moving Average (EMA) Rates, part 3"

Exponential Moving Average (EMA) Rates, part 2

In the last post , we simulated some Poisson data and then verified it by looking at its histogram and some descriptive statistics. We also built a basic sliding-window implementation and graphed its output. To continue on, we’ll need to build a more realistic implementation, along with a method to feed it the simulated events. With that in hand, we’ll build an EMA function specialized…

Exponential Moving Average (EMA) Rates, part 1

I had been thinking about determining the average rate of occurrences over time of some observation. For example, you might like to measure how much traffic flows through a street throughout the day. Reporting the time that every single car goes by is very accurate, but not very useful. You might bin traffic into hours starting on every hour, but if there is a spike or sudden increase in the…

The correct way to start an Exponential Moving Average (EMA)

The EMA is a very handy tool. It lets us calculate an average over recent data. But, unlike a Simple Moving Average, we don't have to keep a window of samples around—we can update an EMA "online," one sample at a time. But the perennial question is: how do you start an EMA? First, here are a couple of wrong ways. Continue reading "The correct way to start an Exponential Moving Average (EMA)"

Deciding once

In Fixing dispatch , we refactored some code that dispatched things from a switch -statement or cascading if -statements to dispatching by polymorphism. This time, we'll refactor a different piece of dispatch in a completely different way, and cover another design principle. Continue reading "Deciding once"