mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 14:32:22 -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 {
|
message EvaluateWeightsResponse {
|
||||||
float log_loss = 1;
|
float log_loss = 1;
|
||||||
float rmse_bins = 2;
|
float rmse_bins = 2;
|
||||||
uint32 review_count = 3;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
message ComputeMemoryStateResponse {
|
message ComputeMemoryStateResponse {
|
||||||
|
|
|
@ -152,7 +152,7 @@ impl Collection {
|
||||||
weights: &Weights,
|
weights: &Weights,
|
||||||
search: &str,
|
search: &str,
|
||||||
ignore_revlogs_before: TimestampMillis,
|
ignore_revlogs_before: TimestampMillis,
|
||||||
) -> Result<(u32, ModelEvaluation)> {
|
) -> Result<ModelEvaluation> {
|
||||||
let timing = self.timing_today()?;
|
let timing = self.timing_today()?;
|
||||||
let mut anki_progress = self.new_progress_handler::<ComputeWeightsProgress>();
|
let mut anki_progress = self.new_progress_handler::<ComputeWeightsProgress>();
|
||||||
let guard = self.search_cards_into_table(search, SortMode::NoOrder)?;
|
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);
|
fsrs_items_for_training(revlogs, timing.next_day_at, ignore_revlogs_before);
|
||||||
anki_progress.state.reviews = review_count as u32;
|
anki_progress.state.reviews = review_count as u32;
|
||||||
let fsrs = FSRS::new(Some(weights))?;
|
let fsrs = FSRS::new(Some(weights))?;
|
||||||
Ok((
|
Ok(fsrs.evaluate(items, |ip| {
|
||||||
review_count as u32,
|
|
||||||
fsrs.evaluate(items, |ip| {
|
|
||||||
anki_progress
|
anki_progress
|
||||||
.update(false, |p| {
|
.update(false, |p| {
|
||||||
p.total_iterations = ip.total as u32;
|
p.total_iterations = ip.total as u32;
|
||||||
p.current_iteration = ip.current as u32;
|
p.current_iteration = ip.current as u32;
|
||||||
})
|
})
|
||||||
.is_ok()
|
.is_ok()
|
||||||
})?,
|
})?)
|
||||||
))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -287,7 +287,7 @@ impl crate::services::SchedulerService for Collection {
|
||||||
&mut self,
|
&mut self,
|
||||||
input: scheduler::EvaluateWeightsRequest,
|
input: scheduler::EvaluateWeightsRequest,
|
||||||
) -> Result<scheduler::EvaluateWeightsResponse> {
|
) -> Result<scheduler::EvaluateWeightsResponse> {
|
||||||
let (review_count, ret) = self.evaluate_weights(
|
let ret = self.evaluate_weights(
|
||||||
&input.weights,
|
&input.weights,
|
||||||
&input.search,
|
&input.search,
|
||||||
input.ignore_revlogs_before_ms.into(),
|
input.ignore_revlogs_before_ms.into(),
|
||||||
|
@ -295,7 +295,6 @@ impl crate::services::SchedulerService for Collection {
|
||||||
Ok(scheduler::EvaluateWeightsResponse {
|
Ok(scheduler::EvaluateWeightsResponse {
|
||||||
log_loss: ret.log_loss,
|
log_loss: ret.log_loss,
|
||||||
rmse_bins: ret.rmse_bins,
|
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(
|
setTimeout(
|
||||||
() =>
|
() =>
|
||||||
alert(
|
alert(
|
||||||
`Reviews: ${
|
`Log loss: ${resp.logLoss.toFixed(4)}, RMSE(bins): ${(
|
||||||
resp.reviewCount
|
|
||||||
}, Log loss: ${resp.logLoss.toFixed(4)}, RMSE(bins): ${(
|
|
||||||
resp.rmseBins * 100
|
resp.rmseBins * 100
|
||||||
).toFixed(2)}%. ${tr.deckConfigSmallerIsBetter()}`,
|
).toFixed(2)}%. ${tr.deckConfigSmallerIsBetter()}`,
|
||||||
),
|
),
|
||||||
|
@ -228,6 +226,7 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
$: computeRetentionProgressString = renderRetentionProgress(
|
$: computeRetentionProgressString = renderRetentionProgress(
|
||||||
computeRetentionProgress,
|
computeRetentionProgress,
|
||||||
);
|
);
|
||||||
|
$: totalReviews = computeWeightsProgress?.reviews ?? undefined;
|
||||||
|
|
||||||
function renderWeightProgress(val: ComputeWeightsProgress | undefined): String {
|
function renderWeightProgress(val: ComputeWeightsProgress | undefined): String {
|
||||||
if (!val || !val.total) {
|
if (!val || !val.total) {
|
||||||
|
@ -314,9 +313,13 @@ License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
{tr.deckConfigEvaluateButton()}
|
{tr.deckConfigEvaluateButton()}
|
||||||
{/if}
|
{/if}
|
||||||
</button>
|
</button>
|
||||||
{#if computingWeights || checkingWeights}<div>
|
<div>
|
||||||
|
{#if computingWeights || checkingWeights}
|
||||||
{computeWeightsProgressString}
|
{computeWeightsProgressString}
|
||||||
</div>{/if}
|
{:else if totalReviews !== undefined}
|
||||||
|
{tr.statisticsReviews({ reviews: totalReviews })}
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
|
|
||||||
<Warning warning={lastOptimizationWarning} className="alert-warning" />
|
<Warning warning={lastOptimizationWarning} className="alert-warning" />
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue