Added: Loss aversion

This commit is contained in:
Luc Mcgrady 2025-06-21 23:43:21 +01:00
parent 21ea2da76f
commit d5e5177166
No known key found for this signature in database
GPG key ID: 4F3D7A0B17CC3D9C
2 changed files with 23 additions and 1 deletions

View file

@ -55,12 +55,23 @@ impl Collection {
}
let (mut config, cards) = self.simulate_request_to_config(&req)?;
dbg!(&target_type);
if let Some(Kind::Memorized(settings)) = target_type {
let loss_aversion = settings.loss_aversion;
dbg!(&loss_aversion);
config.relearning_step_transitions[0][0] *= loss_aversion;
config.relearning_step_transitions[1][0] *= loss_aversion;
config.relearning_step_transitions[2][0] *= loss_aversion;
config.learning_step_transitions[0][0] *= loss_aversion;
config.learning_step_transitions[1][0] *= loss_aversion;
config.learning_step_transitions[2][0] *= loss_aversion;
config.state_rating_costs[0][0] *= loss_aversion;
config.state_rating_costs[1][0] *= loss_aversion;
config.state_rating_costs[2][0] *= loss_aversion;
}
Ok(fsrs

View file

@ -49,7 +49,8 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
export let onPresetChange: () => void;
let cmrrTargetType = DEFAULT_CMRR_TARGET;
$: if (simulateFsrsRequest?.target) {
let lastCmrrTargetType = cmrrTargetType;
$: if (simulateFsrsRequest?.target && cmrrTargetType !== lastCmrrTargetType) {
switch (cmrrTargetType) {
case "memorized":
simulateFsrsRequest.target.kind = {
@ -66,6 +67,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
};
break;
}
lastCmrrTargetType = cmrrTargetType;
}
const config = state.currentConfig;
@ -449,6 +451,15 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
</SettingTitle>
</EnumSelectorRow>
</Item>
{#if simulateFsrsRequest.target?.kind.case === "memorized"}
<SpinBoxFloatRow
bind:value={simulateFsrsRequest.target.kind.value.lossAversion} defaultValue={1}>
<SettingTitle>
{"Fail Cost Multiplier: "}
</SettingTitle>
</SpinBoxFloatRow>
{/if}
</details>
<button