mirror of
https://github.com/ankitects/anki.git
synced 2025-09-24 16:56:36 -04:00
Merge branch 'main' into break_answer_buttons_table_x_axis_in_two_rows
This commit is contained in:
commit
472fd75092
5 changed files with 10 additions and 12 deletions
|
@ -590,9 +590,9 @@ impl Collection {
|
||||||
Ok(changed_notes)
|
Ok(changed_notes)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Check if the note's first field is empty or a duplicate. Then for cloze
|
/// Check if there is a cloze in a non-cloze field. Then check if the
|
||||||
/// notetypes, check if there is a cloze in a non-cloze field or if there's
|
/// note's first field is empty. For cloze notetypes, check whether there
|
||||||
/// no cloze at all. For other notetypes, just check if there's a cloze.
|
/// is a cloze at all. Finally, check if the first field is a duplicate.
|
||||||
pub fn note_fields_check(&mut self, note: &Note) -> Result<NoteFieldsState> {
|
pub fn note_fields_check(&mut self, note: &Note) -> Result<NoteFieldsState> {
|
||||||
Ok({
|
Ok({
|
||||||
let cloze_state = self.field_cloze_check(note)?;
|
let cloze_state = self.field_cloze_check(note)?;
|
||||||
|
|
|
@ -468,7 +468,7 @@ impl Collection {
|
||||||
self.get_config_bool(BoolKey::FsrsShortTermWithStepsEnabled);
|
self.get_config_bool(BoolKey::FsrsShortTermWithStepsEnabled);
|
||||||
let fsrs_allow_short_term = if fsrs_enabled {
|
let fsrs_allow_short_term = if fsrs_enabled {
|
||||||
let params = config.fsrs_params();
|
let params = config.fsrs_params();
|
||||||
if params.len() == 19 {
|
if params.len() >= 19 {
|
||||||
params[17] > 0.0 && params[18] > 0.0
|
params[17] > 0.0 && params[18] > 0.0
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
|
|
@ -116,10 +116,10 @@ impl Collection {
|
||||||
})?;
|
})?;
|
||||||
progress_thread.join().ok();
|
progress_thread.join().ok();
|
||||||
if let Ok(fsrs) = FSRS::new(Some(current_params)) {
|
if let Ok(fsrs) = FSRS::new(Some(current_params)) {
|
||||||
let current_rmse = fsrs.evaluate(items.clone(), |_| true)?.rmse_bins;
|
let current_log_loss = fsrs.evaluate(items.clone(), |_| true)?.log_loss;
|
||||||
let optimized_fsrs = FSRS::new(Some(¶ms))?;
|
let optimized_fsrs = FSRS::new(Some(¶ms))?;
|
||||||
let optimized_rmse = optimized_fsrs.evaluate(items.clone(), |_| true)?.rmse_bins;
|
let optimized_log_loss = optimized_fsrs.evaluate(items.clone(), |_| true)?.log_loss;
|
||||||
if current_rmse <= optimized_rmse {
|
if current_log_loss <= optimized_log_loss {
|
||||||
if num_of_relearning_steps <= 1 {
|
if num_of_relearning_steps <= 1 {
|
||||||
params = current_params.to_vec();
|
params = current_params.to_vec();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -176,7 +176,7 @@ impl Collection {
|
||||||
}
|
}
|
||||||
Ok(result.into_iter().rev().collect())
|
Ok(result.into_iter().rev().collect())
|
||||||
} else {
|
} else {
|
||||||
Ok(revlog.iter().map(stats_revlog_entry).collect())
|
Ok(revlog.iter().rev().map(stats_revlog_entry).collect())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -384,10 +384,8 @@ fn add_extract_fsrs_relative_retrievability(db: &Connection) -> rusqlite::Result
|
||||||
.max(0.0001);
|
.max(0.0001);
|
||||||
|
|
||||||
return Ok(Some(
|
return Ok(Some(
|
||||||
// power should be the reciprocal of the value of DECAY in FSRS-rs,
|
-(current_retrievability.powf(-1.0 / decay) - 1.)
|
||||||
// which is currently -0.5
|
/ (desired_retrievability.powf(-1.0 / decay) - 1.),
|
||||||
-(current_retrievability.powi(-2) - 1.)
|
|
||||||
/ (desired_retrievability.powi(-2) - 1.),
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue