Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify Revlog->FSRSItem conversion #13

Merged
merged 13 commits into from
Aug 23, 2023

Conversation

dae
Copy link
Collaborator

@dae dae commented Aug 21, 2023

Depends on #12.

I wasn't entirely sure what the current code was trying to do, so please double-check it still performs as you expect / let me know if it's changed the behavior.

@dae dae force-pushed the tidyups branch 3 times, most recently from 31f796c to 682c503 Compare August 21, 2023 08:04
@dae dae marked this pull request as draft August 21, 2023 20:19
@dae dae marked this pull request as ready for review August 21, 2023 21:45
@dae
Copy link
Collaborator Author

dae commented Aug 21, 2023

My earlier code was quite wrong, as I'd assumed there'd be only one FSRSItem for each card. The new code is passing the tests - does it look ok to you?

One remaining question - if we look at the shape of FSRSItem and FSRSReview, the delta_t and rating are now the same:

/// Represents a single review on a card, and contains the previous reviews for that card.
#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
pub struct FSRSItem {
    /// The previous reviews done to the card before the current one
    pub reviews: Vec<FSRSReview>,
    /// 1-4
    pub rating: i32,
    /// The number of days that passed
    pub delta_t: i32,
}

#[derive(Debug, Clone, Deserialize, Serialize, PartialEq)]
pub struct FSRSReview {
    /// 1-4
    pub rating: i32,
    /// The number of days that passed
    pub delta_t: i32,
}

Would it make sense to remove the rating/delta_t from FSRSItem, and instead place one more review in the vec instead? Eg have it store current+previous reviews, and not just previous reviews.

@L-M-Sherlock
Copy link
Member

L-M-Sherlock commented Aug 22, 2023

Would it make sense to remove the rating/delta_t from FSRSItem, and instead place one more review in the vec instead?

Yeah, it's OK. I have read the code and found that you convert rating to label in FSRSBatcher. After insert the last rating/delta_t into vec, we need pop it and convert it into label in FSRSBatcher.

Copy link
Member

@L-M-Sherlock L-M-Sherlock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work! I have reviewed the code and trained FSRS with the test collection.

@L-M-Sherlock L-M-Sherlock merged commit c242a49 into open-spaced-repetition:main Aug 23, 2023
1 check passed
@L-M-Sherlock L-M-Sherlock mentioned this pull request Aug 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants