From 17d6aef313a6306b96e35a4c38c394a9d2c6be50 Mon Sep 17 00:00:00 2001 From: Jarrett Ye Date: Sun, 21 Apr 2024 11:09:20 +0800 Subject: [PATCH] Fix/inconsistent outlier filter (#108) --- pyproject.toml | 2 +- src/fsrs_optimizer/fsrs_optimizer.py | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 5c655cc..90dd46e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "FSRS-Optimizer" -version = "4.28.0" +version = "4.28.1" readme = "README.md" dependencies = [ "matplotlib>=3.7.0", diff --git a/src/fsrs_optimizer/fsrs_optimizer.py b/src/fsrs_optimizer/fsrs_optimizer.py index 175a949..f400828 100644 --- a/src/fsrs_optimizer/fsrs_optimizer.py +++ b/src/fsrs_optimizer/fsrs_optimizer.py @@ -426,11 +426,12 @@ def remove_outliers(group: pd.DataFrame) -> pd.DataFrame: count = grouped_group.loc[i, ("y", "count")] delta_t = grouped_group.loc[i, "delta_t"].values[0] if has_been_removed + count >= max(total * 0.05, 20): - break - else: if count < 6 or delta_t > (100 if group.name[0] != "4" else 365): group.drop(group[group["delta_t"] == delta_t].index, inplace=True) has_been_removed += count + else: + group.drop(group[group["delta_t"] == delta_t].index, inplace=True) + has_been_removed += count return group