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

fix: Add last interval to BetweenTwoTriggersEvalStrategy #618

Merged
merged 24 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
ecaa5fa
Adjustments for triggering experiments
robinholzi Aug 18, 2024
091f205
Merge branch 'main' into robinholzi/chore/experiment-adjustments
robinholzi Aug 26, 2024
8cb3aec
Adjust baseconfig arxiv, huffpost
robinholzi Aug 26, 2024
844c6c6
Add hellinger distance
robinholzi Sep 1, 2024
00492f2
Fix lint
robinholzi Sep 1, 2024
1250715
Merge branch 'robinholzi/feat/hellinger' into robinholzi/chore/experi…
robinholzi Sep 1, 2024
f92fee4
Update yearbook experiments
robinholzi Sep 1, 2024
e29c1bc
fixes
robinholzi Sep 2, 2024
49031a8
Linting
robinholzi Sep 2, 2024
cc15279
Fix
robinholzi Sep 2, 2024
4208bef
Integrate suggestions
robinholzi Sep 2, 2024
e34b4b3
Merge branch 'robinholzi/feat/hellinger' into robinholzi/chore/experi…
robinholzi Sep 2, 2024
bdc9d0c
Merge branch 'main' into robinholzi/chore/experiment-adjustments
robinholzi Sep 2, 2024
3df690f
Integrate suggestions
robinholzi Sep 2, 2024
231f0eb
Rename
robinholzi Sep 2, 2024
7944de7
Fix mypy
robinholzi Sep 2, 2024
13f6377
Fix tests renamings
robinholzi Sep 2, 2024
07b533d
Add warmup
robinholzi Sep 2, 2024
c43fa86
Merge branch 'main' into robinholzi/warmup-performance-trigger
robinholzi Sep 2, 2024
48d5dd8
Fix tests
robinholzi Sep 2, 2024
973c3b7
Add last interval
robinholzi Sep 3, 2024
3fce55c
Integrate suggestions
robinholzi Sep 3, 2024
6e2aca8
Merge branch 'robinholzi/warmup-performance-trigger' into robinholzi/…
robinholzi Sep 3, 2024
56e4914
Merge branch 'main' into robinholzi/fix/between-triggers-eval-stragy2
robinholzi Sep 3, 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
Prev Previous commit
Next Next commit
Linting
  • Loading branch information
robinholzi committed Sep 2, 2024
commit 49031a8619e4ecffeadb1ce17bf0d425b7426f35
1 change: 0 additions & 1 deletion experiments/models.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from dataclasses import dataclass, field

from modyn.config.schema.pipeline.evaluation.handler import EvalHandlerConfig
from modyn.config.schema.pipeline.evaluation.metrics import MetricConfig
from modyn.config.schema.pipeline.trigger.cost.cost import CostTriggerConfig
from modyn.config.schema.pipeline.trigger.drift.config import DataDriftTriggerConfig
from modyn.config.schema.pipeline.trigger.ensemble import EnsembleTriggerConfig
Expand Down
32 changes: 11 additions & 21 deletions experiments/yearbook/compare_trigger_policies/run.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
import os
from turtle import backward

from sklearn.linear_model import ridge_regression

from experiments.models import Experiment
from experiments.utils.experiment_runner import run_multiple_pipelines
Expand All @@ -13,7 +10,6 @@
ModynPipelineConfig,
TimeTriggerConfig,
)
from modyn.config.schema.pipeline import trigger
from modyn.config.schema.pipeline.evaluation.config import EvalDataConfig
from modyn.config.schema.pipeline.evaluation.handler import EvalHandlerConfig
from modyn.config.schema.pipeline.evaluation.metrics import AccuracyMetricConfig
Expand All @@ -26,15 +22,11 @@
from modyn.config.schema.pipeline.evaluation.strategy.slicing import (
SlicingEvalStrategyConfig,
)
from modyn.config.schema.pipeline.trigger import DataDriftTriggerConfig, TriggerConfig
from modyn.config.schema.pipeline.trigger import DataDriftTriggerConfig
from modyn.config.schema.pipeline.trigger.cost.cost import (
AvoidableMisclassificationCostTriggerConfig,
CostTriggerConfig,
DataIncorporationLatencyCostTriggerConfig,
)
from modyn.config.schema.pipeline.trigger.drift.aggregation import (
MajorityVoteDriftAggregationStrategy,
)
from modyn.config.schema.pipeline.trigger.drift.alibi_detect import (
AlibiDetectMmdDriftMetric,
)
Expand Down Expand Up @@ -152,7 +144,7 @@ def construct_pipelines(experiment: Experiment) -> list[ModynPipelineConfig]:
gpu_device="cuda:1",
),
# -------------------------------- Drift triggers -------------------------------- #
# Static treshold drift
# Static threshold drift
3: Experiment(
name="yb-baseline-datadrift-static",
eval_handlers=[construct_slicing_eval_handler(), construct_between_trigger_eval_handler()],
Expand Down Expand Up @@ -328,9 +320,8 @@ def construct_pipelines(experiment: Experiment) -> list[ModynPipelineConfig]:
},
gpu_device="cuda:1",
),

# ------------------------------- Ensemble triggers ------------------------------
# with best working preivous triggers
# ------------------------------- Ensemble triggers ------------------------------
# with best working previous triggers
20: Experiment(
name="yb-ensemble",
eval_handlers=[construct_slicing_eval_handler(), construct_between_trigger_eval_handler()],
Expand All @@ -339,15 +330,15 @@ def construct_pipelines(experiment: Experiment) -> list[ModynPipelineConfig]:
subtriggers={
"drift1": DataDriftTriggerConfig(
evaluation_interval_data_points=500,
windowing_strategy=TimeWindowingStrategy(limit_ref=f"4d", limit_cur=f"4d"),
windowing_strategy=TimeWindowingStrategy(limit_ref="4d", limit_cur="4d"),
warmup_intervals=10,
warmup_policy=TimeTriggerConfig(every="3d", start_timestamp=_FIRST_TIMESTAMP),
metrics={
"mmd": AlibiDetectMmdDriftMetric(
device="cuda:0",
decision_criterion=DynamicRollingAverageThresholdCriterion(
deviation=0.1, absolute=False, window_size=15
)
),
)
},
),
Expand All @@ -363,25 +354,24 @@ def construct_pipelines(experiment: Experiment) -> list[ModynPipelineConfig]:
batch_size=64,
dataloader_workers=1,
metrics=[
AccuracyMetricConfig(evaluation_transformer_function=yb_evaluation_transformer_function),
AccuracyMetricConfig(
evaluation_transformer_function=yb_evaluation_transformer_function
),
],
),
),
mode="hindsight", # TODO: lookahead
forecasting_method="ridge_regression",
decision_criteria={
"static-0.8": StaticPerformanceThresholdCriterion(
metric="Accuracy", metric_threshold=0.8
)
"static-0.8": StaticPerformanceThresholdCriterion(metric="Accuracy", metric_threshold=0.8)
},
),
},
ensemble_strategy=AtLeastNEnsembleStrategy(n=1)
ensemble_strategy=AtLeastNEnsembleStrategy(n=1),
)
},
gpu_device="cuda:0",
),

# ----------------------------- Evaluation intervals ----------------------------- #
# 100: Experiment(
# name="yb-timetrigger1y-periodic-eval-intervals",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -396,9 +396,8 @@ def get_failure_reason(eval_aborted_reason: EvaluationAbortedReason) -> str:
# DevTools #
# ------------------------------------------------------------------------------------ #

def eval_executor_single_pipeline(
pipeline_dir: Path
) -> None:

def eval_executor_single_pipeline(pipeline_dir: Path) -> None:
# restart evaluation executor
ex = EvaluationExecutor.init_from_path(pipeline_dir)

Expand All @@ -412,11 +411,10 @@ def eval_executor_single_pipeline(

logs_.supervisor_logs = ex.run_post_pipeline_evaluations(manual_run=True)
logs_.materialize(pipeline_dir, mode="final")
logger.info(f"Done with manual evaluation.")
logger.info("Done with manual evaluation.")


def eval_executor_multi_pipeline(
pipelines_dir: Path
) -> None:
def eval_executor_multi_pipeline(pipelines_dir: Path) -> None:
"""Run the evaluation executor for multiple pipelines."""
pipeline_dirs = [p for p in pipelines_dir.iterdir() if p.is_dir()]
for p_dir in pipeline_dirs:
Expand All @@ -427,10 +425,11 @@ def eval_executor_multi_pipeline(
faulty_dir.mkdir(exist_ok=True)
os.rename(p_dir, faulty_dir / p_dir.name)
continue

eval_executor_single_pipeline(p_dir)
logger.info(f"Done with pipeline {p_dir.name}")


if __name__ == "__main__":
single_pipeline_mode = input("Run evaluation executor for single pipeline? (y/n): ")
userpath = Path(input("Enter pipeline log directory path to (re)run evaluation executor: "))
Expand All @@ -445,5 +444,5 @@ def eval_executor_multi_pipeline(
else:
print("Invalid input")
sys.exit(1)

sys.exit(0)
8 changes: 4 additions & 4 deletions modyn/supervisor/internal/triggers/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@
import os

from .amounttrigger import DataAmountTrigger # noqa: F401
from .avoidablemissclassification_costtrigger import AvoidableMisclassificationCostTrigger # noqa: F401
from .datadrifttrigger import DataDriftTrigger # noqa: F401
from .timetrigger import TimeTrigger # noqa: F401
from .trigger import Trigger # noqa: F401
from .performancetrigger import PerformanceTrigger # noqa: F401
from .dataincorporationlatency_costtrigger import DataIncorporationLatencyCostTrigger # noqa: F401
from .avoidablemissclassification_costtrigger import AvoidableMisclassificationCostTrigger # noqa: F401
from .ensembletrigger import EnsembleTrigger # noqa: F401
from .performancetrigger import PerformanceTrigger # noqa: F401
from .timetrigger import TimeTrigger # noqa: F401
from .trigger import Trigger # noqa: F401

files = os.listdir(os.path.dirname(__file__))
files.remove("__init__.py")
Expand Down
Loading