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

feature-benchmark: Discard the first measurement obtained #10688

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
17 changes: 13 additions & 4 deletions misc/python/materialize/feature_benchmark/filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@


class Filter:
pass


class RemoveOutliers(Filter):
def __init__(self) -> None:
self._data: List[float] = []


class RemoveOutliers(Filter):
def filter(self, measurement: float) -> bool:
self._data.append(measurement)

Expand All @@ -37,3 +35,14 @@ def filter(self, measurement: float) -> bool:
class NoFilter(Filter):
def filter(self, measurement: float) -> bool:
return False


class FilterFirst(Filter):
def filter(self, measurement: float) -> bool:
self._data.append(measurement)

if len(self._data) == 1:
print("Discarding first measurement.")
return True
else:
return False
12 changes: 8 additions & 4 deletions test/feature-benchmark/mzcompose.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
RelativeThresholdComparator,
)
from materialize.feature_benchmark.executor import Docker
from materialize.feature_benchmark.filter import Filter, NoFilter
from materialize.feature_benchmark.filter import Filter, FilterFirst, NoFilter
from materialize.feature_benchmark.termination import (
NormalDistributionOverlap,
ProbForMin,
Expand All @@ -48,8 +48,12 @@
#


def make_filter() -> Filter:
return NoFilter()
def make_filter(args: argparse.Namespace) -> Filter:
# Discard the first run unless a small --max-runs limit is explicitly set
if args.max_runs <= 5:
return NoFilter()
else:
return FilterFirst()


def make_termination_conditions(args: argparse.Namespace) -> List[TerminationCondition]:
Expand Down Expand Up @@ -125,7 +129,7 @@ def run_one_scenario(
scenario=scenario,
scale=args.scale,
executor=executor,
filter=make_filter(),
filter=make_filter(args),
termination_conditions=make_termination_conditions(args),
aggregation=make_aggregation(),
)
Expand Down