Skip to content

Commit

Permalink
reset S0_dataset_group if dataset is not None
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Jan 2, 2025
1 parent 96cea5f commit f464c06
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/fsrs_optimizer/fsrs_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,12 +1003,6 @@ def pretrain(self, dataset=None, verbose=True):
)
else:
self.dataset = dataset
self.dataset = self.dataset[
(self.dataset["i"] > 1) & (self.dataset["delta_t"] > 0)
]
if self.dataset.empty:
raise ValueError("Training data is inadequate.")
if self.S0_dataset_group is None:
self.dataset["first_rating"] = self.dataset["r_history"].map(
lambda x: x[0] if len(x) > 0 else ""
)
Expand All @@ -1018,6 +1012,11 @@ def pretrain(self, dataset=None, verbose=True):
.agg({"y": ["mean", "count"]})
.reset_index()
)
self.dataset = self.dataset[
(self.dataset["i"] > 1) & (self.dataset["delta_t"] > 0)
]
if self.dataset.empty:
raise ValueError("Training data is inadequate.")
rating_stability = {}
rating_count = {}
average_recall = self.dataset["y"].mean()
Expand Down

0 comments on commit f464c06

Please sign in to comment.