Photo (c) Jan Trutzschler von Falkenstein; CC-BY-NCPhoto (c) Rain RabbitPhoto (c) Samuel CravenPhoto (c) Gregorio Karman; CC-BY-NC

Research

I am a research fellow, conducting research into automatic analysis of bird sounds using machine learning.
 —> Click here for more about my research.

Music


Other

Older things: Evolutionary sound · MCLD software · Sponsored haircut · StepMania · Oddmusic · Knots · Tetrastar fractal generator · Cipher cracking · CV · Emancipation fanzine

Blog

I've been staying in Cambridge recently, on a research visit. (Cambridge UK, that is.) So I've had lots of opportunity to try the local eateries. So! Now you get to find out which are the best places to eat, if you ever need to eat in Cambridge:

Those are my definite recommendations. Here's a map with them marked on. Thanks to everyone who gave me tips on where to eat! Also some honourable mentions to:

(I also previously blogged about sushi in Cambridge...)

food · Permalink / Comment

All these years I've been living in South Woodford I've been tweeting food things from my @nomnomdan twitter. Now, as I prepare to leave South Woodford, what will I miss? Or to put it another way, if you're in South Woodford what should you definitely eat?

Restaurant-wise, there's plenty of stuff to choose from. Turkish Mangal I've already recommended. Also good are Ark (fish restaurant), Wildwood (italian chain), Nino's (italian), Morello (italian).

