brownbat / autoEaseFactor

Adjust ease factors in Anki based off of performance in order to hit a target success rate.
GNU General Public License v3.0
37 stars 8 forks source link

Undo Button Interaction #22

Closed tommy412 closed 3 years ago

tommy412 commented 3 years ago

Hello, just wanted to start out and say I appreciate the time and effort you have put into this add-on so far. I have just started using it today with the Anking deck and I see huge potential for this.

I use the undo button pretty often, and I am unsure if this is meant to be a normal interaction, but if I press good on a card which originally will show the card again in 1.3 months (ease factor 2500, suggested 2855) ; then I undo and go to press good again, it'll change the good interval to 1.5 months (ease factor 2500, suggested 2855). I was wondering if this was an intended interaction or a bug.

Thanks for your time and help!

tommy412 commented 3 years ago

P.S. I am also on Anki Version 2.1.33

brownbat commented 3 years ago

Thanks, I've heard a few other odd interactions with Undo, I'll try to test this more rigorously, it definitely shouldn't really change that much by design.

I use Undo a lot and have tried to keep an eye out, but have been having trouble narrowing it down, but those specific numbers are really helpful for me to simulate some cases, thanks!

Just to confirm, are you using Load Balancer by any change? Any other add-ons that might affect intervals or scheduling?

tommy412 commented 3 years ago

Awesome, thanks so much.

I am just using the v2 scheduler and nothing else currently.

My add ons below, if it helps.

image

brownbat commented 3 years ago

Oh, just to be clear, you're talking about the numbers hovering over the buttons before you answer?

Here's the line in Anki's main code where it sets that "1d" duration information for display: https://github.com/ankitects/anki/blob/669769a5a269f5911736748682b9b64c153fb7c1/qt/aqt/reviewer.py#L674

That's pulling from the calculated interval. The interval is calculated using the ease factor after he card is answered. The algorithm here only affects the ease factor, not the interval directly, so it's a few steps removed.

I think two things are happening: 1) Anki has no real way to know how my algorithm will change the ease factor beforehand, so the first estimate it gives you for "Good" is the estimate for "no ease changes whatsoever." (It will tend to underestimate slightly the actual interval applied after you press good/pass/ok.) 2) Undo is not undoing my ease adjustments. However, it IS undoing the answer history. The next time you answer that card, it only looks at actual answers to calculate ease, so it effectively overwrites the ease adjustment that you reverted by pressing Undo. That's why my stats show the exact same results even if you undo multiple times.

If that's right, that means that the first estimate above the button is an underestimate. The second one you see is what the actual interval will be with the new ease adjustment applied.

It means the algorithms' working correctly both times, but you're getting bad timing estimates above the buttons the first time you answer a card.

If that's the case, this is pretty low risk, it's always working the same in the background, (it's just really confusing).

My next steps: 1) Confirm this is actually what's happening. (Trace some cards carefully. Maybe I'm wrong and still missing something internal.) 2) See if there's any way to improve the interval calculation. 3) See if there's any way to make my ease changes "Undoable" on the fly. (This might not affect anything the user experiences in practice, since any new reviews are correctly overwriting the undone reviews completely anyway, but it would make the code more stable and easier to test).

brownbat commented 3 years ago

Confirmed, Anki's miscalculating the interval the first time you see the card. If you answer a card and then immediately go into info to see the new interval, it will be longer than Anki advertised. If you undo the card, the new advertised interval will be accurate.

Not immediately sure how to fix this one, those estimates are generated in a completely different part of Anki. But while it is misleading, it's not breaking scheduling, the algorithm is still working.

i.e., the card behavior is consistent, it's just that first label you see is a bit off, because main Anki doesn't expect AEF is going to change the ease factor.

In Edit > Preferences, there's an option to "Show next review time above answer buttons." I'll try to find a way to improve the accuracy of those numbers regardless, but you may want to disable it in the meantime if it's really distracting. Scheduling is definitely working under the hood, rest assured.

tommy412 commented 3 years ago

That's really great news!

Thanks so much for your answer, I really appreciate it!

brownbat commented 3 years ago

I'm just going to keep this one open for a bit while I figure out how to mess with that number... just as a reminder in case I don't figure it out right away.

Thanks for the report!