open-spaced-repetition / fsrs4anki

A modern Anki custom scheduling based on Free Spaced Repetition Scheduler algorithm
https://github.com/open-spaced-repetition/fsrs4anki/wiki
MIT License
2.79k stars 137 forks source link

Parameters for individual decks don't work #41

Closed Expertium closed 2 years ago

Expertium commented 2 years ago

Describe the bug You can specify parameters for each deck, but right now only global parameters affect scheduling.

To Reproduce Steps to reproduce the behavior:

  1. Go to deck options and post code from fsrs4anki_scheduler.js in the window at the bottom of the settings
  2. Add this chunk:

    if (document.getElementById('deck') !== null) {
    
    const deck_name = document.getElementById('deck').innerHTML;
    // parameters for a specific deck
    if (deck_name == "DeckName") {
        var f_s = [0.7712,0.837];
        var f_d = [1.0018,-0.9006,-1.1375,0.0935];
        var s_w = [3.0531,-0.8949,-0.1383,1.3434,2.1846,-0.2868,0.4257,1.245];
    
        requestRetention = 0.80;
        maximumInterval = 3650;
        easyBonus = 1.5;
        hardInterval = 1.2;
    }
    }
  3. Try doing reviews with the above piece of code and without it (with global parameters)
  4. Compare the intervals, they should be different since the parameters are different

Expected behavior Different sets of parameters should produce different intervals.

Environment

Additional context Here's all of my code: code.txt

L-M-Sherlock commented 2 years ago

Can you open the inspector and run the code to this line? It will show the deck name that the code actually fetchs.

image

Expertium commented 2 years ago

Yep, it uses the correct deck name, but not the correct parameters. 1

L-M-Sherlock commented 2 years ago

Was var f_s = [0.7249,0.8026] skipped?

Expertium commented 2 years ago

My global parameters are

var f_s = [0.4112,1.5968];
var f_d = [1.0199,-0.4685,-1.7075,0.0714];
var s_w = [3.5014,-1.3554,-0.138,1.7324,2.9985,-0.0531,0.9896,1.3442];

My parameters for that deck are:

var f_s = [0.7249,0.8026];
var f_d = [1.0007,-0.6561,-1.2081,0.0112];
var s_w = [3.2511,-0.8703,-0.0277,1.5211,2.1651,-0.2846,0.5221,1.2443]

"Scope" shows the wrong parameters, but the right deck name. 1

I'm using scheduler v2.0.3

L-M-Sherlock commented 2 years ago

Can you step over the line 31-38, then to check the scope?

Expertium commented 2 years ago

image

L-M-Sherlock commented 2 years ago

image

So the parameters have been set. Any other problem?

Expertium commented 2 years ago

Huh, weird. I'll test it a bit more later, now that I've disabled button king add-on.

Expertium commented 2 years ago

Well, at this point I'm just confused. I tried enabling and disabling "the king of button add-ons", tried removing the code entirely, and no matter what I do the intervals don't change. Take a look at screenshots - the intervals are the same no matter what. I made sure that V3 scheduler is enabled, restarted Anki every time, etc. I tried using new code (v2.1.0) instead of 2.0.3, nope, still doesn't work. image

L-M-Sherlock commented 2 years ago

Can you follow these actions in this GIF?

debug

I need easy_interval, good_interval and hard_interval in your case.

Expertium commented 2 years ago

Here image I once again tried enabling and disabling "the king of button add-ons", it doesn't make a difference.

L-M-Sherlock commented 2 years ago

I add a new example of setting parameters for a specific deck:

image
Expertium commented 2 years ago

image image Nope, intervals still don't change, no matter what parameters I use and no matter whether I even use code from fsrs4anki_scheduler.js. This stuff did change though, but not the intervals that are displayed image

L-M-Sherlock commented 2 years ago

Do you click show answer before the code run to the end?

L-M-Sherlock commented 2 years ago

You can click the blue arrow to run to the end of the code. Then you click the show answer, and the interval may be different.

image
Expertium commented 2 years ago

Nope, still the same.

L-M-Sherlock commented 2 years ago

So weird😭.

Expertium commented 2 years ago

Do you not have the same issue? I have one last idea in mind - I'll try disabling every single add-on, and see if that helps.

Expertium commented 2 years ago

image Ok, I'm getting somewhere. I will turn add-ons on one-by-one, and see if maybe one of them breaks the whole thing (seems like that's what's happening)

L-M-Sherlock commented 2 years ago

I'm looking forward to your good news!

Expertium commented 2 years ago

image

Alright, so this does change something. Deck-specific parameters still don't work though, even now. OR maybe it just so happened that both global and deck-specific parameters produced the same result. Frankly, I don't know how sensitive intervals are to changes in parameters. Ok, after a bit of testing with different parameters, I think we were fighting a non-existent problem - I think both global parameters and deck-specific parameters just happened to produce (roughly) the same intervals for that card of mine. That also means that it's probably unnecessary to optimize each deck individually, global parameters are probably good enough, aside from some crazy hard or crazy easy decks. We need some kind of sensitivity analysis, like "If I change this parameter by 5%, how much will the interval change?", that sort of thing. I'll try to enable add-ons back one-by-one.

Aaaaaaaaaaaand the culprit is...Incremental Reading v4.11.3 (unofficial clone). Ok, so we weren't fighting a non-issue, both this AND the fact that changing parameters seems to only slightly affect intervals were simultaneously causing confusion. God damn incremental reading man, I personally reported like 3-5 bugs for that add-on, what a pain.

Add-ons that don't cause problems: Advanced Browser Anki forvo-dl - Forvo Pronunciation Downloader fully automatic AnkiConnect AnkiWebView Inspector CrowdAnki JSON export&import Edit history Collaborate on deck creation. Enhanced Cloze for Anki 41 export cards/notes from browser with metadata to csv or xlsx Export in CSV format Extended Card Stats During Review Image Occlusion Enhanced Image Style Editor Progress Graphs and Stats for Learned and Matured Cards Quantified Self add-on - export your review log (fork for Anki 2.1) Remove Duplicate Cards Review Heatmap True Retention The KING of Button Add-ons

Well, at least now you can add these to the list of addons that are compatible with FSRS (or, rather, to the "These seem to work at first glance and don't immediately make the new algorithm shit itself" list). And yes, The King of Buttonf Add-ons doesn't interfere with FSRS, it seems.

L-M-Sherlock commented 2 years ago

I add the incompatible add-ons to the list at Compatibility.