Skip to content

Commit

Permalink
fix: backtest
Browse files Browse the repository at this point in the history
Signed-off-by: Avik Basu <[email protected]>
  • Loading branch information
ab93 committed Feb 5, 2024
1 parent c418b5a commit 9de1e83
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
18 changes: 7 additions & 11 deletions numalogic/backtest/_prom.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,14 +204,12 @@ def generate_scores(
thresh_out = postproc_udf.compute_threshold(artifacts["threshold_clf"], x_recon[idx])
raw_scores[idx] = thresh_out

feature_scores[idx] = postproc_udf.compute_feature_scores(
raw_scores[idx], self.nlconf.score
)
winscores = postproc_udf.compute_feature_scores(raw_scores[idx], self.nlconf.score)

postproc_out = postproc_udf.compute_postprocess(postproc_func, feature_scores[idx])
feature_scores[idx] = postproc_udf.compute_postprocess(postproc_func, winscores)

unified_scores[idx] = postproc_udf.compute_unified_score(
postproc_out, self.nlconf.score
feature_scores[idx], self.nlconf.score
)

x_recon = inverse_window(torch.from_numpy(x_recon), method="keep_first").numpy()
Expand Down Expand Up @@ -324,12 +322,10 @@ def _construct_output(
index=ts_idx,
)
else:
postproc_df = (
pd.DataFrame(
postproc_out,
columns=["unified"],
index=ts_idx,
),
postproc_df = pd.DataFrame(
postproc_out,
columns=["unified"],
index=ts_idx,
)

dfs = {
Expand Down
2 changes: 1 addition & 1 deletion numalogic/config/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ class AggregatorConf:
@dataclass
class ScoreConf:
window_agg: AggregatorConf = field(
default_factory=lambda: AggregatorConf(method=AggMethod.EXP, conf=dict(beta=0.6))
default_factory=lambda: AggregatorConf(method=AggMethod.MEAN)
)
feature_agg: AggregatorConf = field(
default_factory=lambda: AggregatorConf(method=AggMethod.MAX)
Expand Down

0 comments on commit 9de1e83

Please sign in to comment.