mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Show review count with FSRS evaluation results (#3165)
This commit is contained in:
parent
ee8683587a
commit
b7e782c7e1
4 changed files with 18 additions and 11 deletions
|
@ -434,6 +434,7 @@ message EvaluateWeightsRequest {
|
|||
message EvaluateWeightsResponse {
|
||||
float log_loss = 1;
|
||||
float rmse_bins = 2;
|
||||
uint32 review_count = 3;
|
||||
}
|
||||
|
||||
message ComputeMemoryStateResponse {
|
||||
|
|
|
@ -152,7 +152,7 @@ impl Collection {
|
|||
weights: &Weights,
|
||||
search: &str,
|
||||
ignore_revlogs_before: TimestampMillis,
|
||||
) -> Result<ModelEvaluation> {
|
||||
) -> Result<(u32, ModelEvaluation)> {
|
||||
let timing = self.timing_today()?;
|
||||
let mut anki_progress = self.new_progress_handler::<ComputeWeightsProgress>();
|
||||
let guard = self.search_cards_into_table(search, SortMode::NoOrder)?;
|
||||
|
@ -164,14 +164,17 @@ impl Collection {
|
|||
fsrs_items_for_training(revlogs, timing.next_day_at, ignore_revlogs_before);
|
||||
anki_progress.state.reviews = review_count as u32;
|
||||
let fsrs = FSRS::new(Some(weights))?;
|
||||
Ok(fsrs.evaluate(items, |ip| {
|
||||
anki_progress
|
||||
.update(false, |p| {
|
||||
p.total_iterations = ip.total as u32;
|
||||
p.current_iteration = ip.current as u32;
|
||||
})
|
||||
.is_ok()
|
||||
})?)
|
||||
Ok((
|
||||
review_count as u32,
|
||||
fsrs.evaluate(items, |ip| {
|
||||
anki_progress
|
||||
.update(false, |p| {
|
||||
p.total_iterations = ip.total as u32;
|
||||
p.current_iteration = ip.current as u32;
|
||||
})
|
||||
.is_ok()
|
||||
})?,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ impl crate::services::SchedulerService for Collection {
|
|||
&mut self,
|
||||
input: scheduler::EvaluateWeightsRequest,
|
||||
) -> Result<scheduler::EvaluateWeightsResponse> {
|
||||
let ret = self.evaluate_weights(
|
||||
let (review_count, ret) = self.evaluate_weights(
|
||||
&input.weights,
|
||||
&input.search,
|
||||
input.ignore_revlogs_before_ms.into(),
|
||||
|
@ -295,6 +295,7 @@ impl crate::services::SchedulerService for Collection {
|
|||
Ok(scheduler::EvaluateWeightsResponse {
|
||||
log_loss: ret.log_loss,
|
||||
rmse_bins: ret.rmse_bins,
|
||||
review_count,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -172,7 +172,9 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
setTimeout(
|
||||
() =>
|
||||
alert(
|
||||
`Log loss: ${resp.logLoss.toFixed(4)}, RMSE(bins): ${(
|
||||
`Reviews: ${
|
||||
resp.reviewCount
|
||||
}, Log loss: ${resp.logLoss.toFixed(4)}, RMSE(bins): ${(
|
||||
resp.rmseBins * 100
|
||||
).toFixed(2)}%. ${tr.deckConfigSmallerIsBetter()}`,
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue