mirror of
https://github.com/ankitects/anki.git
synced 2026-01-13 22:13:58 -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 {
|
enum CMRRTarget {
|
||||||
memorized = 0;
|
memorized = 0;
|
||||||
stability = 1;
|
loss_aversion = 1;
|
||||||
|
stability = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
message SimulateFsrsReviewRequest {
|
message SimulateFsrsReviewRequest {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ impl Collection {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
let target = req
|
let target_type = req
|
||||||
.target
|
.target
|
||||||
.map(TryInto::try_into)
|
.map(TryInto::try_into)
|
||||||
.transpose()
|
.transpose()
|
||||||
|
|
@ -33,8 +33,9 @@ impl Collection {
|
||||||
|
|
||||||
let days_to_simulate = req.days_to_simulate as f32;
|
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::Memorized) => None,
|
||||||
|
Some(CmrrTarget::LossAversion) => None,
|
||||||
Some(CmrrTarget::Stability) => {
|
Some(CmrrTarget::Stability) => {
|
||||||
wrap!(move |SimulationResult {
|
wrap!(move |SimulationResult {
|
||||||
cards,
|
cards,
|
||||||
|
|
@ -57,7 +58,14 @@ impl Collection {
|
||||||
if req.days_to_simulate == 0 {
|
if req.days_to_simulate == 0 {
|
||||||
invalid_input!("no days to simulate")
|
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
|
Ok(fsrs
|
||||||
.optimal_retention(
|
.optimal_retention(
|
||||||
&config,
|
&config,
|
||||||
|
|
|
||||||
|
|
@ -206,6 +206,10 @@ export function CMRRTargetChoices(): Choice<CMRRTarget>[] {
|
||||||
label: "Memorized (Default)",
|
label: "Memorized (Default)",
|
||||||
value: CMRRTarget.memorized,
|
value: CMRRTarget.memorized,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
label: "Memorized (Double cost)",
|
||||||
|
values: CMRRTarget.loss_aversion,
|
||||||
|
},
|
||||||
{
|
{
|
||||||
label: "Stability (Experimental)",
|
label: "Stability (Experimental)",
|
||||||
value: CMRRTarget.stability,
|
value: CMRRTarget.stability,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue