mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Show review count for Evaluate/Optimize button (#3170)
* Revert "Show review count with FSRS evaluation results (#3165)"
This reverts commit b7e782c7e1
.
* Show review count for Evaluate/Optimize button
This commit is contained in:
parent
573af9cd4c
commit
22ac77896f
4 changed files with 18 additions and 20 deletions
|
@ -434,7 +434,6 @@ 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<(u32, ModelEvaluation)> {
|
||||
) -> Result<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,17 +164,14 @@ 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((
|
||||
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()
|
||||
})?,
|
||||
))
|
||||
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()
|
||||
})?)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -287,7 +287,7 @@ impl crate::services::SchedulerService for Collection {
|
|||
&mut self,
|
||||
input: scheduler::EvaluateWeightsRequest,
|
||||
) -> Result<scheduler::EvaluateWeightsResponse> {
|
||||
let (review_count, ret) = self.evaluate_weights(
|
||||
let ret = self.evaluate_weights(
|
||||
&input.weights,
|
||||
&input.search,
|
||||
input.ignore_revlogs_before_ms.into(),
|
||||
|
@ -295,7 +295,6 @@ impl crate::services::SchedulerService for Collection {
|
|||
Ok(scheduler::EvaluateWeightsResponse {
|
||||
log_loss: ret.log_loss,
|
||||
rmse_bins: ret.rmse_bins,
|
||||
review_count,
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -172,9 +172,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
setTimeout(
|
||||
() =>
|
||||
alert(
|
||||
`Reviews: ${
|
||||
resp.reviewCount
|
||||
}, Log loss: ${resp.logLoss.toFixed(4)}, RMSE(bins): ${(
|
||||
`Log loss: ${resp.logLoss.toFixed(4)}, RMSE(bins): ${(
|
||||
resp.rmseBins * 100
|
||||
).toFixed(2)}%. ${tr.deckConfigSmallerIsBetter()}`,
|
||||
),
|
||||
|
@ -228,6 +226,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
$: computeRetentionProgressString = renderRetentionProgress(
|
||||
computeRetentionProgress,
|
||||
);
|
||||
$: totalReviews = computeWeightsProgress?.reviews ?? undefined;
|
||||
|
||||
function renderWeightProgress(val: ComputeWeightsProgress | undefined): String {
|
||||
if (!val || !val.total) {
|
||||
|
@ -314,9 +313,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|||
{tr.deckConfigEvaluateButton()}
|
||||
{/if}
|
||||
</button>
|
||||
{#if computingWeights || checkingWeights}<div>
|
||||
<div>
|
||||
{#if computingWeights || checkingWeights}
|
||||
{computeWeightsProgressString}
|
||||
</div>{/if}
|
||||
{:else if totalReviews !== undefined}
|
||||
{tr.statisticsReviews({ reviews: totalReviews })}
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<Warning warning={lastOptimizationWarning} className="alert-warning" />
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue