A client has asked me to add a simple spaced repeition algorithm (SRS) for an onlinebased learning site. But before throwing my self into it, I’d like to discuss it with the community.
Basically the site asks the user a bunch of questions (by automatically selecting say 10 out of 100 total questions from a database), and the user gives either a correct or incorrect answer. The users result are then stored in a database, for instance:
userid questionid correctlyanswered dateanswered
1 123 0 (no) 2010-01-01 10:00
1 124 1 (yes) 2010-01-01 11:00
1 125 1 (yes) 2010-01-01 12:00
Now, to maximize a users ability to learn all answers, I should be able to apply an SRS algorithm so that a user, next time he takes the quiz, receives questions incorrectly answered more often; than questions answered correctly. Also, questions that are previously answered incorrectly, but recently often answered correctly should occur less often.
Have anyone implemented something like this before? Any tips or suggestions?
Theese are the best links I’ve found:
What you want to do is to have a number
X_ifor all questionsi. You can normalize these numbers (make their sum 1) and pick one at random with the corresponding probability.If
Nis the number of different questions andMis the number of times each question has been answered in average, then you could findXinM*Ntime like this:X[N]set to 0.ianswered wrong, increaseN[i]byf(t)wheretis the answering time andfis an increasing function.Because
fis increasing, a question answered wrong a long time ago has less impact than one answered wrong yesterday. You can experiment with differentfto get a nice behaviour.The smarter way
A faster way is not to generate
X[]every time you choose questions, but save it in a database table.You won’t be able to apply
fwith this solution. Instead just add 1 every time the question is answered wrongly, and then run through the table regularly – say every midnight – and multiply allX[i]by a constant – say0.9.Update: Actually you should base your data on corrects, not wrongs. Otherwise, questions not answered neither true nor false for a long time, will have a smaller chance of getting chosen. It should be opposite.