cheesecake method

This commit is contained in:
Luc Mcgrady 2025-08-02 12:09:26 +01:00
parent 3d0a408a2b
commit c2fdf474dd
No known key found for this signature in database
GPG key ID: 4F3D7A0B17CC3D9C
2 changed files with 6 additions and 3 deletions

View file

@ -292,7 +292,8 @@ impl Collection {
Ok((
dr,
(
*result.memorized_cnt_per_day.last().unwrap_or(&0.),
*result.memorized_cnt_per_day.last().unwrap_or(&0.)
- *result.memorized_cnt_per_day.first().unwrap_or(&0.),
result.cost_per_day.iter().sum::<f32>(),
result.review_cnt_per_day.iter().sum::<usize>() as u32
+ result.learn_cnt_per_day.iter().sum::<usize>() as u32,

View file

@ -8,6 +8,7 @@ import {
bisector,
line,
max,
min,
pointer,
rollup,
scaleLinear,
@ -62,7 +63,7 @@ export function renderWorkloadChart(
.range([bounds.marginLeft, bounds.width - bounds.marginRight]);
const subgraph_data = ({
[SimulateWorkloadSubgraph.ratio]: data.map(d => ({ ...d, y: d.timeCost / d.memorized })),
[SimulateWorkloadSubgraph.ratio]: data.map(d => ({ ...d, y: d.memorized / d.timeCost })),
[SimulateWorkloadSubgraph.time]: data.map(d => ({ ...d, y: d.timeCost / d.learnSpan })),
[SimulateWorkloadSubgraph.count]: data.map(d => ({ ...d, y: d.count / d.learnSpan })),
[SimulateWorkloadSubgraph.memorized]: data.map(d => ({ ...d, y: d.memorized })),
@ -215,9 +216,10 @@ function _renderSimulationChart<T extends { x: any; y: any; label: number }>(
// y scale
const yMax = max(subgraph_data, d => d.y)!;
const yMin = min(subgraph_data, d => d.y)!;
const y = scaleLinear()
.range([bounds.height - bounds.marginBottom, bounds.marginTop])
.domain([0, yMax])
.domain([yMin, yMax])
.nice();
svg.select<SVGGElement>(".y-ticks")
.call((selection) =>