I am wondering how to modify and generalize spaced repetition software. Specifically, I am wondering how to change the number of cards to be shown, the range of cards, and ability to specify a particular card deck.
I have been dabbling with spaced repetition software for a while and found the following problems:
It is difficult to ensure that the number of cards that will be shown on a particular date remains within a certain range
Rather than be told which cards to learn today, I would like to pick up the deck whenever I like and go through a couple of cards, depending on how much time I have
I understand that the latter point is somewhat in conflict with the logic of spaced repetition, but maybe it would be possible to find a compromise.
The problem the program has to solve would be "Given I'm asked to show a card right now, what card should I choose, based on each cards learning history, importance, etc."
This approach could easily generalize to incremental reading and todo-list management, I think.
As I'm a programming novice, any help on how to implement such an algorithm would be greatly appreciated.
Please find below a very basic attempt of mine to adress the problem; the most obvious issue here is that the code does not take into account the growth of the cardfile over time.
#! /usr/bin/env python
import random
box = []
class flashcard(object):
def __init__(self, quest, answ, score):
self.question = quest
self.answer = answ
self.score = score
# ------------------------------------------------------------------------------
f = open('list.txt','r')
for line in f:
parts = line.split('\t')
box.append(flashcard(parts[0],parts[1],int(parts[2])))
f.close()
# ------------------------------------------------------------------------------
keepgoing=True
while keepgoing:
card = random.choice(box)
if random.uniform(0,1) * card.score < 1:
a = raw_input(str(card.score) + ' ' + card.question + ' ')
if a == card.answer:
card.score *= 3
elif a == 'q':
keepgoing = False
else:
card.score = 1
print 'WRONG -->' + card.answer
else:
pass
# ------------------------------------------------------------------------------
f = open('list.txt','w')
for card in box:
f.write("%s\t%s\t%s\n" % (card.question, card.answer, card.score))
f.close()
Best, J
Okay, thank you! While your points are perfectly valid, it is only now that I realize, that the motivation for my question was actually broader and thus some points remain open for me.
1st I would be interested in having sthg. for the command line which is a simple as possible 2nd I would like to avoid a logic based on dates, even if this in slight contrast to SRS 3nd I would like to have a simple script that I can hack into many different applications such as todo-list management, reading-list management, playlist-management (as in http://imms.luminal.org/), etc
So, I would like to have a generic script that can present items at random but weighted by importance, easiness, urgency, interestingness, etc
There's a rich literature on this topic. A paper that I recommend is "Improving students' long-term knowledge retention through personalized review" by Lindsey, Shroyer, Pashler, and Mozer: https://web.archive.org/web/20140331061418/http://laplab.ucsd.edu/articles/LindseyShroyerPashlerMozer2013.pdf (if link is dead, be sure to get a version with appendixes and supplementary online materials which give details on the machine learning algorithm they describe).
In this particular paper, a machine learning algorithm is described that, given a set of students' timestamped correct and incorrect responses to a list of questions, estimates the probability of correct response for each (student, question)-pair. So this exactly answers one of your subquestions. At any given time, such an algorithm could tell you the question most at risk of being forgotten (lowest probability of correct response). Even more than that, it gives you a sorted list of questions in decreasing risk of forgetting. And yet even more than this, it'll give you a number between 0 and 1 indicating the risk of forgetting, so that you can set a threshold like "Don't ask me questions for which the probability of forgetting is less than 5%".
Not a project for absolute beginners, but please try it!
Another minor point: please feel free to experiment with non-Anki learning strategies. There's no evidence other than popularity that Anki's workflows are the best way to do anything, in fact I highly doubt that it works for all learners.
Edit I designed an algorithm for Bayesian spaced repetition and implemented it in Python, JavaScript, etc., which I called Ebisu: https://fasiha.github.io/ebisu/
You can use Anki the way you want. You don't have to do all cards that are due every day and at the same time you have an option to review cards earlier than they are due. It should even be possible to write an Anki plugin tht hides the amount of due cards and that automatically reviews cards before they are due if there are no due cards.
As a practical matter I would however recommend against changing the process. Having a certain number of due cards means that you feel a success when you finished your daily pile of cards. That feeling of success helps you to establish a habit of doing your flashcards regularly.
Not doing your cards exactly at the time they are due also increases your total learning time. If you review cards later you increase the amount of cards you will forget. If you review them earlier you waste time.
If you still want to reinvent the wheel you should start by reading how the SM2 algorithm works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With