Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add more powerful drift windowing strategies, warmup and dynamic thresholds #564

Merged
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
9d71dfb
Add more powerful windowing strategies, warumup and dynamic thresholds
robinholzi Jul 4, 2024
244da67
Merge branch 'main' into robinholzi/feat/more-powerful-drift-windows-…
robinholzi Jul 4, 2024
85ed4f5
Merge branch 'main' into robinholzi/feat/more-powerful-drift-windows-…
robinholzi Jul 22, 2024
4ca50ed
Add tests
robinholzi Jul 24, 2024
91e0dda
Merge branch 'main' into robinholzi/feat/more-powerful-drift-windows-…
robinholzi Jul 24, 2024
28dbb9f
Merge branch 'main' into robinholzi/feat/more-powerful-drift-windows-…
robinholzi Jul 26, 2024
6b22b6d
fix linting
robinholzi Jul 26, 2024
0d42176
fix linting
robinholzi Jul 26, 2024
0028e1b
Implement suggestions, v1
robinholzi Aug 7, 2024
9f3b70f
Merge branch 'main' into robinholzi/feat/more-powerful-drift-windows-…
robinholzi Aug 7, 2024
bbacf1e
Integrate suggestions, rename things, more tests, documentation
robinholzi Aug 8, 2024
44f29d1
Fix
robinholzi Aug 8, 2024
836af4f
Merge branch 'main' into robinholzi/feat/more-powerful-drift-windows-…
robinholzi Aug 12, 2024
f950c25
Fix
robinholzi Aug 12, 2024
8912476
Merge branch 'main' into robinholzi/feat/more-powerful-drift-windows-…
robinholzi Aug 12, 2024
c9091aa
Tests and adjustments to warmup
robinholzi Aug 12, 2024
4792fd4
Integrate suggestions, rename things
robinholzi Aug 12, 2024
ed0baaa
fix
robinholzi Aug 12, 2024
ccb6ba3
Fix
robinholzi Aug 13, 2024
46f52d3
Move averaging logic into detector
robinholzi Aug 13, 2024
a2392ad
Merge branch 'main' into robinholzi/feat/more-powerful-drift-windows-…
robinholzi Aug 13, 2024
ea036c1
Final adjustments
robinholzi Aug 14, 2024
9594453
Small fix wrt interval tests
robinholzi Aug 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 31 additions & 10 deletions analytics/app/pages/plots/eval_over_time.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,12 @@ class _PageState:


def gen_figure(
page: str, multi_pipeline_mode: bool, patch_yearbook: bool, eval_handler: str, dataset_id: str, metric: str
page: str,
multi_pipeline_mode: bool,
patch_yearbook: bool,
eval_handler: str,
dataset_id: str,
metric: str,
) -> go.Figure:
"""
Create the evaluation over time figure with a line plot.
Expand Down Expand Up @@ -58,7 +63,7 @@ def gen_figure(
# we only want the pipeline performance (composed of the models active periods stitched together)
df_adjusted = df_adjusted[df_adjusted[composite_model_variant]]
else:
assert df_adjusted["pipeline_ref"].nunique() == 1
assert df_adjusted["pipeline_ref"].nunique() <= 1
# add the pipeline time series which is the performance of different models stitched together dep.
# w.r.t which model was active
pipeline_composite_model = df_adjusted[df_adjusted[composite_model_variant]]
Expand Down Expand Up @@ -106,7 +111,10 @@ def section_metricovertime(
composite_model_variant: CompositeModelOptions,
) -> html.Div:
if page not in _shared_data:
_shared_data[page] = _PageState(composite_model_variant=composite_model_variant, df_eval_single=df_eval_single)
_shared_data[page] = _PageState(
composite_model_variant=composite_model_variant,
df_eval_single=df_eval_single,
)
_shared_data[page].composite_model_variant = composite_model_variant
_shared_data[page].df_eval_single = df_eval_single

Expand All @@ -118,7 +126,14 @@ def section_metricovertime(
Input(f"{page}-evalovertime-evaluation-metric", "value"),
)
def update_figure(patch_yearbook: bool, eval_handler_ref: str, dataset_id: str, metric: str) -> go.Figure:
return gen_figure(page, multi_pipeline_mode, patch_yearbook, eval_handler_ref, dataset_id, metric)
return gen_figure(
page,
multi_pipeline_mode,
patch_yearbook,
eval_handler_ref,
dataset_id,
metric,
)

eval_handler_refs = list(df_eval_single["eval_handler"].unique())
eval_datasets = list(df_eval_single["dataset_id"].unique())
Expand All @@ -139,7 +154,7 @@ def update_figure(patch_yearbook: bool, eval_handler_ref: str, dataset_id: str,
dcc.RadioItems(
id=f"{page}-evalovertime-evaluation-handler",
options=eval_handler_refs,
value=eval_handler_refs[0] if len(eval_handler_refs) > 0 else None,
value=(eval_handler_refs[0] if len(eval_handler_refs) > 0 else None),
persistence=True,
),
],
Expand All @@ -155,7 +170,7 @@ def update_figure(patch_yearbook: bool, eval_handler_ref: str, dataset_id: str,
dcc.RadioItems(
id=f"{page}-evalovertime-dataset-id",
options=eval_datasets,
value=eval_datasets[0] if len(eval_datasets) > 0 else None,
value=(eval_datasets[0] if len(eval_datasets) > 0 else None),
persistence=True,
),
],
Expand All @@ -173,7 +188,7 @@ def update_figure(patch_yearbook: bool, eval_handler_ref: str, dataset_id: str,
options=[
{"label": metric, "value": metric, "disabled": True} for metric in eval_metrics
],
value=eval_metrics[0] if len(eval_metrics) > 0 else None,
value=(eval_metrics[0] if len(eval_metrics) > 0 else None),
persistence=True,
),
],
Expand All @@ -189,8 +204,14 @@ def update_figure(patch_yearbook: bool, eval_handler_ref: str, dataset_id: str,
dcc.RadioItems(
id=f"{page}-evalovertime-radio-time-patch-yearbook",
options=[
{"label": "yes (convert day based timestamps to years)", "value": True},
{"label": "no (use timestamps as they are)", "value": False},
{
"label": "yes (convert day based timestamps to years)",
"value": True,
},
{
"label": "no (use timestamps as they are)",
"value": False,
},
],
value=False,
persistence=True,
Expand All @@ -206,7 +227,7 @@ def update_figure(patch_yearbook: bool, eval_handler_ref: str, dataset_id: str,
page,
multi_pipeline_mode,
False,
eval_handler=eval_handler_refs[0] if len(eval_handler_refs) > 0 else None,
eval_handler=(eval_handler_refs[0] if len(eval_handler_refs) > 0 else None),
dataset_id=eval_datasets[0] if len(eval_datasets) > 0 else None,
metric=eval_metrics[0] if len(eval_metrics) > 0 else None,
),
Expand Down
1 change: 0 additions & 1 deletion benchmark/huffpost_kaggle/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ In this directory, you can find the files necessary to run experiments using the
The goal is to predict the tag of news given headlines.
The dataset contains more than 60k samples collected from 2012 to 2018.
Titles belonging to the same year are grouped into the same CSV file and stored together.
Each year is mapped to a year starting from 1/1/1970.
There is a total of 42 categories/classes.

> Note: The wild-time variant of the huffpost dataset has only 11 classes. This is due to the fact that
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ trigger:
metrics:
ev_mmd:
id: EvidentlyModelDriftMetric
threshold: 0.7
decision_criterion:
id: ThresholdDecisionCriterion
threshold: 0.7
aggregation_strategy:
id: MajorityVote
selection_strategy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ trigger:
ev_mmd:
id: AlibiDetectMmdDriftMetric
num_permutations: 1000
decision_criterion:
id: DynamicThresholdCriterion

aggregation_strategy:
id: MajorityVote
selection_strategy:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,9 @@ trigger:
metrics:
ev_mmd:
id: EvidentlyModelDriftMetric
threshold: 0.7
decision_criterion:
id: ThresholdDecisionCriterion
threshold: 0.7
aggregation_strategy:
id: MajorityVote
selection_strategy:
Expand Down
18 changes: 9 additions & 9 deletions docs/pipeline/TRIGGERING.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,36 @@ classDiagram
class TimeTrigger {
}

class DataAmount {
class DataAmountTrigger {
}

}

namespace complex_triggers {

class DataDrift {
class DataDriftTrigger {
}

class CostBased {
class CostBasedTrigger {
}

class _BatchedTrigger {
<<Abstract>>
}

class EnsemblePolicy {
class EnsembleTrigger {
}

}

Trigger <|-- _BatchedTrigger
Trigger <|-- EnsemblePolicy
Trigger <|-- EnsembleTrigger

Trigger <|-- TimeTrigger
Trigger <|-- DataAmount
Trigger <|-- DataAmountTrigger

_BatchedTrigger <|-- DataDrift
_BatchedTrigger <|-- CostBased
_BatchedTrigger <|-- DataDriftTrigger
_BatchedTrigger <|-- CostBasedTrigger

EnsemblePolicy *-- "n" Trigger
EnsembleTrigger *-- "n" Trigger
```
Loading
Loading