Skip to content

Commit

Permalink
Fix/fallback to 1 when weights doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Jan 9, 2025
1 parent 24dfb16 commit 60e4d39
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/fsrs_optimizer/fsrs_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1551,6 +1551,8 @@ def evaluate(self, save_to_file=True):
lambda row: -np.log(row["p"]) if row["y"] == 1 else -np.log(1 - row["p"]),
axis=1,
)
if "weights" not in self.dataset.columns:
self.dataset["weights"] = 1
self.dataset["log_loss"] = (
self.dataset["log_loss"]
* self.dataset["weights"]
Expand Down

0 comments on commit 60e4d39

Please sign in to comment.