Skip to content

Commit

Permalink
Feat/log loss for pretrain (#46)
Browse files Browse the repository at this point in the history
* Feat/logloss for pretrain

* fine-tune L1 weight

* update version
  • Loading branch information
L-M-Sherlock authored Sep 26, 2023
1 parent 68df564 commit 94be1a2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "FSRS-Optimizer"
version = "4.14.3"
version = "4.15.0"
readme = "README.md"
dependencies = [
"matplotlib>=3.7.0",
Expand Down
10 changes: 7 additions & 3 deletions src/fsrs_optimizer/fsrs_optimizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -854,9 +854,13 @@ def pretrain(self, dataset=None, verbose=True):

def loss(stability):
y_pred = power_forgetting_curve(delta_t, stability)
rmse = np.sqrt(np.sum((recall - y_pred) ** 2 * count) / total_count)
l1 = np.abs(stability - init_s0) / np.sqrt(s0_size) / total_count
return rmse + l1
logloss = sum(
-(recall * np.log(y_pred) + (1 - recall) * np.log(1 - y_pred))
* count
/ total_count
)
l1 = np.abs(stability - init_s0) / total_count / 16
return logloss + l1

res = minimize(
loss,
Expand Down

0 comments on commit 94be1a2

Please sign in to comment.