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

Only compute step loss on non-same-day reviews #84

Merged
merged 2 commits into from
Jan 28, 2025
Merged

Conversation

joshdavham
Copy link
Member

@joshdavham joshdavham commented Jan 28, 2025

Previously, the optimizer would only compute step loss on review-state cards. For example:

if card.state == State.Review:
    step_loss = loss_fn(y_pred_retrievability, y_retrievability)

However, it makes more sense to more generally compute step loss on non-same-day (long term) reviews rather than depending on the specific learning state of the card. Technically, in the past, a user could review a review-state card multiple times in one day and this fix simply accounts for that case.

Now, step loss is computed on all non-same-day reviews, not just review-state cards.

if card.last_review and (review_datetime - card.last_review).days > 0:
    step_loss = loss_fn(y_pred_retrievability, y_retrievability)

I also adjusted one of the unit tests as the optimal computed parameters are now slightly different.

Let me know if you have any questions 👍

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.

LGTM

@L-M-Sherlock
Copy link
Member

For the calculation of elapsed days, you can refer to:

@joshdavham joshdavham added this pull request to the merge queue Jan 28, 2025
Merged via the queue into main with commit b92abdf Jan 28, 2025
16 checks passed
@joshdavham joshdavham deleted the same-day-steploss branch January 28, 2025 16:04
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