So now you know what to eat! (BTW - if you agree or disagree, let me know on twitter. For example, Welshbeard says Bella Naples is great, I didn't get round to trying it.)

food · Permalink / Comment

Maths can be magic sometimes. Here's a probability thing - it's very very niche, but it works out nicely.

I needed to sample K iid exponential variables given that I knew their sum was S. The exponential distribution has one parameter for the "rate" (usually written as the greek character lambda, but let me write it as L). We don't necessarily know the value of L but we do know S.

Let's start simply. Instead of saying we have K variables we'll start with just two, and we'll call them x and y. So we know S, and we know that x+y=S.

For comparison, let me see what happens when we condition on the maximum rather than the sum. So we know the maximum M, and we know that x<M and y<M. It's quite a similar problem, and in that case we find that x and y remain independent, and identically distributed: P(x|M) and P(y|M) are just the truncated exponential distribution. This distribution still involves L. The shape of the distribution still depends on this unknown rate parameter.

So back to the real problem. It's the sum x+y=S that we know. So let's write the joint distribution:

P(x,y|S) α L exp(-Lx) L exp(-Ly) I(x+y=S)

(where "I()" is the indicator function, and "α" means "is proportional to" - my blog doesn't do proper maths typesetting.)

and we can substitute y=S-x:

P(x,y|S) α L exp(-Lx) L exp(-LS + Lx) I(x+y=S)

P(x,y|S) α L exp(-Lx) L exp(-LS) exp(Lx) I(x+y=S)

P(x,y|S) α L^2 exp(-LS) I(x+y=S)

So the x and y vanish to leave constant terms (except for the indicator that limits us to the 2-simplex). The distribution is simply uniform on the 2-simplex! It doesn't even depend on L - the lambda vanishes. Magic.

In other words, to sample two iid exponentials conditioned on their sum S, you can do it by taking a single uniform sample in the range [0,S]. Much easier than we might have thought.

This generalises to more than two variables. Sampling K exponentials conditioned on their sum S is equivalent to sampling uniformly from the unit K-simplex and multiplying the result by S.

This is covered more formally in this free book Non-Uniform Random Variate Generation, which I found via someone's blog article Sampling from a simplex (where they're coming at the problem from the other way round).

maths · Permalink / Comment

I'm surprised that Cambridge doesn't have many sushi places. Surely they've always had plenty of Japanese students around, and plenty of posh metropolitan types? Or does it not work like that? Anyway, I have found two proper sushi restaurants in Cambridge (UK) so here's a quick review.

(Actually, as well as these two, in the middle of town there's a Yo Sushi and soon-to-be a Wasabi too. I've nothing against those chain shops but I don't think of them as proper sushi, simply because you can usually only get tuna and salmon stuff, they don't have a proper sushi selection. Good for convenient food but not the full deal.)

  1. U-Sushi near the Grafton Centre is a friendly little place that does a lot of takeaway. The fish could have been fresher, but there's plenty of variety on the menu and I particularly liked their vegetarian california rolls, made with asparagus, avocado, cucumber, shitake mushroom and pickle.

  2. Japas just off Lensfield Road has a bit more of a restauranty vibe, if that's what you're after. They also seem to do plenty of takeaway. The fish is the same quality as U-Sushi and the range is pretty similar too. I wouldn't bother with their deep-fried ice-cream for afters though, it's nowhere near as much fun as it should be.

Anyone got any more tips? Let me know. There must be a secret sushi palace secreted around here somewhere...

food · Permalink / Comment

I want to tell you which is the best DAB radio. I have it here in front of me:

Radio photo

I've seen many DAB radios in my time. My ex worked at the first BBC digital radio station when it launched, so we saw all the early models.

Old analogue radios, like a lot of analogue things, had this great built-in interface quirk. In the old days you couldn't just choose a radio station, you had to turn a dial and that would tune the frequency to the station you wanted. I'm NOT talking nostalgia here, I'm talking usability. This strange quirk meant you could learn the interface really well - the radio stations were always at the same place on the dial, and you very quickly learnt exactly how much to turn to go straight from Radio 4 to Radio 1.

DAB radio designers didn't really have this, they just had a big list of stations. In fact they had it worse than that: if there was any "natural" interface driven by the mechanics of DAB it would be a hierarchical list where first you choose your multiplex, then you choose your station. The early DAB radios forced you to do this. Firstly, navigating a hierarchical list is fecking annoying on any device that doesn't have a massive computer screen. Secondly, the hierarchical list means nothing to anyone. No-one knows intuitively if Smooth FM and the World Service are on the same multiplex or not, and they shouldn't have to know.

DAB radio designers came up with various ways round this. They added presets of course - lots of FM radios have this too. Trouble is, they generally had to add lots of buttons, especially as they needed to support both DAB and FM. Bleh. Clicky interfaces, menus to scroll through. Bleh.

Well now the perfect DAB/FM radio interface has been settled on and it looks like this:

Radio photo

It's from John Lewis (it's called the "Spectrum"), and it's a little portable thing. It does DAB, FM and USB, it runs off battery or mains, it doesn't take more than 4 seconds to turn on (unlike many other digital radios which sit around saying "hello" while secretly they're frantically booting stuff up).

But the one thing I want you to notice is how easy it is to operate it in the dark, with your eyes closed, or with one hand stirring a pot of soup. There is a very small number of buttons/knobs, and when you grab for it without looking you can instantly feel which button you're on. After a day or two you can change the station, change the volume, change DAB/FM, or turn it on/off without looking, and really that's all you need!

The minimalism continues through the interface too: there are no presets, for example. Some might find miss the lack of presets, but it takes away a lot of interface complexity. There's an implicit "two-preset" character anyway, since of course it remembers one DAB station and one FM station, the ones you had on last.

The two dials on the top are not continuous dials, by the way, they're click-wheels. I do miss a little the ability to be as subtle as you like with the volume control, but I don't mind much. On the station dial, for DAB you're wheeling through the alphabetical list, which you can sometimes do with your eyes shut but not always - but at least the stations are always in exactly the same place, it's still a learnable interface. On FM, the dial changes the frequency, as you'd expect, plus the curiously named "Reset" button does auto-scanning for you on FM, and that works fine too.

I actually bought this radio for my ex. After seeing it in action for a while, I went and bought another one, for myself!

design · Permalink / Comment

My Return key is getting a bit flaky, so I've just worked out how to reuse my "AltGr" key as a backup in case of emergency. Noting it down for my own reference.

In Linux you can configure anything, including custom keyboard layouts, but it can be tricky to find the advice online that actually matches your system. (Standard Ubuntu has some helper apps that a LXDE desktop doesn't, etc etc.) I think this method will work with any Debian-based system, and I took it from Debian's multimedia-keys guide.

Basically, follow the instructions in that wiki page:

That's enough to enable it for this session. Then you just have to add that last command as one of your autostart programs so it'll be available in future sessions. I did it by running "gnome-session-properties" tool, but also belt-and-braces in my .zshrc because of some other config I have in there.

linux · Permalink / Comment

I hadn't noticed that both Björk and Kim Gordon had split up from their long-term partners. Thing is, last summer I split up from my long-term partner. I think back then I would have gained some solace from the work of fabulous artists who were going through analogous pain - even if the analogies were only superficial. But then, I was deep in it all, too busy with our own difficulties and the horrible pile of practicalities that accompany a long-term breakup, to notice everything around me.

That changed this year, when Kim Gordon published a book, and Björk published an album, both of which foreground their breakups. But the timing has changed - it's not last summer any more, and I'm not in the heat of it, so I don't need to take solace from these things like I did back then. I can feel some empathy, remotely of course. I really wonder what I would have made of it all last summer.

Björk's album Vulnicura is a heartfelt and very raw heartbreak album. It does some amazing things, some really intense sonic moments, which work on these emotional issues universally, and Björk's lyrics are along similar lines but they often dive really deep into uncomfortably intimate detail. A bit like hearing someone listing all the bad things their ex did, and not being sure quite how literally to take it all:

"Family was always our sacred mutual mission/ Which you abandoned."

It's so direct that it makes me want to hear the other side's rejoinder. (I should say, by the way, that that quote is nothing like what was going on in my case.)

It's really quite striking though that it's Björk and Kim Gordon. Björk has for decades expressed a very open and deep emotional literacy in her music, and in recent years it's increasingly been less about torrid excitement and more about family bonds. Kim Gordon and Thurston Moore were the alt-rock equivalent of the ideal family: together for decades, raising kids while pushing Sonic Youth and their other projects ever onward. And if these paragons are not immune, well on the one hand that's really sad, while on the other hand maybe I can take some solace from it after all. Their lives aren't exactly average lives, but then whose is? We're still all tumbling through the same kaleidoscope.

Permalink / Comment

The whole idea of static site generators is interesting, especially for someone who has had to deal with the pain of content management systems for website making. I've been dabbling with a static site generator for our research group website and I think it's a good plan.

What's a static site generator?

Firstly here's a quick historical introduction to get you up to speed on what I'm talking about:

  1. When the web was invented it was largely based on "static" HTML webpages with no interaction, no user-customised content etc.
  2. If you wanted websites to remember user details, or generate content based on the weather, or based on some database, the server-side system had to run software to do the clever stuff. Eventually these evolved into widely-used "content management systems" (CMSes) - such as drupal, wordpress, plone, mediawiki.
  3. However, CMSes can be a major pain in the arse to look after. For example:
    • They're very heavily targeted by spammers these days. You can't just leave the site and forget about it, especially if you actually want to use CMS features such as user-edited content, or comments - you need to moderate the site.
    • You often have to keep updating the CMS software, for security patches, new versions of programming languages, etc.
    • They can be hard to move from one web host to another - they'll often have not-the-right version of PHP or whatever.
  4. More recently, HTML+CSS+JavaScript have developed to the point where they can do a lot of whizzy stuff themselves (such as loading and formatting data from some data source), so there's not quite as much need for the server-side cleverness. This led to the idea of a static site generator - why not do all the clever stuff at the point of authoring the site, rather than at the point of serving the site? The big big benefit there is that the server can be completely dumb, just serving files over the network as if it was 1994 again.
    • That gets rid of many security issues and compatibility issues.
    • It also frees you up a bit: you can use whatever software you like to generate the content, it doesn't have to be software that's designed for responding to HTTP requests.
    • It does prevent you from doing certain things - you can't really have a comments system (as in many blogs) if it's purely client-side, for example. There are workarounds but it's still a limitation.

It's not as if SSGs are poised to wipe out CMSes, not at all. But an SSG can be a really neat alternative for managing a website, if it suits your needs. There are lots of nice static site generators out there.

Static site generators for academic websites

So here in academia, we have loads of old websites everywhere. Some of them are plain HTML, some of them are CMSes set up by PhD students who left years ago, some of them are big whizzy CMSes that the central university admin paid millions for and doesn't quite do everything you want.

If you're setting up a new research group website, questions that come to mind are:

So using a static site generator (SSG) might be a really handy idea. So that's what I've done. I used a static site generator called Poole which is written in Python and it appealed to me because of how minimal it is.

Poole does ALMOST NOTHING.

It has one HTML template which you can make yourself, and then it takes content written in markdown syntax and puts the two together to produce your HTML website. It lets you embed bits of python code in the markdown too, if there's any whizzy stuff needed during page generation. And that's it, it doesn't do anything else. Fab!

But there's more: how do people in our research group edit the site? Do they need to understand this crazy little coding system? No! I plugged Poole together with github for editing the markdown pages. The markdown files are in a github project. As with any github project, anyone can propose a change to one of the textfiles. If they're not pre-authorised then it becomes a "Pull Request" which someone like me checks before approving. Then, I have a little script that regularly checks the github project and regenerates the site if the content has changed.

(This is edging a little bit more towards the CMS side of things, with the server actually having to do stuff. But the neat thing is firstly that this auto-update is optional - this paradigm would work even if the server couldn't regularly poll github, for example - and secondly, because Poole is minimal the server requirements are minimal. It just needs Python plus the python-markdown module.)

We did need a couple of whizzy things for the research site: a publications list, and a listing of research group members. We wanted these to come from data such as a spreadsheet so it could be used in multiple pages and easily updated. This is achieved via the embedded bits of python code I mentioned: we have publications stored in bibtex files, and people stored in a CSV file, and the python loads the data and transforms it into HTML.

It's really neat that the SSG means we have all our content stored in a really portable format: a single git repository containing some of the most widely-handled file formats: markdown, bibtex and CSV.

So where is this website? Here: http://c4dm.eecs.qmul.ac.uk/

IT · Permalink / Comment

Other recent posts: