iTunes U podcasts on Android

In the giant ledger that weighs up the pros and cons of the Internet for humanity, one of the unalloyed virtues is the easy availability of world class lecture series you can watch or hear for free.

(Thank you especially to Stanford, I’ve enjoyed relativity and convex optimization recently, as well as Andrew Ng’s machine learning course.)

Recently I’ve been interested in game theory, but annoyingly the Yale site only gives an iTunes U link like this:

http://deimos3.apple.com/WebObjects/Core.woa/Browse/yale.edu-dz.2821770593

But I don’t have an iPod, do I have to mess around with hulking great mp3 files separately? Ah-ha, no. You can change “Browse” to “Feed” like this in the URL to get an RSS feed:

http://deimos3.apple.com/WebObjects/Core.woa/Feed/yale.edu-dz.2821770593

… which you can subscribe to with Google Listen.

I like to use a URL shortener such as bit.ly to save me typing all that into my phone, getting it down to http://bit.ly/fcJQuz.

Formula for happiness

The formula for happiness turns out to be 0.67 + 0.09 * sin(0.93t), who would have thought it was so simple?

At least that is what you get if you put my personal mood data from Affect Sampler through the free-as-in-beer download of Eureqa. This is a workbench that applies the techniques from Hod Lipson’s “Distilling Free-Form Natural Laws from Experimental Data” paper, using genetic programming to find parsimonious functional forms for arbitrary data.

I was really impressed with how quick and easy it was to set up and find something reasonable. While the fit is far from great on my toy emotion tracking test, with just a few weeks’ data (surprisingly, my moods are not exactly periodic!) it does seem to have found a something approaching a valid pattern. With t measured in days, 2*PI/0.93 = 6.75 which is close to seven. It looks to me like it is trying to fit a weekly rhythm, which seems plausible enough.

Eureqa screenshot

Screenshot from Eureqa software fitting Affect Sampler data


What do you think?

Solving Sudoku with L1-norm minimization

I came across an interesting paper by Babu, Pelckmans, Stoica the other day, via my favourite Compressed Sensing blog Nuit Blanche.

The idea is that it is possible to formulate Sudoku as a linear system, with the board as a 9x9x9 indicator vector and the rules as a matrix encoding the different Sudoku constraints. The solution to this system with the minimal L1-norm will often be an indicator vector as well – and will represent the solution to the puzzle with the missing entries completed.

To play around with the ideas here I re-implemented the paper in Python, using CVXOPT. I’m going to try and explain all this coherently at the December London Python Dojo meetup

Update: I’ve now updated the code with the help of the much-easier-to-use CVXMOD wrapper library, and put it on GitHub here if you want to play with it.

The original authors’ Matlab codes are available as well.

Android experience sampling update

I’ve updated the Affect Sampler code on GitHub recently. If you want to play with it, it now has:

  • A downloadable .APK file you can use to install it to your phone
  • A hosted web service you can sync your data to, with a Google account
  • The ability to make graphs of your mood on the phone

You can also export the data from the web service, to load into something like Timetric.

There’s lots more to do on this, but all you Android-toting self-tracking experimentalists can play with it now. Let me know if you do – I’d be happy to hear your thoughts. I’d also be happy to hear from anyone who wanted to use it as a data-gathering platform for experiments in psychology or similar…

(Thanks to @jhugman for his generous feedback!)

Experience sampling on Android

I’ve started writing a personal informatics application for Android phones to quickly record moods throughout the day, at random intervals – a technique which seems to be called Experience Sampling. It would work well with a service like your.flowing.data, and I’m intending to add support for uploading to something like that soon.

The motivation is to make use of the rich data that comes from a smartphone to allow a bit of objective introspection into our own lives, to find out what actually makes us tick (a la Quantified Self). I’m intending to start with a mood diary, but then try to correlate this with other data streams that can be captured: my location, the weather; data from my bank balance and diary; perhaps diet or exercise habits.

The code is on github if you’re interested. It builds and runs on my HTC Hero now, but it’s pretty basic – when there are a few more features I might give it a proper licence and release it on Market if there’s interest.

Energy and the economy

Via FT Alphaville an interesting but scary article on Energy is everything by Michael Lardelli.

He considers the embedded energy value of each dollar and looks at the world economy in terms of money supply as well as in energy production terms. His thesis is that the world economy has actually been contracting since 2005, as net energy output falls – economic growth since then was effectively a monetary illusion.

So if economic growth is energy constrained, why doesn’t the price of oil go up, incentivizing energy producers to extract more and increase energy output? Lardelli argues that as we use up easily available resources the remaining energy supplies themselves require more energy to extract. Energy becomes simultaneously scarce and unprofitable.

Once energy is in decline the recent pervasive economic lie that everyone can become wealthier can no longer be sustained. Now one person’s increased wealth can only come at the expense of another person’s worsened poverty. Actually, it is worse than a zero sum game since the economy is not just failing to grow – it is actually contracting at the same time as the number of consumers (population) is expanding.

So now what do we do?

(Reminds me of the ideas in novel The Burning by Thomas Legendre.)

Multiple modes for mxml and Actionscript in Emacs

Flexing in Emacs again… Emacs 22 supports the entertainingly named MuMaMo mode which allows support for Multiple Major Modes. This is useful for editing MXML files that mix XML markup with Actionscript.

I am using MuMaMo together with actionscript-mode and nxml-mode with this definition in my .emacs:

(defun mumamo-chunk-mxml-script (pos min max)
"Find ... , return range and actionscript-mode."
(mumamo-quick-static-chunk pos min max "" "" nil 'actionscript-mode nil))

(define-mumamo-multi-major-mode mxml-actionscript-mumamo-mode
"Turn on multiple major modes for MXML files with main mode `nxml-mode'.
This covers inlined Actionscript."
("MXML Actionscript Family" nxml-mode
(mumamo-chunk-mxml-script
)))

(add-to-list 'auto-mode-alist '("\\.mxml$" . mxml-actionscript-mumamo))