-
Notifications
You must be signed in to change notification settings - Fork 3
Learning Algorithm
- Finishing the reviews two times in a row masters a character, if there is an incorrect answer, the bar should be lifted one by one up to a certain limit (
MAX_IN_A_ROW_REQUIRED
) - The two fields of a single character are separated
- There need to be some kinds of spaced-repetition, which means:
i. one character shouldn't be reviewed too soon after it is learned
ii. the more times one character is learned, the longer should be its interval of learning
this is done through the
weighted_duration
and reviewing the field of the character with the longestweighted_duration
- There shouldn't be too many or too few characters that are learned at the same time. This is done through keeping the number of in progress (reviewable) characters in the range [
MIN_UC_IN_PROGRESS_CNT
,MAX_UC_IN_PROGRESS_CNT
], and tuningLEARN_PROB
below will introduce the details
DEFAULT_IN_A_ROW_REQUIRED = 2
MAX_IN_A_ROW_REQUIRED = 2
ADDED_DURATION = 30 # seconds
MIN_UC_IN_PROGRESS_CNT = 3
MAX_UC_IN_PROGRESS_CNT = 8
LEARN_PROB = 1 / 3
Each character has two test fields (pinyin
and definition_1
), for each field, there are a number of variables that we store:
-
in_a_row
(default: 0): the number of correct answers in a row for this field -
in_a_row_required
(default:DEFAULT_IN_A_ROW_REQUIRED
): the user needs this many corrects in a row to be considered mastering this field -
last_study_duration
: the time between last study and now -
mastered
: whetherin_a_row == in_a_row_required
Each character has two variables to itself:
-
learned
: whether the user has started learning this character -
mastered
: wheter both test fields are mastered
learnable: not learned
reviewable: learned
but not mastered
Please think of the learning process as a state machine, starting from Transition
if all characters are mastered, goto Finish
if (no learnable character) or (there are >= MAX_UC_IN_PROGRESS_CNT
reviewable character): goto Test_review
if (there are <= MIN_UC_IN_PROGRESS_CNT
): goto Learn
otherwise, goto Learn with probability LEARN_PROB
, goto Test_review with probability 1 - LEARN_PROB
Randomly select a learnable character
goto Tolerant_review(character)
Display character
goto Transition
Test both test fields of character
, even if user answers anything wrong, do nothing
goto Transition
- assume all time units are in seconds
Select the reviewable field
of a character
that maximizes its
weighted_duration = last_study_duration / (in_a_row + 1) + ADDED_DURATION
test the field
of the character
if the user answers correctly:
- steps up
in_a_row
, masters the field and the character if applicable - goto Transition
else if the user answers incorrectly: in_a_row = 0
- steps up
in_a_row_required
, up toMAX_IN_A_ROW_REQUIRED
- goto Relearn(character)