mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 14:03:55 -05:00
Added: Loss aversion
This commit is contained in:
parent
4e31a33cce
commit
0e0e3b9238
3 changed files with 17 additions and 4 deletions
|
|
@ -391,7 +391,8 @@ message FsrsReview {
|
|||
|
||||
enum CMRRTarget {
|
||||
memorized = 0;
|
||||
stability = 1;
|
||||
loss_aversion = 1;
|
||||
stability = 2;
|
||||
};
|
||||
|
||||
message SimulateFsrsReviewRequest {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ impl Collection {
|
|||
};
|
||||
}
|
||||
|
||||
let target = req
|
||||
let target_type = req
|
||||
.target
|
||||
.map(TryInto::try_into)
|
||||
.transpose()
|
||||
|
|
@ -33,8 +33,9 @@ impl Collection {
|
|||
|
||||
let days_to_simulate = req.days_to_simulate as f32;
|
||||
|
||||
let target = match target {
|
||||
let target = match target_type {
|
||||
Some(CmrrTarget::Memorized) => None,
|
||||
Some(CmrrTarget::LossAversion) => None,
|
||||
Some(CmrrTarget::Stability) => {
|
||||
wrap!(move |SimulationResult {
|
||||
cards,
|
||||
|
|
@ -57,7 +58,14 @@ impl Collection {
|
|||
if req.days_to_simulate == 0 {
|
||||
invalid_input!("no days to simulate")
|
||||
}
|
||||
let (config, cards) = self.simulate_request_to_config(&req)?;
|
||||
let (mut config, cards) = self.simulate_request_to_config(&req)?;
|
||||
|
||||
if target_type == Some(CmrrTarget::LossAversion) {
|
||||
config.relearning_step_transitions[0][0] *= 2.;
|
||||
config.relearning_step_transitions[1][0] *= 2.;
|
||||
config.relearning_step_transitions[2][0] *= 2.;
|
||||
}
|
||||
|
||||
Ok(fsrs
|
||||
.optimal_retention(
|
||||
&config,
|
||||
|
|
|
|||
|
|
@ -206,6 +206,10 @@ export function CMRRTargetChoices(): Choice<CMRRTarget>[] {
|
|||
label: "Memorized (Default)",
|
||||
value: CMRRTarget.memorized,
|
||||
},
|
||||
{
|
||||
label: "Memorized (Double cost)",
|
||||
values: CMRRTarget.loss_aversion,
|
||||
},
|
||||
{
|
||||
label: "Stability (Experimental)",
|
||||
value: CMRRTarget.stability,
|
||||
|
|
|
|||
Loading…
Reference in a new issue