The Easiest Possible Way to Throw a Webapp Online (Flask + Heroku + Postgres)

August 25, 2017

Here's a situation that comes up a lot. I want to throw together a quick CRUD app, or, for my uses, more of a C app (i.e., "hey research assistants, dump all this stuff into a database"). I could use a google form or something, but that always leads to weird output, like bizarre formatting, out in google sheets.

So I'm getting into Flask on Heroku for this kind of thing, for several reasons:

Continue reading →

Java: First Impressions

August 22, 2017

I'm learning Java, for two reasons.

First, I really like Clojure, but I constantly run into barriers where the only way to do something is to drop down to Java code that I don't understand.

Continue reading →

How to spin up up a long-running background process in Clojure

July 26, 2017

Here's a task that doesn't seem to be terribly well documented in one place. What happens if you want to spin up some long-running background shell process in clojure? For example, suppose you're trying to communicate with a python script (example of how to do that), and you'd like to spin both the rabbitmq server and the continuously-running python script up from your main clj application? You can't just use clojure.java.shell, because that will hang the application until the other process returns (i.e., it's blocking).

The easiest method to do this that I can discern is to just wrap it in a future. For example:

Continue reading →

Naive Bayes Speed Test, OR: Everything is a Dot Product

July 25, 2017

(With help from Carlos De La Guardia, who was like "dude, vectorize this stuff" after seeing the incredibly slow implementation the first time, and then was kind enough to talk through the problem and the notebook on which this post is based. All infelicities are mine (and I didn't even implement his wise suggestions for cleaning up the notebook).)

Naive Bayes is the simplest possible machine learning algorithm. In its Bernoulli form, calculation is just a matter of applying probability 101 techniques to calculate the (estimated) conditional probabilities of your predictors given the labels and estimated probability of the labels, then applying Bayes Rule directly to generate a posterior on a label given the data. Trivial.

Continue reading →

Lectures 6-7 (part) of Andrew Ng's mathier ML course

July 24, 2017

Ng lecture 6 and 7: multinomial models, transition to SVM.

Lecture 6

Continue reading →