ROC Curves Playground
A small playground for ROC curves
Twenty years after my undergrad stats course, I took a couple of classes on ROC curves.
Instead of installing R I wanted to use Haskell for the exercises.
I glanced at DataHaskell/sabela. I like the proposal, but it is not a standalone tool yet, and I don’t want to fork a project to start hacking. I want to install a tool. I was also not certain about the Haskell ecosystem for this task, so there were enough unknowns already and I moved to a more controlled setup.
I ended up creating a small project using the ReaderT pattern: type App = ReaderT Env IO. The goal was that every experiment run would be reproducible and self-contained. The App offered
- scoped files: every file read or written goes into a folder for that experiment run.
- logging: to STDOUT and to a log file in the experiment run folder.
- seed management: unless one is specified, a random seed is picked, and the seed is logged.
- metadata: the git revision and timestamp of the run.
With the scoped file management a run leaves its inputs, outputs and logs in a single folder that I can revisit, share or discard as a whole.
Each excercise is then clean of boilerplate:
drawNormal :: App ()
drawNormal = do
s <- sample 1000 (normalDistr 0.0 1.0)
saveChart "histogram.svg" $
distributions "Title" [("normal 0 1", s)]The main packages that helped focus on the work to be done were
- PyF for string interpolation
- statistics for the distributions
- hgg for plotting
LLMs were good enough to build some wrappers around hgg.
While working on the exercises and asking the LLM to produce charts, it did notice (unprompted) some oddity with the results produced by the statistics package: haskell/statistics#234.
Finally, I wanted a more reactive document to explore. Sabela would probably be able to deliver this, but for now, and to share it with others, I ended up with a JavaScript based solution. Well, at least it’s coded in Elm: roc.bcardiff.com.