Crunching the Math On iTunes
markmcb writes "OmniNerd has posted an interesting article about the statistical math behind iTunes. The author makes some interesting observations concerning the same song playing twice in a row during party shuffle play, the impact that star ratings have on playback, and comparisons with plain old random play (star ratings not considered)." From the article: "To test the option's preference for 5-stars, I created a short playlist of six songs: one from each different star rating and a song left un-rated. The songs were from the same genre and artist and were changed to be only one second in duration. After resetting the play count to zero, I hit play and left my desk for the weekend. To satisfy a little more curiosity, I ran the same songs once more on a different weekend without selecting the option to play higher rated songs more often. Monday morning the play counts were as shown in Table 1."
As a record store owner, My business faces ruin. CD sales have dropped through the floor. People aren't buying half as many CDs as they did just a year ago. Revenue is down and costs are up. My store has survived for years, but I now face the prospect of bankruptcy. Every day I ask myself why this is happening.
I bought the store about 12 years ago. It was one of those boutique record stores that sell obscure, independent releases that no-one listens to, not even the people that buy them. I decided that to grow the business I'd need to aim for a different demographic, the family market. My store specialised in family music - stuff that the whole family could listen to. I don't sell sick stuff like Marilyn Manson or cop-killer rap, and I'm proud to have one of the most extensive Christian rock sections that I know of.
The business strategy worked. People flocked to my store, knowing that they (and their children) could safely purchase records without profanity or violent lyrics. Over the years I expanded the business and took on more clean-cut and friendly employees. It took hard work and long hours but I had achieved my dream - owning a profitable business that I had built with my own hands, from the ground up. But now, this dream is turning into a nightmare.
Every day, fewer and fewer customers enter my store to buy fewer and fewer CDs. Why is no one buying CDs? Are people not interested in music? Do people prefer to watch TV, see films, read books? I don't know. But there is one, inescapable truth - Internet piracy is mostly to blame. The statistics speak for themselves - one in three discs world wide is a pirate. On The Internet, you can find and download hundreds of dollars worth of music in just minutes. It has the potential to destroy the music industry, from artists, to record companies to stores like my own. Before you point to the supposed "economic downturn", I'll note that the book store just across from my store is doing great business. Unlike CDs, it's harder to copy books over The Internet.
A week ago, an unpleasant experience with pirates gave me an idea. In my store, I overheard a teenage patron talking to his friend.
"Dude, I'm going to put this CD on the Internet right away."
"Yeah, dude, that's really lete [sic], you'll get lots of respect."
I was fuming. So they were out to destroy the record industry from right under my nose? Fat chance. When they came to the counter to make their purchase, I grabbed the little shit by his shirt. "So...you're going to copy this to your friends over The Internet, punk?" I asked him in my best Clint Eastwood/Dirty Harry voice.
"Uh y-yeh." He mumbled, shocked.
"That's it. What's your name? You're blacklisted. Now take yourself and your little bitch friend out of my store - and don't come back." I barked. Cravenly, they complied and scampered off.
So that's my idea - a national blacklist of pirates. If somebody cannot obey the basic rules of society, then they should be excluded from society. If pirates want to steal from the music industry, then the music industry should exclude them. It's that simple. One strike, and you're out - no reputable record store will allow you to buy another CD. If the pirates can't buy the CDS to begin with, then they won't be able to copy them over The Internet, will they? It's no different to doctors blacklisting drug dealers from buying prescription medicine.
I have just written a letter to the RIAA outlining my proposal. Suing pirates one by one isn't going far enough. Not to mention pirates use the fact that they're being sued to unfairly portray themselves as victims. A national register of pirates would make the problem far easier to deal with. People would be encouraged to give the names of suspected pirates to a hotline, similar to TIPS. Once we know the size of the problem, the police and other law enforcement agencies will be forced to take piracy seriously. They have fought the War on Drugs with skill, so why not the War on Piracy?
This evening, m
So from this we learn that the random play on iTunes really is random, and that rating a song really does have an effect. Who'd a thunk?
Next, "iTunes really does play tunes!"
Don't take life so seriously. No one makes it out alive.
I'm looking at this data and it seems that iTunes does seem to pick out favorite songs more often than not-so-favorite songs. Which, I suppose, is the whole idea behind the Party Shuffle concept.
So after analyzing all that data, how does Brian Hansen come to the conclusion that "it's simply the mind's tendency to find a pattern that makes you think iTunes has a preference". Uh, no. It's the software learning that you have a certain type of genre or style that you strongly favor and will selectively pick songs that are related, thus giving you a better-selected playlist.
And it seems that the program has a bug in that it will play a song twice in a row. That's a real bug (if you don't like that type of thing).
Jesus saved me from my past. He can save you as well.
the time my 2G iPod seemed to have a liking for the Aphex Twin's Selected Ambient Works Vol. 2. It was playing a track off it pretty much every other song. Those of you who know the album can appreciate that it's not the kind of music that you'd maybe choose as everyday listening material.
It became so annoying that I ended up removing the album from iTunes, at which point my iPod promptly died. The replacement was big on Roxy Music IIRC...
I wish iTunes would get ratings from some online source much like it gets tracknames from Gracenote. Can you imagine a server of user-submitted ratings? You could opt to use an average rating from all users, or a rating from users with particular tasks (i.e., if you are a metaller, then you'll probably not want raver's musical opinions affecting your ratings!).
Why? Because I haven't got the time to go around rating my entire music library. Judging from that article, it is dangerous to only do a few because of the weighting algorithm used - surely it would be more sensible to assume that 'not rated' meant 3 stars rather than 0 stars? That way you could rate down shitty songs, and rate up excellent songs, but ignore rating the vast majority of songs.
I can't tell you how many Christian record stores I'm permanently banned from.
Someone to show how cool mathematics is
That's exactly why I love last.fm (formerly Audioscrobbler & Last.fm). It automatically tracks what you listen to and then allows that information to be used to give you neighbors in the music world based on what interests you have in common. You can add friends, join groups, and even tag your music. All of this is extremely useful in finding new stuff. They've got plugins for all the major media players (and even some minor ones).
;)
Add on top of that the ability to play a custom-built radio station, set it to play only new music or listen only to music from a particular user profile.
Linux and BSD supported! Open source plugins and radio station player! Could it get better?
---
but make sure that the last line
Generated by SlashdotRndSig via GreaseMonkey
From their results, I'd venture a guess as to the underlying algorithm:
Each song is given a number of points equal to (rating + 1). Then the probability of the song being played is (song rating)/(total points).
Or, to put more succinctly:
prob(song) = (rating)/(n + sum(i=1..n)(rating(i)))That yields probabilities in the given test case of:
5 star - .285 .238 .190 .143 .095 .048
4 star -
3 star -
2 star -
1 star -
0 star -
Which is reasonably close to what the author found. Heck, if I were implementing that feature, it's what I'd try first...
You'd think, with iTunes, that people would be buying music they like (a four or five rating) in a much higher proportion than music they'd rate as a three.
Then there's music added from your own collection. Maybe its just me, but my preferences tend to be stronger than -, 1, 2, 3, 4, 5.
I usually go through my music collection on a regular basis and delete crap that I don't listen to, which is usually anything less than a three, and definitely a - or a one.
And is 4334 just a random arbitrary # of songs to use?
(when you add up X0 through X5)
[Fuck Beta]
o0t!
A way to calculate the odds that 2% will be played in the next 50 songs doesn't work 50* (2/100) = 100% as the author does, and neither 25*(2*100) = 50% is correct.
The correct calculations are: 1-(98/100)^50 = 63% and 1-(98/100)^25 = 39%.
This way you calculate the odds a song will be played at least once in the next 50 or 25 songs.
If you want to calculate the odds the song will be played exactly once in the next 50 or 25 songs:
50 * (2/100) * ((98/100)^49) = 37% or 25 * (2/100) * ((98/100)^24) = 31%.
I guess that's all..
For those too lazy to go read for themselves...
"Many claim to still see patterns as iTunes rambles through their music collection, but the majority of these patterns are simply multiple songs from the same artist. Think of it this way: If you have 2000 songs and 40 of them are from the same artist, there is always a 2% chance of hearing them next with random play. So right after one of their songs finishes, odds almost guarantee they will be played again within the next 50 songs and show a 50% chance they will play again within the next 25 songs. It's simply the mind's tendency to find a pattern that makes you think iTunes has a preference."
In fact, I find that I tend to rate only the songs I *really* like and *really* dislike, and leave the average songs alone. I suspect that I am not alone here. It's akin to the trend of many online forums to attract polarized opinions; i.e., few people take the time to log into forums and post comments that are middle-of-the-road -- typically they're full of "THIS SUCKS" or "HELL YEAH" posts.
"I haven't got the time to go around rating my entire music library"
Much less pay for it, I assume. I'm a certifiable geezer by slashdot standards (>40), but I do know a thing or two about music. I was a really hardcore music collector in college, and one core credo was to know everything in your collection inside-out. Practically speaking, it meant that any new addition to the library (vinyl or cassette, if you've heard of either) stayed in a "just-in" quarantine section until I had listened to it enough times to consider it "known".
It is really sad that people amass immense music collections and really don't have any familiarity with the music they have. Well, maybe it isn't actually sad, but I have to wonder what the point is.
Most people follow a bell shaped curve for their ratings, with the 3-star rating being the most common.
I mean, where is this statistic coming from?
In my case the majority of rated songs are 5's, almost the same number of 4's, then some 3's, and hardly any 2's or 1's.. with perhaps 50% left unrated. I use iTunes at least several hours a day. Those of my friends who use iTunes seem to have a similar distribution.
mogorific carpentry experiments
A friend of mine who worked at a radio station that played a very diverse range of music told me how they select music.
She said that research had shown that listeners would rate the same song higher if it followed other song of a similar genre. If they play songs of different genres randomly the listener does not enjoy the music as much.
So their tendency is to play "blocks" of music.
For example....
4 Classic Rock songs
3 Blues Songs
3 Folk songs
4 Female Rockers
3 Grunge
etc.
This is common knowledge in the radio world. I wonder if Apple has incorporated this type of logic into it's iTunes algorithms?
The radio station in question is WXPN and can be found under iTunes > Radio > Public > WXPN
Everything changes, even how we make a living. I myself paint cars. If someone tomorrow came up with a cheap method for producing car parts that never need to be painted, I would be out of a job while the entire world heralded the new technology as a breakthrough.
We all want to think that once we have our lives in order, they're going to stay that way. Nothing is guaranteed, not even whether yesterdays market will be here tomorrow.
It's no one's fault but your own if you're selling something no one wants to buy.
- When you do things right, no one will be sure you've done anything at all.
After reading the article, I still do not understand the iPod's shuffling algorithm.
The first half of the article is devoted to describing how the writer got the probabilities of rated songs and properties of these probabilities. Although these probabilities give some insight to the shuffling algorithm, they are pretty useless, since they are observed from unrealistic list of songs, i.e. 6 songs with different ratings.
Then cames the formula in Figure 2. How it is calculated and where from the author takes it, is not explained in the article. Also this formula is not backed up by empirical observation. The rest of the article is devoted to analyzing the effects of this formula, which are interesting, yet could have no importance if the actual formula is different. So this article does not really explore the iPod shuffling algorithm, but explores how would iPod shuffling algorithm work if the probability of the next song is calculated according to the formula provided by author. That is pretty useless, since we all can provide our own formulas and write the articles.
Now concerning this formula. To me it seems a litlle strange. Consider hypothetical situation of song list with 1000 unrated songs, and one with 5 star rating. The the probability (according to the formula provided by author) that the song with 5 star rating would come up is
0.27/(1000*0.039+0.27) = 0.006875477
which is pretty miserable odds. If I rated it so highly, that means I want to hear it a lot, now with such shuffling algorithm, I would hear it slightly more, yet not a lot. Of course, then I could create a playlist, with this song only, but then why one needs rating system, if it does not perform.
So it would be really interesting to know iPod's shuffling algorithm, to see if it saves the hassle of creating your own playlists. (Or even the possibility to provide your own algorithm), yet this article does not provide any insights.
there definitely seems to be some time-based randomness in the selection of tunes. often, i'll hear a song pop up randomly on my ipod in the car on the way into work, and then the song come up again, randomly, while being played on itunes at my desk.
go get it
I mostly use the stars to allow smart playlist generation.
1 star - bad
2 stars - background music
3 stars - good
4 and 5 stars mean good and very good but also that they'll be included in several smart playlists. so a 4 star isn't necessarily better than a 3 star but I want it on my ipod etc.
The DB server can keep up now, and the protocol is stable. The radio even works fairly well, but during peak hours it sometimes has trouble connecting (I've only ever used it at my Grandmother's house, and her cable net connection is kind of shitty so it may have been that).
A year ago last.fm/as weren't really usable. Now they are fairly solid. It's worth another shot.
HAL 7000, fewer features than the HAL 9000, but just as homicidal!
(from bugzilla.audi.com)
Product: Audi S4
Component: CD Player
Status: ASSIGNED
Severity: Normal
Hardware: All
OS: All
Resolution: Not a bug
Summary: Car has a "random" bug
Description:
I have a certain CD that causes my Audi S4 (when set to random mode) to play the same track over and over and over. Guess somebody didn't prove their recurrence actually worked.
Solution:
CD contains only one track. Random mode functioning properly.
I read the headline and imagine a story about the costs and revenues from Apple iTMS. Analysis of running the datacenters: costs of electricity, bandwidth, storage, etc.
Instead I read about some geek with way too much time on his hands. Yawn.
points(0 stars)=1
points(1 stars)=3
points(2 stars)=4
points(3 stars)=5
points(4 stars)=6
points(5 stars)=7
probability(X stars) = points(X stars) / 26
This yields the following probabilities, listed along side the observed values from the article along with 95% condience intervals.
p(5 star)=.2692 [.270 +- .0038] .0036] .0033] .0031] .0027] .0016]
p(4 star)=.2308 [.230 +-
p(3 star)=.1923 [.189 +-
p(2 star)=.1538 [.154 +-
p(1 star)=.1154 [.118 +-
p(0 star)=.0385 [.039 +-
As you can see each computed probability falls within the 95% confidence interval, so there's a good chance this is the correct forumla.
Boy do I have too much time on my hands today.
Let me, an advanced user who knows a damn thing about computers and interfaces, change the weighting of the stars. I don't want my 5-star songs to play just twice as often as 2-star songs. I want them to 6 times as often. I want 4-stars to play 4 times, 3-stars to play 3 times, and no-stars to play 2 times.
Why no-stars? Because that way the majority of the collection is unrated. Stared songs really stand out in a playlist. 1 and 2 star songs play less often than no-stars, while 3, 4, and 5 play more often. But I want my favorites to play much more often than your arbitrary algorithm.
I dislike hearing a song too often and I also like to hear my favorite songs more often, but also not repetitevly. So, I have set up 6 playlists that gives me what I think is a good mix of my songs. They are as follows:
1: rated 2 and 25 rated by least recently
2: rated 3 and 73 rated by least recently
3: rated 4 and 70 rated by least recently
4: rated 5 and 32 rated by least recently
playlist is any of playlists 1, 2, 3, or 4 with live updating
The numbers (25, 73, 70, and 32) come from multiplying the number of songs in each category by the rating-1, so it is essentially the same as the "play higher rated songs" in PartyShuffle. I leave 1 rated songs for ones that I don't listen to very often. This way, I get a random selection of my music that does not repeat a song until I have more-or-less gone through the rest of them in that rating. And, it generally plays the 5 rated songs about 4 times more than the 1 rated songs.
I found that I do not like the random feature since it often will play one song significantly more than another song. Eventually, it would even out, but in the range of 20 times playing a song, there can be a large discrepancy and I haven't heard some songs in longer than I'd like.
But all this talk of 0, 1, 2, 3, 4, 5 has me thinking of another rating system. Would anybody care to do an analysis of the ratings in Slashdot comments? What are the relative populations (I expect a ton of 2's but how about the rest)? Do comments made in the first hour after a story is posted stand a better chance of reaching +5 than comments made later in the day?
One of my gripes about the Slashdot comment system is that it discourages contemplation and discussion. Comments made more than 24 hours after a story is posted are rarely read and almost never moderated. This is in contrast with comments system like Usenet or other bulletin boards, where threads can remain lively for weeks.
AlpineR
that this entire project seems to be done while at work. Kudos, you are an inspiration to slackers everywhere.
Actually, with my TT, I've noticed a similar situation.
First, certain burned CDs (I have yet to see this on a commercial CD) when played on random will only play the first track. However, if it is not played on random, it will play all the tracks. Interestingly enough, though, if I spin the CD in the holder, that will sometimes allow it work correctly.
The other interesting thing is that the CD player will not repeat tracks until all tracks of the CD have been played (Duh), at which point all bets are off. While I have never seen it play the same track back-to-back, I have seen it play a track, another track, and then the first track again. Note that this only happens once the CD has randomly played all tracks.
I told the Audi dealer about this. They pretty much said, "Yeah, so?" I sort of agree with them. Of course, as soon as I have the cash, I'm getting an ice>Link and an iPod and I'll toss the CD player.
Two years ago, i replaced my car's tape player, which died after only 15 years of service, with an MP3 CD player. I cut a CD with 14 hours of my favorite stuff. I put the CD in the car, set it up to play in shuffle mode, and set out on a cross country trip. It was great. Just before i arrived, i heard a repeat. I was so disgusted i hit the eject button. Fortunately, i had another disc with me. Feh, i said. Can't even go 750 miles without having to change the CD.
-- Stephen.