Sometimes, it's not so bad when franchises collide:

I still rate Predator would whip Superman. Predator is the sickest alien out there.

## 28 June 2009

### Bayesian Analysis: To probably be, or probably not be, depending on something else's probability

That man of science, Urikalish, loves to torment us superstitious, intuitive mortals who adore the Secret and the Law of Attraction with logic. This is his latest riddle:

Let’s assume there’s a deadly disease that affects 1 in every 10 people.

Let's say there’s a pretty good test for this disease which is 90% accurate (that means that if a person is sick – the test will say he’s sick in 90% of the cases, and if a person is healthy – the test will say he’s healthy in 90% of the cases).

Now, assuming you took this 90% accurate test, and got a positive result that implies that you are sick - what are the odds that you are really sick?

The key to solving this riddle is Bayes's Theorem. Don't ask me why. I'm an elitist and I don't need to explain myself to the likes of you. Especially when I have no idea what I'm talking about.

Smart people can fill in the data directly from Urikalish's riddle into Bayes's Theorem and get a result. Unfortunately, I played more with the glue and crayons than with the abacus and the clay when I was a kid, so I need something simpler.

Eliezer S. Yudkowsky, that boy genius who tells us about his AI (that is, Almost Implemented) research, has the remarkable ability to make some really, really smart stuff seem really, really simple. This is Yudkowsky's explanation of Bayes's Theorem, which still went over my head (must've been toxic glue), so I tried something that is even more simple and more familiar to me, namely decision trees.

Start at the beginning and make a split for those who have the disease, and those who are healthy. Branching of each node of the tree has to add up to 1, otherwise you're cooking Dutch books. Proceed up the tree, splitting each node into all the possible scenarios, and you'll eventually cover your entire sample space and thus have a visual representation of your full joint distribution.

The probability of having the disease is equal to the amount of people who have the disease and test positive, divided by the total number of people who test positive.

If you said 90%, you are stating the probability that the test is right. This is a different probability than having the disease. If you said 10%, you are stating the probability that anybody has the disease, regardless of taking the test or not. The probability of having the disease is affected by both the probability that the test is right and the rarity of the disease.

The total number of people who have the disease here is 0,1, which is 10 %, or 10 out of the 100. The total number of people who test positive is 0,1 x 0,9 for those who have the disease (or 9 out of the original 100), and 0,9 x 0,1 of those who do not have the disease (also 9 out of the original 100). This means the total amount of people who test positive in the original population is 18 out of 100.

Finally, your answer 0,5 ie 50%. You get this from the 9 who test positive and do have the disease divided by 18 who test positive in the total population. The decision tree makes it visible who tested positive, so you are less likely to get confused. How likely? I don't know, draw your own damn tree.

### Urikalish's Riddle

Let’s assume there’s a deadly disease that affects 1 in every 10 people.

Let's say there’s a pretty good test for this disease which is 90% accurate (that means that if a person is sick – the test will say he’s sick in 90% of the cases, and if a person is healthy – the test will say he’s healthy in 90% of the cases).

Now, assuming you took this 90% accurate test, and got a positive result that implies that you are sick - what are the odds that you are really sick?

### Bayes's Theorem

The key to solving this riddle is Bayes's Theorem. Don't ask me why. I'm an elitist and I don't need to explain myself to the likes of you. Especially when I have no idea what I'm talking about.

- P(A|B): This is the probability of A, given B. This is what you are looking for. This is the posterior or revised probability that you have the disease, given the fact that you test positive.
- P(B|A): This is the conditional probability, or the probability of B given A. In other words, the probability that you test positive, given that you have the disease.
- P(A): This is the prior probability of A, or the prior probability that you have the disease, regardless of whether your test is positive or not.
- P(B): This is the prior probability of B, or the prior probability that you test positive, whether you have the disease or not.

Smart people can fill in the data directly from Urikalish's riddle into Bayes's Theorem and get a result. Unfortunately, I played more with the glue and crayons than with the abacus and the clay when I was a kid, so I need something simpler.

### An Intuitive Explanation of Bayes's Theorem

Eliezer S. Yudkowsky, that boy genius who tells us about his AI (that is, Almost Implemented) research, has the remarkable ability to make some really, really smart stuff seem really, really simple. This is Yudkowsky's explanation of Bayes's Theorem, which still went over my head (must've been toxic glue), so I tried something that is even more simple and more familiar to me, namely decision trees.

### Using Decision Trees in Bayesian Analysis

Start at the beginning and make a split for those who have the disease, and those who are healthy. Branching of each node of the tree has to add up to 1, otherwise you're cooking Dutch books. Proceed up the tree, splitting each node into all the possible scenarios, and you'll eventually cover your entire sample space and thus have a visual representation of your full joint distribution.

### Explanation

The probability of having the disease is equal to the amount of people who have the disease and test positive, divided by the total number of people who test positive.

If you said 90%, you are stating the probability that the test is right. This is a different probability than having the disease. If you said 10%, you are stating the probability that anybody has the disease, regardless of taking the test or not. The probability of having the disease is affected by both the probability that the test is right and the rarity of the disease.

The total number of people who have the disease here is 0,1, which is 10 %, or 10 out of the 100. The total number of people who test positive is 0,1 x 0,9 for those who have the disease (or 9 out of the original 100), and 0,9 x 0,1 of those who do not have the disease (also 9 out of the original 100). This means the total amount of people who test positive in the original population is 18 out of 100.

Finally, your answer 0,5 ie 50%. You get this from the 9 who test positive and do have the disease divided by 18 who test positive in the total population. The decision tree makes it visible who tested positive, so you are less likely to get confused. How likely? I don't know, draw your own damn tree.

### How to remove toolbars

Toolbars really annoy the manure out of me. It is simply poor interface design to have some junk from your previous page hover over your next page. Upon navigating to a new page, the user expectancy is to see a new page, not clutter from the old page.

Jakob Nielsen is the guru of user interface design. He offers some heuristics to guide interface design, which make the peasant user experience much more pleasant. You may cast an eye on that list and see for yourself how many heuristics are ignored because some social networking Mafia wants to spam your browser. Tsk, tsk, social networking sites. David Bowie is very disappointed in you.

Yet one of the most useful heuristics I've learnt from real-life is that there are two ways to solve a problem: the political way and the technical way. The political way to make toolbars go away is to grovel and beg the social networking Mafia until they make the toolbar disappear. The technical way is just to remove the toolbar.

I'm on a few social networking sites. The same basic method seems to work for all of them, but since the whole world and the kitchen sink seem to be on Facebook, I'll only include the procedure to remove the toolbar on that site:

Remove the tool and keep the bar, I always say. Except when I'm saying something else like jam out with your clam out, or get your yah-yah's out or something.

From now on, Facebook's annoying toolbar will no longer haunt your external links. Unfortunately, they still malform the URL sometimes. Bloody useless bunch.

### Why toolbars are bad

Jakob Nielsen is the guru of user interface design. He offers some heuristics to guide interface design, which make the peasant user experience much more pleasant. You may cast an eye on that list and see for yourself how many heuristics are ignored because some social networking Mafia wants to spam your browser. Tsk, tsk, social networking sites. David Bowie is very disappointed in you.

### How to make toolbars go away

Yet one of the most useful heuristics I've learnt from real-life is that there are two ways to solve a problem: the political way and the technical way. The political way to make toolbars go away is to grovel and beg the social networking Mafia until they make the toolbar disappear. The technical way is just to remove the toolbar.

### Removing the toolbar on Facebook

I'm on a few social networking sites. The same basic method seems to work for all of them, but since the whole world and the kitchen sink seem to be on Facebook, I'll only include the procedure to remove the toolbar on that site:

- Step 0: Install Greasemonkey.

Greasemonkey good! Greasemonkey works on Firefox. If you are using Internet Explorer, good luck with your porn viruses and your vi4g0rag0ra spam. - Step 1: Install this simple script.

All you need to do is to click on the URL. Greasemonkey will give you a pop-up window and ask you if you want to install the script. You might want to click on install.

Get the script here:

http://herzbot.netii.net/my_dir/javascripts/facebooktoolbarblocker.user.js. The link may not work due to Blogger's security. Just copy the URL and paste it into a browser window.

Remove the tool and keep the bar, I always say. Except when I'm saying something else like jam out with your clam out, or get your yah-yah's out or something.

From now on, Facebook's annoying toolbar will no longer haunt your external links. Unfortunately, they still malform the URL sometimes. Bloody useless bunch.

## 12 June 2009

### Herzbot: A prototype music recommender

Herzbot is a music recommender application on Facebook. This is the prototype:

Find Herzbot on Facebook.

The prototype uses a combination of collaborative filtering and a novel way to model social context I thought up to make music recommendations to you.

### How does it work?

Herzbot constructs a profile for you and other Herzbot users. These profiles are then compared to give you recommendations from similar profiles. This is how ordinary collaborative filtering recommendations work. Herzbot also asks you for a few elite friends, which is your social context. This makes Herzbot unique. Your profile is constructed as follows:

- You give Herzbot the name of one of your favourite artists and it gets a list of similar artists that you rate on a scale of 0 to 100%. Herzbot uses the Echo Nest API to get similar bands.
- Then, you pick your elite friends who you think have more influence on your music taste than your ordinary Facebook contacts. Herzbot then constructs a profile for you. This is the only information Herzbot uses (user names and your band preferences and ratings that you dictate). I'm not browsing your profiles or spying on you or spamming email addresses. I'm not Santa Clause, although I would like to know where all the bad girls live.
- Finally, when those friends also add the application, you get to see what they like and exactly how much. You also get recommendations straight from their listening profiles (that's the social context modelling part) or ordinary plain vanilla with a bit of flake recommendations (that's the collaborative filtering part, however your elite contacts still count a little bit more than ordinary Facebook users when it comes to making recommendations to you).

### Can you listen to free music?

Yes! If you want to explore the recommended bands, you can find them on iLike with a link straight from Herzbot. iLike has quite an extensive database and you don't need to sign up to listen to streaming audio, which is why I chose iLike over Last.fm and the others where you need to join.

You can listen to your recommendations, listen to the top bands your friends like or listen to the entire profile of your elite friends. It is about exploring new music, after all.

### Keep in touch

If you are on Facebook and you'd like to try it out, feel free to add it:

Add Herzbot, the socially conscious Facebook music recommender.

UPDATE: The questionnaire is now up and running. If you added Herzbot, please take the questionnaire (that's a survey for the Yanks):

The Herzbot Survey on Survey Monkey.

You are also welcome to join the developer's group and give me feedback:

Join the Herzbot developer's group.

If you add it, please check back daily over the course of the next two weeks. I will add a questionnaire, which I need to make my hairbrain scheme seem more plausible to academia. I would greatly appreciate your feedback! The other reason is that your recommendations will improve as your elite friends join and as more people join Herzbot.

Labels:
application,
collaborative filtering,
echo nest,
facebook,
herzbot,
iLike,
last.fm,
modelling,
mp3,
music,
prototype,
recommender,
social context

Subscribe to:
Posts (Atom)

## Creative Commons License

This work is licensed under a
Creative Commons Attribution
2.5 South Africa License.