mirror of
https://github.com/ankitects/anki.git
synced 2025-09-23 16:26:40 -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)
|
||||
}
|
||||
|
||||
/// Check if the note's first field is empty or a duplicate. Then for cloze
|
||||
/// notetypes, check if there is a cloze in a non-cloze field or if there's
|
||||
/// no cloze at all. For other notetypes, just check if there's a cloze.
|
||||
/// Check if there is a cloze in a non-cloze field. Then check if the
|
||||
/// note's first field is empty. For cloze notetypes, check whether there
|
||||
/// 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> {
|
||||
Ok({
|
||||
let cloze_state = self.field_cloze_check(note)?;
|
||||
|
|
|
@ -468,7 +468,7 @@ impl Collection {
|
|||
self.get_config_bool(BoolKey::FsrsShortTermWithStepsEnabled);
|
||||
let fsrs_allow_short_term = if fsrs_enabled {
|
||||
let params = config.fsrs_params();
|
||||
if params.len() == 19 {
|
||||
if params.len() >= 19 {
|
||||
params[17] > 0.0 && params[18] > 0.0
|
||||
} else {
|
||||
false
|
||||
|
|
|
@ -116,10 +116,10 @@ impl Collection {
|
|||
})?;
|
||||
progress_thread.join().ok();
|
||||
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_rmse = optimized_fsrs.evaluate(items.clone(), |_| true)?.rmse_bins;
|
||||
if current_rmse <= optimized_rmse {
|
||||
let optimized_log_loss = optimized_fsrs.evaluate(items.clone(), |_| true)?.log_loss;
|
||||
if current_log_loss <= optimized_log_loss {
|
||||
if num_of_relearning_steps <= 1 {
|
||||
params = current_params.to_vec();
|
||||
} else {
|
||||
|
|
|
@ -176,7 +176,7 @@ impl Collection {
|
|||
}
|
||||
Ok(result.into_iter().rev().collect())
|
||||
} 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);
|
||||
|
||||
return Ok(Some(
|
||||
// power should be the reciprocal of the value of DECAY in FSRS-rs,
|
||||
// which is currently -0.5
|
||||
-(current_retrievability.powi(-2) - 1.)
|
||||
/ (desired_retrievability.powi(-2) - 1.),
|
||||
-(current_retrievability.powf(-1.0 / decay) - 1.)
|
||||
/ (desired_retrievability.powf(-1.0 / decay) - 1.),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue