Skip to content

Commit

Permalink
create "tensor" if it doesn't exist during evaluation
Browse files Browse the repository at this point in the history
  • Loading branch information
L-M-Sherlock committed Jan 9, 2025
1 parent e70dbfb commit 8ef0528
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/fsrs_optimizer/fsrs_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1541,6 +1541,11 @@ def moving_average(data, window_size=365 // 20):

def evaluate(self, save_to_file=True):
my_collection = Collection(DEFAULT_PARAMETER, self.float_delta_t)
if "tensor" not in self.dataset.columns:
self.dataset["tensor"] = self.dataset.progress_apply(
lambda x: lineToTensor(list(zip([x["t_history"]], [x["r_history"]]))[0]),
axis=1,
)
stabilities, difficulties = my_collection.batch_predict(self.dataset)
self.dataset["stability"] = stabilities
self.dataset["difficulty"] = difficulties
Expand Down

0 comments on commit 8ef0528

Please sign in to comment.