Skip to content

Commit

Permalink
Merge pull request #139 from andrewm4894/sql-optimize-timestamp
Browse files Browse the repository at this point in the history
Optimize SQL a little more
  • Loading branch information
andrewm4894 authored Feb 23, 2025
2 parents a460dab + e45bb70 commit 5b39c39
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions metrics/defaults/defaults.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ model_configs:
contamination: 0.01
model_combination_method: 'mean' # method to combine model scores, 'mean', 'min' or 'max'.
train_max_n: 2500 # max number of observations for training a model.
train_metric_timestamp_max_days_ago: 30
train_min_n: 14 # min number of observations for training a model.
score_max_n: 25 # max n to pull for scoring to avoid pulling more than needed.
score_metric_timestamp_max_days_ago: 7
preprocess_params:
diff_n: 1 # 1 will use diff, 0 will use raw metric values.
smooth_n: 3 # how much smoothing to apply in preprocessing.
Expand Down
2 changes: 2 additions & 0 deletions metrics/defaults/sql/score.sql
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ where
metric_batch = '{{ metric_batch }}'
and
metric_type in ('metric', 'score')
and
metric_timestamp >= date('now', '-{{ score_metric_timestamp_max_days_ago }} day')
{% if score_exclude_metrics is defined %}
and
-- Exclude the specified metrics
Expand Down
2 changes: 2 additions & 0 deletions metrics/defaults/sql/train.sql
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ where
metric_batch = '{{ metric_batch }}'
and
metric_type = 'metric'
and
metric_timestamp >= date('now', '-{{ train_metric_timestamp_max_days_ago }} day')
{% if train_exclude_metrics is defined %}
and
-- Exclude the specified metrics
Expand Down

0 comments on commit 5b39c39

Please sign in to comment.