index
int64
0
50.7k
project_path
stringclasses
279 values
completion_path
stringlengths
57
199
signature_postion
stringlengths
3
11
class_position
stringlengths
3
11
function_name
stringlengths
1
62
class_name
stringlengths
0
55
body_position
stringlengths
3
11
body_position_with_comments
stringlengths
3
11
masked_class
stringlengths
14
8.32k
masked_class_with_comment
stringlengths
14
8.32k
func_body
stringlengths
9
6.72k
func_body_with_comment
stringlengths
9
6.72k
len_func_body
int64
1
643
len_input
int64
10
2.02k
len_output
int64
4
1.9k
total
int64
20
2.05k
file_code
stringlengths
14
442k
file_code_with_comment
stringlengths
14
442k
46,929
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/random_test.py
48,49
30,103
test_log_scaling
RandomTest
50,82
49,82
class RandomTest(absltest.TestCase): def test_on_flat_space(self): config = vz.ProblemStatement(test_studies.flat_space_with_all_types()) designer = random.RandomDesigner(config.search_space, seed=None) self.assertLen( test_runners.run_with_random_metrics( designer, config, iters=50, ...
class RandomTest(absltest.TestCase): def test_on_flat_space(self): config = vz.ProblemStatement(test_studies.flat_space_with_all_types()) designer = random.RandomDesigner(config.search_space, seed=None) self.assertLen( test_runners.run_with_random_metrics( designer, config, iters=50, ...
config = vz.ProblemStatement(test_studies.flat_space_with_all_types()) designer = random.RandomDesigner(config.search_space, seed=None) trials = test_runners.run_with_random_metrics( designer, config, iters=1000, batch_size=1 ) # LINEAR scaling. sum_lineardouble = 0.0 for t in trials...
"""Confirm that LINEAR and LOG scaling give the right distribution.""" config = vz.ProblemStatement(test_studies.flat_space_with_all_types()) designer = random.RandomDesigner(config.search_space, seed=None) trials = test_runners.run_with_random_metrics( designer, config, iters=1000, batch_size=1...
171
571
564
1,135
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,930
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/scheduled_designer.py
90,91
84,98
value
ExponentialScheduledParam
91,98
91,98
@attrs.define class ExponentialScheduledParam(ScheduledParam): """Exponential scheduler.""" rate: float def value(self, total_steps: int, step: int) -> float: FILL_FUNC_BODY
@attrs.define class ExponentialScheduledParam(ScheduledParam): """Exponential scheduler.""" rate: float def value(self, total_steps: int, step: int) -> float: FILL_FUNC_BODY
alpha = 1 / self.rate beta = -np.log(self.final_value / self.init_value) / ( (total_steps - 1) ** alpha ) return self.init_value * np.exp(-beta * step**alpha)
alpha = 1 / self.rate beta = -np.log(self.final_value / self.init_value) / ( (total_steps - 1) ** alpha ) return self.init_value * np.exp(-beta * step**alpha)
24
64
75
139
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,931
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/scheduled_designer.py
79,80
75,84
value
LinearScheduledParam
80,84
80,84
@attrs.define class LinearScheduledParam(ScheduledParam): """Linear scheduler.""" def value(self, total_steps: int, step: int) -> float: FILL_FUNC_BODY
@attrs.define class LinearScheduledParam(ScheduledParam): """Linear scheduler.""" def value(self, total_steps: int, step: int) -> float: FILL_FUNC_BODY
slope = (self.final_value - self.init_value) / (total_steps - 1) return self.init_value + slope * step
slope = (self.final_value - self.init_value) / (total_steps - 1) return self.init_value + slope * step
15
57
44
101
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,932
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/scheduled_designer.py
197,200
118,254
_validate_num_incorporated_suggested_trials
ScheduledDesigner
201,215
200,215
@attrs.define class ScheduledDesigner(vza.PartiallySerializableDesigner): """Scheduled designer.""" _problem: vz.ProblemStatement = attrs.field(kw_only=False) _designer_factory: vza.DesignerFactory = attrs.field(kw_only=True) _designer_state_updater: DesignerStateUpdater = attrs.field(kw_only=True) _schedule...
@attrs.define class ScheduledDesigner(vza.PartiallySerializableDesigner): """Scheduled designer.""" _problem: vz.ProblemStatement = attrs.field(kw_only=False) _designer_factory: vza.DesignerFactory = attrs.field(kw_only=True) _designer_state_updater: DesignerStateUpdater = attrs.field(kw_only=True) _schedule...
num_completed = len(completed.trials) num_active = len(all_active.trials) if self._num_incorporated_suggested_trials < num_completed + num_active: # If the designer is updated with more trials than what it observed, we # fast forward and update the state. Would happen if the designer is # ...
"""Validate (and if needed update) the designer's suggested number of trials.""" num_completed = len(completed.trials) num_active = len(all_active.trials) if self._num_incorporated_suggested_trials < num_completed + num_active: # If the designer is updated with more trials than what it observed, w...
74
1,515
225
1,740
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,933
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/scheduled_designer.py
52,53
33,75
_validate
ScheduledParam
54,63
53,63
@attrs.define class ScheduledParam(abc.ABC): """Represents a scheduled parameter. The scheduling starts from `init_value` (the first step) and ends at `final_value` (last step). The `value` method returns the value of the scheduled param in the current step, accounting for the total number of steps in the s...
@attrs.define class ScheduledParam(abc.ABC): """Represents a scheduled parameter. The scheduling starts from `init_value` (the first step) and ends at `final_value` (last step). The `value` method returns the value of the scheduled param in the current step, accounting for the total number of steps in the s...
total_steps = 10 # arbitrarily choose the total steps for validation. tol = 1e-5 if abs(self.value(total_steps, 0) - self.init_value) > tol: raise ValueError("Initial value mismatch (step 0).") if abs(self.value(total_steps, total_steps - 1) - self.final_value) > tol: raise ValueError("Fi...
"""Validate the scheduling param initial and final values.""" total_steps = 10 # arbitrarily choose the total steps for validation. tol = 1e-5 if abs(self.value(total_steps, 0) - self.init_value) > tol: raise ValueError("Initial value mismatch (step 0).") if abs(self.value(total_steps, tota...
42
294
130
424
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,934
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/scheduled_designer_test.py
49,50
34,54
suggest
MockParameterizedDesigner
51,54
50,54
@attrs.define class MockParameterizedDesigner(vza.Designer): """Mock parameterized designer.""" problem: vz.ProblemStatement parameter1: float = 0.0 parameter2: float = 0.0 def update( self, completed: vza.CompletedTrials, all_active: vza.ActiveTrials ) -> None: """Update the designer based on c...
@attrs.define class MockParameterizedDesigner(vza.Designer): """Mock parameterized designer.""" problem: vz.ProblemStatement parameter1: float = 0.0 parameter2: float = 0.0 def update( self, completed: vza.CompletedTrials, all_active: vza.ActiveTrials ) -> None: """Update the designer based on c...
return random.RandomDesigner(self.problem.search_space).suggest(count)
"""Suggest trials.""" return random.RandomDesigner(self.problem.search_space).suggest(count)
2
164
26
190
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,935
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/scheduled_designer_test.py
149,150
65,191
test_scheduled_designer_serialization
ScheduledDesignerTest
150,191
150,191
class ScheduledDesignerTest(absltest.TestCase): def test_schedule_designer(self): expected_total_num_trials = 10 problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.append( vz.MetricInformation( name="metric", goal=...
class ScheduledDesignerTest(absltest.TestCase): def test_schedule_designer(self): expected_total_num_trials = 10 problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.append( vz.MetricInformation( name="metric", goal=...
expected_total_num_trials = 10 problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.append( vz.MetricInformation( name="metric", goal=vz.ObjectiveMetricGoal.MAXIMIZE ) ) param1 = scheduled_designer.Linea...
expected_total_num_trials = 10 problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.append( vz.MetricInformation( name="metric", goal=vz.ObjectiveMetricGoal.MAXIMIZE ) ) param1 = scheduled_designer.Linea...
84
1,091
542
1,633
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,936
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/scheduled_designer_test.py
193,194
191,227
test_scheduled_gp_bandit
ScheduledGpBanditTest
194,227
194,227
class ScheduledGpBanditTest(absltest.TestCase): def test_scheduled_gp_bandit(self): FILL_FUNC_BODY
class ScheduledGpBanditTest(absltest.TestCase): def test_scheduled_gp_bandit(self): FILL_FUNC_BODY
problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.append( vz.MetricInformation( name="metric", goal=vz.ObjectiveMetricGoal.MAXIMIZE ) ) def _gp_bandit_factory(problem): return gp_bandit.VizierGPBan...
problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.append( vz.MetricInformation( name="metric", goal=vz.ObjectiveMetricGoal.MAXIMIZE ) ) def _gp_bandit_factory(problem): return gp_bandit.VizierGPBan...
35
44
331
375
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,937
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/scheduled_designer_test.py
229,230
227,271
test_scheduled_gp_ucb_pe
ScheduledGpUcbPeTest
230,271
230,271
class ScheduledGpUcbPeTest(absltest.TestCase): def test_scheduled_gp_ucb_pe(self): FILL_FUNC_BODY
class ScheduledGpUcbPeTest(absltest.TestCase): def test_scheduled_gp_ucb_pe(self): FILL_FUNC_BODY
problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.append( vz.MetricInformation( name="metric", goal=vz.ObjectiveMetricGoal.MAXIMIZE ) ) def _gp_ucb_pe_factory( problem: vz.ProblemStatement, )...
problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.append( vz.MetricInformation( name="metric", goal=vz.ObjectiveMetricGoal.MAXIMIZE ) ) def _gp_ucb_pe_factory( problem: vz.ProblemStatement, )...
46
46
494
540
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,938
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/scheduled_gp_bandit.py
44,45
28,64
_gp_bandit_state_updater
ScheduledGPBanditFactory
45,51
45,51
@attrs.define(kw_only=True) class ScheduledGPBanditFactory: """Scheduled GP-Bandit factory.""" _gp_bandit_factory: Callable[[vz.ProblemStatement], gp_bandit.VizierGPBandit] _init_ucb_coefficient: float _final_ucb_coefficient: float _decay_ucb_coefficient: float _expected_total_num_trials: int def __call...
@attrs.define(kw_only=True) class ScheduledGPBanditFactory: """Scheduled GP-Bandit factory.""" _gp_bandit_factory: Callable[[vz.ProblemStatement], gp_bandit.VizierGPBandit] _init_ucb_coefficient: float _final_ucb_coefficient: float _decay_ucb_coefficient: float _expected_total_num_trials: int def __call...
designer._scoring_function_factory = ( # pylint: disable=protected-access acquisitions.bayesian_scoring_function_factory( lambda _: acquisitions.UCB(params['ucb_coefficient']) ) )
designer._scoring_function_factory = ( # pylint: disable=protected-access acquisitions.bayesian_scoring_function_factory( lambda _: acquisitions.UCB(params['ucb_coefficient']) ) )
12
377
71
448
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,939
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/scheduled_gp_ucb_pe.py
57,58
28,107
_gp_ucb_pe_state_updater
ScheduledGPUCBPEFactory
58,72
58,72
@attrs.define(kw_only=True) class ScheduledGPUCBPEFactory: """Scheduled GP-UCB-PE factory.""" _gp_ucb_pe_factory: Callable[ [vz.ProblemStatement], gp_ucb_pe.VizierGPUCBPEBandit ] _expected_total_num_trials: int # ucb_coefficient _init_ucb_coefficient: float _final_ucb_coefficient: float _decay_uc...
@attrs.define(kw_only=True) class ScheduledGPUCBPEFactory: """Scheduled GP-UCB-PE factory.""" _gp_ucb_pe_factory: Callable[ [vz.ProblemStatement], gp_ucb_pe.VizierGPUCBPEBandit ] _expected_total_num_trials: int # ucb_coefficient _init_ucb_coefficient: float _final_ucb_coefficient: float _decay_uc...
# Create a new copy of the config and replace the ucb coefficient value. updated_config = dc.replace( designer._config, # pylint: disable=protected-access ucb_coefficient=params['ucb_coefficient'], explore_region_ucb_coefficient=params[ 'explore_region_ucb_coeffi...
# Create a new copy of the config and replace the ucb coefficient value. updated_config = dc.replace( designer._config, # pylint: disable=protected-access ucb_coefficient=params['ucb_coefficient'], explore_region_ucb_coefficient=params[ 'explore_region_ucb_coeffi...
67
785
210
995
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,940
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/unsafe_as_infeasible_designer.py
55,58
27,93
update
UnsafeAsInfeasibleDesigner
58,80
58,80
class UnsafeAsInfeasibleDesigner(vza.Designer): """Designer that maps unsafe Trials as infeasible.""" def __init__( self, problem_statement: vz.ProblemStatement, designer_factory: vza.DesignerFactory[vza.Designer], *, seed: Optional[int] = None, ): """Init. Args: prob...
class UnsafeAsInfeasibleDesigner(vza.Designer): """Designer that maps unsafe Trials as infeasible.""" def __init__( self, problem_statement: vz.ProblemStatement, designer_factory: vza.DesignerFactory[vza.Designer], *, seed: Optional[int] = None, ): """Init. Args: prob...
are_safe = self._safety_checker.are_trials_safe(completed.trials) mutated_trials = [] mutated_trial_count = 0 for is_safe, trial in zip(are_safe, completed.trials): if is_safe: mutated_trials.append(trial) else: measurement = trial.final_measurement or vz.Measurement() ...
are_safe = self._safety_checker.are_trials_safe(completed.trials) mutated_trials = [] mutated_trial_count = 0 for is_safe, trial in zip(are_safe, completed.trials): if is_safe: mutated_trials.append(trial) else: measurement = trial.final_measurement or vz.Measurement() ...
54
404
275
679
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,941
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/designers/unsafe_as_infeasible_designer_test.py
64,65
27,112
test_unsafe_multi_objective_eagle
UnsafeAsInfeasibleDesignerTest
65,112
65,112
class UnsafeAsInfeasibleDesignerTest(absltest.TestCase): def test_unsafe_eagle(self): problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.extend([ vz.MetricInformation( name='metric1', goal=vz.ObjectiveMetricGoal.MAXIMI...
class UnsafeAsInfeasibleDesignerTest(absltest.TestCase): def test_unsafe_eagle(self): problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.extend([ vz.MetricInformation( name='metric1', goal=vz.ObjectiveMetricGoal.MAXIMI...
problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.extend([ vz.MetricInformation( name='metric1', goal=vz.ObjectiveMetricGoal.MAXIMIZE ), vz.MetricInformation( name='metric2', goal=vz.Objective...
problem = vz.ProblemStatement( test_studies.flat_continuous_space_with_scaling() ) problem.metric_information.extend([ vz.MetricInformation( name='metric1', goal=vz.ObjectiveMetricGoal.MAXIMIZE ), vz.MetricInformation( name='metric2', goal=vz.Objective...
55
360
465
825
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,948
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/ensemble/ensemble_design.py
213,215
164,284
play_probs
AdaptiveEnsembleDesign
216,224
215,224
@attrs.define(kw_only=True) class AdaptiveEnsembleDesign(EnsembleDesign): """An EnsembleStrategy that minimizes adaptive regret.""" indices: list[int] = attrs.field() # List of max history lengths. max_lengths: list[int] = attrs.field() # Base stepsize and meta_stepsize should theoretically be 1/sqrt(n) wher...
@attrs.define(kw_only=True) class AdaptiveEnsembleDesign(EnsembleDesign): """An EnsembleStrategy that minimizes adaptive regret.""" indices: list[int] = attrs.field() # List of max history lengths. max_lengths: list[int] = attrs.field() # Base stepsize and meta_stepsize should theoretically be 1/sqrt(n) wher...
ensemble_probs = [algo.ensemble_probs for algo in self._base_algos.values()] weights = softmax(np.array(list(self._log_weights.values()))) final_probs = np.zeros(len(self.indices)) for weight, probs in zip(weights, ensemble_probs): final_probs += weight * probs return final_probs
"""Returns the probability of playing an expert.""" ensemble_probs = [algo.ensemble_probs for algo in self._base_algos.values()] weights = softmax(np.array(list(self._log_weights.values()))) final_probs = np.zeros(len(self.indices)) for weight, probs in zip(weights, ensemble_probs): final_prob...
26
1,397
118
1,515
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,949
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/ensemble/ensemble_design.py
88,89
66,102
update
EXP3IXEnsembleDesign
89,102
89,102
@attrs.define class EXP3IXEnsembleDesign(EnsembleDesign): """The EXP3-IX Algorithm that is robust against small probabilities.""" indices: list[int] = attrs.field() stepsize: float = attrs.field( default=1.0, validator=[attrs.validators.instance_of(float), attrs.validators.gt(0)], ) max_reward: f...
@attrs.define class EXP3IXEnsembleDesign(EnsembleDesign): """The EXP3-IX Algorithm that is robust against small probabilities.""" indices: list[int] = attrs.field() stepsize: float = attrs.field( default=1.0, validator=[attrs.validators.instance_of(float), attrs.validators.gt(0)], ) max_reward: f...
expert_idx, reward = observation reward = min(self.max_reward, reward) gamma = 1.0 / np.sqrt(1.0 + len(self._history)) loss_estimator = (self.max_reward - reward) / ( self.ensemble_probs[expert_idx] + gamma ) self._log_weights[expert_idx] += self.stepsize * (-loss_estimator) self._h...
expert_idx, reward = observation reward = min(self.max_reward, reward) gamma = 1.0 / np.sqrt(1.0 + len(self._history)) loss_estimator = (self.max_reward - reward) / ( self.ensemble_probs[expert_idx] + gamma ) self._log_weights[expert_idx] += self.stepsize * (-loss_estimator) self._h...
37
270
192
462
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,950
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/ensemble/ensemble_design.py
132,133
102,164
update
EXP3UniformEnsembleDesign
134,156
133,156
@attrs.define class EXP3UniformEnsembleDesign(EnsembleDesign): """The EXP3 algorithm with uniform exploration.""" indices: list[int] = attrs.field() stepsize: float = attrs.field( default=1.0, validator=[attrs.validators.instance_of(float), attrs.validators.gt(0)], ) max_reward: float = attrs.fie...
@attrs.define class EXP3UniformEnsembleDesign(EnsembleDesign): """The EXP3 algorithm with uniform exploration.""" indices: list[int] = attrs.field() stepsize: float = attrs.field( default=1.0, validator=[attrs.validators.instance_of(float), attrs.validators.gt(0)], ) max_reward: float = attrs.fie...
expert_idx, reward = observation if not self.use_reward_estimator: reward = min(self.max_reward, reward) gamma = 1.0 / np.sqrt(1 + len(self._history)) if self.use_loss_formulation: if self.use_reward_estimator: loss_estimator = self.max_reward - reward else: loss_estim...
"""Update history and weights.""" expert_idx, reward = observation if not self.use_reward_estimator: reward = min(self.max_reward, reward) gamma = 1.0 / np.sqrt(1 + len(self._history)) if self.use_loss_formulation: if self.use_reward_estimator: loss_estimator = self.max_reward -...
64
505
282
787
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,951
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/ensemble/ensemble_design.py
49,51
45,59
ensemble_probs
RandomEnsembleDesign
52,54
51,54
@attrs.define class RandomEnsembleDesign(EnsembleDesign): indices: list[int] = attrs.field() @property def ensemble_probs(self) -> np.ndarray: FILL_FUNC_BODY def update(self, observation: IndexWithReward, **kwargs): """Updates the strategy with observation.""" pass
@attrs.define class RandomEnsembleDesign(EnsembleDesign): indices: list[int] = attrs.field() @property def ensemble_probs(self) -> np.ndarray: """The probability distribution used to choose the expert.""" FILL_FUNC_BODY def update(self, observation: IndexWithReward, **kwargs): """Updates the strategy wi...
return np.ones(shape=len(self.indices)) / len(self.indices)
"""The probability distribution used to choose the expert.""" return np.ones(shape=len(self.indices)) / len(self.indices)
4
107
27
134
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,952
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/ensemble/ensemble_design_test.py
34,35
23,108
testEXP3IX
EnsembleDesignTest
35,51
35,51
class EnsembleDesignTest(absltest.TestCase): def testRandom(self): indices = [0, 1] rewards = [(1, 1), (0, 0), (1, 1)] strategy = ensemble_design.RandomEnsembleDesign(indices=indices) for reward in rewards: strategy.update(reward) np.testing.assert_array_equal(strategy.ensemble_probs, [0...
class EnsembleDesignTest(absltest.TestCase): def testRandom(self): indices = [0, 1] rewards = [(1, 1), (0, 0), (1, 1)] strategy = ensemble_design.RandomEnsembleDesign(indices=indices) for reward in rewards: strategy.update(reward) np.testing.assert_array_equal(strategy.ensemble_probs, [0...
indices = [0, 1] rewards = [(1, 1), (0, 0), (1, 1)] strategy = ensemble_design.EXP3IXEnsembleDesign( indices=indices, stepsize=1.0 ) np.testing.assert_array_equal(strategy.ensemble_probs, [0.5, 0.5]) for reward in rewards: strategy.update(reward) probs = strategy.ensemble_pr...
indices = [0, 1] rewards = [(1, 1), (0, 0), (1, 1)] strategy = ensemble_design.EXP3IXEnsembleDesign( indices=indices, stepsize=1.0 ) np.testing.assert_array_equal(strategy.ensemble_probs, [0.5, 0.5]) for reward in rewards: strategy.update(reward) probs = strategy.ensemble_pr...
35
770
196
966
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,953
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/ensemble/ensemble_designer.py
178,181
110,260
update
EnsembleDesigner
181,260
181,260
class EnsembleDesigner(vza.Designer): """Ensembling of Designers.""" def __init__( self, designers: dict[str, vza.Designer], ensemble_design_factory: Callable[ [list[int]], ensemble_design.EnsembleDesign ] = ensemble_design.RandomEnsembleDesign, reward_generator: Optional[Ob...
class EnsembleDesigner(vza.Designer): """Ensembling of Designers.""" def __init__( self, designers: dict[str, vza.Designer], ensemble_design_factory: Callable[ [list[int]], ensemble_design.EnsembleDesign ] = ensemble_design.RandomEnsembleDesign, reward_generator: Optional[Ob...
# With no completed Trials, simply update with reward calcuations. if not completed.trials: for designer in self._designers.values(): designer.update(completed, all_active) return if self._reward_generator is None: rewards = [] for t in completed.trials: if t.infeasi...
# With no completed Trials, simply update with reward calcuations. if not completed.trials: for designer in self._designers.values(): designer.update(completed, all_active) return if self._reward_generator is None: rewards = [] for t in completed.trials: if t.infeasi...
245
777
908
1,685
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,954
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/ensemble/ensemble_designer.py
64,65
33,110
curve_generator
ObjectiveRewardGenerator
65,69
65,69
@attrs.define class ObjectiveRewardGenerator: """Stateful rewards generator using the objective curves of Trials.""" problem: vz.ProblemStatement = attrs.field() all_trials: list[vz.Trial] = attrs.field(factory=list) reward_regularization: float = attrs.field( default=0.0, validator=[attrs.validato...
@attrs.define class ObjectiveRewardGenerator: """Stateful rewards generator using the objective curves of Trials.""" problem: vz.ProblemStatement = attrs.field() all_trials: list[vz.Trial] = attrs.field(factory=list) reward_regularization: float = attrs.field( default=0.0, validator=[attrs.validato...
return analyzers.MultiMetricCurveConverter.from_metrics_config( self.problem.metric_information, flip_signs_for_min=True )
return analyzers.MultiMetricCurveConverter.from_metrics_config( self.problem.metric_information, flip_signs_for_min=True )
5
843
49
892
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,956
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/evolution/nsga2.py
146,147
116,196
select
NSGA2Survival
161,196
147,196
class NSGA2Survival(templates.Survival): """NSGA2 Survival step. Reference: https://ieeexplore.ieee.org/document/996017 """ def __init__( self, target_size: int, *, ranking_fn: Callable[[np.ndarray], np.ndarray] = _pareto_rank, eviction_limit: Optional[int] = None ): """Ini...
class NSGA2Survival(templates.Survival): """NSGA2 Survival step. Reference: https://ieeexplore.ieee.org/document/996017 """ def __init__( self, target_size: int, *, ranking_fn: Callable[[np.ndarray], np.ndarray] = _pareto_rank, eviction_limit: Optional[int] = None ): """Ini...
population = population[population.ages < self._eviction_limit] if not population: # return empty. return population selected = population.empty_like() # Sort by the safety constraint. if selected.cs.shape[1]: top, border = _select_by( _constraint_violation(population.cs...
"""Applies survival process. Sorted all points by 3-tuple 1. Descending order of safety constraint violation score. Zero means no violations. 2. Ascending order of how many points it's dominated by. 3. Descending order of crowding distance. Args: population: Returns: Pop...
136
441
396
837
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,957
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/evolution/templates.py
164,166
120,201
converter
CanonicalEvolutionDesigner
166,168
166,168
class CanonicalEvolutionDesigner(vza.PartiallySerializableDesigner, Generic[_PopulationType, _OffspringsType]): """Evolution algorithm template.""" def __init__( self, converter: PopulationConverter[_PopulationType, _OffspringsType], sampler: Sampler[_OffspringsTy...
class CanonicalEvolutionDesigner(vza.PartiallySerializableDesigner, Generic[_PopulationType, _OffspringsType]): """Evolution algorithm template.""" def __init__( self, converter: PopulationConverter[_PopulationType, _OffspringsType], sampler: Sampler[_OffspringsTy...
return self._converter
return self._converter
2
878
10
888
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,958
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/evolution/templates.py
56,58
53,62
sample
Sampler
59,62
58,62
class Sampler(Generic[_OffspringsType], abc.ABC): """Creates new offsprings, typically at the start of evolutionary strategy.""" @abc.abstractmethod def sample(self, count: int) -> _OffspringsType: FILL_FUNC_BODY
class Sampler(Generic[_OffspringsType], abc.ABC): """Creates new offsprings, typically at the start of evolutionary strategy.""" @abc.abstractmethod def sample(self, count: int) -> _OffspringsType: """Generate offsprings.""" FILL_FUNC_BODY
# Temporary typevar, used for defininig Population interface.
"""Generate offsprings.""" # Temporary typevar, used for defininig Population interface.
8
89
21
110
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,959
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/optimizers/base.py
28,29
1,160
_is_positive
29,34
29,34
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
del instance, attribute if value < 0: raise ValueError(f'value must be positive! given: {value}')
del instance, attribute if value < 0: raise ValueError(f'value must be positive! given: {value}')
14
1,537
39
1,576
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,960
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/optimizers/base.py
137,146
115,160
optimize
BranchThenOptimizer
146,160
146,160
@attr.frozen class BranchThenOptimizer(GradientFreeOptimizer): """Optimizes a function by first choosing a branch and then apply Optimizer. Attributes: _branch_selector: Selects all conditional parent values _optimizer_factory: Creates an optimizer in the flat (non-conditional) after branch selector ...
@attr.frozen class BranchThenOptimizer(GradientFreeOptimizer): """Optimizes a function by first choosing a branch and then apply Optimizer. Attributes: _branch_selector: Selects all conditional parent values _optimizer_factory: Creates an optimizer in the flat (non-conditional) after branch selector ...
# If there are conditional branches, use Vizier's default branch # selection mechanism. branches = self._branch_selector.select_branches(count) suggestions = [] optimizer = self._optimizer_factory() for branch in branches: subproblem = attr.evolve(problem, search_space=branch.search_space)...
# If there are conditional branches, use Vizier's default branch # selection mechanism. branches = self._branch_selector.select_branches(count) suggestions = [] optimizer = self._optimizer_factory() for branch in branches: subproblem = attr.evolve(problem, search_space=branch.search_space)...
42
374
168
542
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,961
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/optimizers/designer_optimizer_test.py
41,42
28,54
test_bi_objective
DesignerOptimizerTest
42,54
42,54
class DesignerOptimizerTest(absltest.TestCase): def test_smoke(self): problem = vz.ProblemStatement() problem.search_space.root.add_float_param('a', 0, 1) designer_factory = quasi_random.QuasiRandomDesigner.from_problem optimizer_test_utils.assert_passes_on_random_single_metric_function( sel...
class DesignerOptimizerTest(absltest.TestCase): def test_smoke(self): problem = vz.ProblemStatement() problem.search_space.root.add_float_param('a', 0, 1) designer_factory = quasi_random.QuasiRandomDesigner.from_problem optimizer_test_utils.assert_passes_on_random_single_metric_function( sel...
problem = vz.ProblemStatement() problem.search_space.root.add_float_param('a', 0, 1) designer_factory = nsga2.NSGA2Designer optimizer_test_utils.assert_passes_on_random_multi_metric_function( self, problem.search_space, designer_optimizer.DesignerAsOptimizer(designer_factory), ...
problem = vz.ProblemStatement() problem.search_space.root.add_float_param('a', 0, 1) designer_factory = nsga2.NSGA2Designer optimizer_test_utils.assert_passes_on_random_multi_metric_function( self, problem.search_space, designer_optimizer.DesignerAsOptimizer(designer_factory), ...
15
169
133
302
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,962
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/optimizers/random_vectorized_optimizer_test.py
30,31
27,52
test_random_optimizer
RandomVectorizedOptimizerTest
31,44
31,44
class RandomVectorizedOptimizerTest(absltest.TestCase): """Tests for random_vectorized_optimizer.""" def test_random_optimizer(self): FILL_FUNC_BODY def test_random_optimizer_factory(self): random_optimizer_factory = rvo.create_random_optimizer_factory( max_evaluations=100, suggestion_batch_size=10 ...
class RandomVectorizedOptimizerTest(absltest.TestCase): """Tests for random_vectorized_optimizer.""" def test_random_optimizer(self): FILL_FUNC_BODY def test_random_optimizer_factory(self): random_optimizer_factory = rvo.create_random_optimizer_factory( max_evaluations=100, suggestion_batch_size=10 ...
problem = vz.ProblemStatement() problem.search_space.root.add_float_param('f1', 0.0, 10.0) problem.search_space.root.add_float_param('f2', 0.0, 10.0) converter = converters.TrialToModelInputConverter.from_problem(problem) score_fn = lambda x, _: np.sum(x.continuous.padded_array, axis=(-1, -2)) n...
problem = vz.ProblemStatement() problem.search_space.root.add_float_param('f1', 0.0, 10.0) problem.search_space.root.add_float_param('f2', 0.0, 10.0) converter = converters.TrialToModelInputConverter.from_problem(problem) score_fn = lambda x, _: np.sum(x.continuous.padded_array, axis=(-1, -2)) n...
41
158
261
419
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,963
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/policies/designer_policy.py
77,78
40,126
suggest
DesignerPolicy
78,114
78,114
class DesignerPolicy(pythia.Policy): """Wraps a Designer into a pythia Policy. > IMPORTANT: If your Designer class is (partially) serializable, use > (Partially)SerializableDesignerPolicy instead. When a Designer cannot be (partially) serialized, we create a new Designer instance at the start of each `sugge...
class DesignerPolicy(pythia.Policy): """Wraps a Designer into a pythia Policy. > IMPORTANT: If your Designer class is (partially) serializable, use > (Partially)SerializableDesignerPolicy instead. When a Designer cannot be (partially) serialized, we create a new Designer instance at the start of each `sugge...
logging.info( 'Processing request for study guid %s, with max trial id %s', request.study_guid, request.max_trial_id, ) designer = self._designer_factory(request.study_config) logging.info( 'Study guid %s: Designer created. Getting trials from Vizier service.', re...
logging.info( 'Processing request for study guid %s, with max trial id %s', request.study_guid, request.max_trial_id, ) designer = self._designer_factory(request.study_config) logging.info( 'Study guid %s: Designer created. Getting trials from Vizier service.', re...
99
471
439
910
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,964
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/policies/designer_policy.py
351,352
347,364
_restore_designer
InRamDesignerPolicy
352,360
352,360
class InRamDesignerPolicy(_SerializableDesignerPolicyBase[vza.Designer]): """Wraps a Designer in RAM for efficient updates().""" # Override restore() to simply return the designer. def _restore_designer(self, designer_metadata: vz.Metadata) -> vza.Designer: FILL_FUNC_BODY def dump(self) -> vz.Metadata: retu...
class InRamDesignerPolicy(_SerializableDesignerPolicyBase[vza.Designer]): """Wraps a Designer in RAM for efficient updates().""" # Override restore() to simply return the designer. def _restore_designer(self, designer_metadata: vz.Metadata) -> vza.Designer: FILL_FUNC_BODY def dump(self) -> vz.Metadata: retu...
if self._designer is None: raise ValueError( '`self._designer` has not been initialized!' ' Call self._initialize_designer(..) first.' ) return self._designer # Override dump() since this is in ram.
if self._designer is None: raise ValueError( '`self._designer` has not been initialized!' ' Call self._initialize_designer(..) first.' ) return self._designer # Override dump() since this is in ram.
26
115
78
193
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,965
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/policies/designer_policy.py
369,372
364,377
_restore_designer
PartiallySerializableDesignerPolicy
372,377
372,377
class PartiallySerializableDesignerPolicy( _SerializableDesignerPolicyBase[vza.PartiallySerializableDesigner] ): """Wraps a PartiallySerializableDesigner.""" def _restore_designer( self, designer_metadata: vz.Metadata ) -> vza.PartiallySerializableDesigner: FILL_FUNC_BODY
class PartiallySerializableDesignerPolicy( _SerializableDesignerPolicyBase[vza.PartiallySerializableDesigner] ): """Wraps a PartiallySerializableDesigner.""" def _restore_designer( self, designer_metadata: vz.Metadata ) -> vza.PartiallySerializableDesigner: FILL_FUNC_BODY
designer = self._designer_factory(self._problem_statement) designer.load(designer_metadata) return designer
designer = self._designer_factory(self._problem_statement) designer.load(designer_metadata) return designer
6
93
39
132
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,966
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/policies/designer_policy.py
412,415
377,416
_restore_designer
SerializableDesignerPolicy
415,416
415,416
class SerializableDesignerPolicy( _SerializableDesignerPolicyBase[vza.SerializableDesigner] ): """Wraps a SerializableDesigner.""" def __init__( self, problem_statement: vz.ProblemStatement, supporter: pythia.PolicySupporter, designer_factory: vza.DesignerFactory[vza.SerializableDesigne...
class SerializableDesignerPolicy( _SerializableDesignerPolicyBase[vza.SerializableDesigner] ): """Wraps a SerializableDesigner.""" def __init__( self, problem_statement: vz.ProblemStatement, supporter: pythia.PolicySupporter, designer_factory: vza.DesignerFactory[vza.SerializableDesigne...
return self._designer_cls.recover(designer_metadata)
return self._designer_cls.recover(designer_metadata)
2
342
19
361
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,968
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/policies/random_policy.py
42,45
29,70
early_stop
RandomPolicy
46,70
45,70
class RandomPolicy(pythia.Policy): """A policy that picks random hyper-parameter values.""" def __init__(self, policy_supporter: pythia.PolicySupporter): self._policy_supporter = policy_supporter def suggest(self, request: pythia.SuggestRequest) -> pythia.SuggestDecision: """Gets number of Trials to pro...
class RandomPolicy(pythia.Policy): """A policy that picks random hyper-parameter values.""" def __init__(self, policy_supporter: pythia.PolicySupporter): self._policy_supporter = policy_supporter def suggest(self, request: pythia.SuggestRequest) -> pythia.SuggestDecision: """Gets number of Trials to pro...
decisions = [] all_active_trials = self._policy_supporter.GetTrials( study_guid=request.study_guid, status_matches=pyvizier.TrialStatus.ACTIVE, ) trial_to_stop_id = None if all_active_trials: trial_to_stop_id = random.choice(all_active_trials).id decisions.append( ...
"""Selects a random ACTIVE/PENDING trial to stop from datastore.""" decisions = [] all_active_trials = self._policy_supporter.GetTrials( study_guid=request.study_guid, status_matches=pyvizier.TrialStatus.ACTIVE, ) trial_to_stop_id = None if all_active_trials: trial_to_stop...
46
225
280
505
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,969
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/policies/trial_caches.py
80,81
32,136
get_newly_completed_trials
IdDeduplicatingTrialLoader
82,103
81,103
@attrs.define class IdDeduplicatingTrialLoader(serializable.PartiallySerializable): """Wrapper around PolicySupporter to avoid reloading completed trials. get_newly_completed_trials() only return the trials completed since the last call. get_active_trials() is just a convienence wrapper. """ # TODO: Stor...
@attrs.define class IdDeduplicatingTrialLoader(serializable.PartiallySerializable): """Wrapper around PolicySupporter to avoid reloading completed trials. get_newly_completed_trials() only return the trials completed since the last call. get_active_trials() is just a convienence wrapper. """ # TODO: Stor...
if len(self._incorporated_completed_trial_ids) == max_trial_id: # no trials need to be loaded. return [] all_trial_ids = set(range(1, max_trial_id + 1)) # Exclude completed trials that were already passed to the designer. trial_ids_to_load = all_trial_ids - self._incorporated_completed_trial...
"""Returns trials completed between the last call and max_trial_id.""" if len(self._incorporated_completed_trial_ids) == max_trial_id: # no trials need to be loaded. return [] all_trial_ids = set(range(1, max_trial_id + 1)) # Exclude completed trials that were already passed to the designer....
78
965
306
1,271
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,970
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/random/random_sample.py
79,80
1,127
get_closest_element
81,86
80,86
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
gaps = [abs(x - value) for x in array] closest_idx = min(enumerate(gaps), key=lambda x: x[1])[0] return array[closest_idx]
"""Finds closest element in array to value.""" gaps = [abs(x - value) for x in array] closest_idx = min(enumerate(gaps), key=lambda x: x[1])[0] return array[closest_idx]
17
1,302
58
1,360
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,971
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/algorithms/random/random_sample_test.py
104,105
27,128
test_sample_value_categorical
RandomSampleTest
105,110
105,110
class RandomSampleTest(parameterized.TestCase): def setUp(self): super(RandomSampleTest, self).setUp() self.rng = np.random.default_rng(0) @parameterized.named_parameters( dict(testcase_name='prob=0', value=0.2, target=0.0), dict(testcase_name='prob=1.0', value=-0.5, target=0.0), dict(te...
class RandomSampleTest(parameterized.TestCase): def setUp(self): super(RandomSampleTest, self).setUp() self.rng = np.random.default_rng(0) @parameterized.named_parameters( dict(testcase_name='prob=0', value=0.2, target=0.0), dict(testcase_name='prob=1.0', value=-0.5, target=0.0), dict(te...
categorical_param = vz.ParameterConfig.factory( 'categorical', feasible_values=['a', 'b', 'c']) value = random_sample._sample_value(self.rng, categorical_param) self.assertIn(value, ['a', 'b', 'c'])
categorical_param = vz.ParameterConfig.factory( 'categorical', feasible_values=['a', 'b', 'c']) value = random_sample._sample_value(self.rng, categorical_param) self.assertIn(value, ['a', 'b', 'c'])
15
1,630
81
1,711
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,973
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve.py
636,641
558,689
standardize_curves
ConvergenceComparator
656,689
641,689
@attr.define class ConvergenceComparator(abc.ABC): """Base class for convergence curve compartors. Attributes: baseline_curve: The baseline ConvergenceCurve. compared_curve: The compared ConvergenceCurve. baseline_quantile: Quantile in [0, 1] of the batched baseline curve to use for efficiency co...
@attr.define class ConvergenceComparator(abc.ABC): """Base class for convergence curve compartors. Attributes: baseline_curve: The baseline ConvergenceCurve. compared_curve: The compared ConvergenceCurve. baseline_quantile: Quantile in [0, 1] of the batched baseline curve to use for efficiency co...
# Align the curves while keeping each ys. align_baseline_curve, align_compared_curve = ConvergenceCurve.align_xs( [self._baseline_curve, self._compared_curve], interpolate_repeats=False, keep_curves_separate=True, ) # Adjust sign to increasing. baseline_ys = self._sign * alig...
"""Standardize convergence curves. 1. Align xs and keep each ys. 2. Convert curves to INCREASING. 3. Apply quantiles and impute NaN (optional). 4. Remove values where xs < xs_cutoff. Args: xs_cutoff: The xs value before which values are ignored. apply_quantiles: Whether to compute ...
132
1,050
546
1,596
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,975
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve.py
282,283
254,342
convert
ConvergenceCurveConverter
284,334
283,334
@attr.define class ConvergenceCurveConverter(StatefulCurveConverter): """Converter for Trial sequence to ConvergenceCurve. Attributes: metric_information: Information of relevant metric. flip_signs_for_min: If True, flips the signs of metric values to always maximize. Useful when desiring all i...
@attr.define class ConvergenceCurveConverter(StatefulCurveConverter): """Converter for Trial sequence to ConvergenceCurve. Attributes: metric_information: Information of relevant metric. flip_signs_for_min: If True, flips the signs of metric values to always maximize. Useful when desiring all i...
if not trials: raise ValueError(f'No trials provided {trials}') yvals = [self._best_yval] xvals = [self._cumulative_cost] candidates = [] for i in range(0, len(trials), self.batch_size): batch = trials[i : i + self.batch_size] for trial in batch: if self.measurements_type...
"""Returns ConvergenceCurve with a single curve.""" if not trials: raise ValueError(f'No trials provided {trials}') yvals = [self._best_yval] xvals = [self._cumulative_cost] candidates = [] for i in range(0, len(trials), self.batch_size): batch = trials[i : i + self.batch_size] ...
129
526
628
1,154
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,976
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve.py
391,392
342,462
convert
HypervolumeCurveConverter
393,462
392,462
class HypervolumeCurveConverter(StatefulCurveConverter): """Converts Trials to cumulative hypervolume curve for multiobjective.""" def __init__( self, metric_informations: Sequence[pyvizier.MetricInformation], *, reference_value: Optional[np.ndarray] = None, num_vectors: int = 10000, ...
class HypervolumeCurveConverter(StatefulCurveConverter): """Converts Trials to cumulative hypervolume curve for multiobjective.""" def __init__( self, metric_informations: Sequence[pyvizier.MetricInformation], *, reference_value: Optional[np.ndarray] = None, num_vectors: int = 10000, ...
# Returns a len(trials) x number of metrics np.ndarray. if not trials: raise ValueError(f'No trials provided {trials}') metrics = self._converter.to_labels_array(trials) if self._origin_value is None: # Set origin to the minimum of finite values. origin = np.zeros(shape=(metrics.shape...
"""Returns ConvergenceCurve with a curve of shape 1 x len(trials).""" # Returns a len(trials) x number of metrics np.ndarray. if not trials: raise ValueError(f'No trials provided {trials}') metrics = self._converter.to_labels_array(trials) if self._origin_value is None: # Set origin to ...
199
570
928
1,498
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,977
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve.py
772,773
703,826
score
LogEfficiencyConvergenceCurveComparator
783,826
773,826
@attr.define class LogEfficiencyConvergenceCurveComparator(ConvergenceComparator): """Comparator methods for ConvergenceCurves. Methods in this class generally return comparison metrics for a compared curve against a baseline curve. Only works for curves with INCREASING or DECREASING trend. Example usage: ...
@attr.define class LogEfficiencyConvergenceCurveComparator(ConvergenceComparator): """Comparator methods for ConvergenceCurves. Methods in this class generally return comparison metrics for a compared curve against a baseline curve. Only works for curves with INCREASING or DECREASING trend. Example usage: ...
baseline_curve = ConvergenceCurve.align_xs( [self._baseline_curve], interpolate_repeats=True )[0] compared_curve = ConvergenceCurve.align_xs( [self._compared_curve], interpolate_repeats=True )[0] # Combined curve (as the baseline) becomes the y-values at which # Trial efficiency ...
"""Gets a finalized log efficiency score. The compared curve should approximately use exp(-score)% Trials compared to the baseline curve. Note that a high positive score demonstrates that the compared curve uses less Trials and is better than the baseline. Returns: Sample efficiency score. T...
116
846
612
1,458
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,978
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve.py
502,503
462,514
convert
MultiMetricCurveConverter
504,514
503,514
@attr.define(init=True) class MultiMetricCurveConverter(StatefulCurveConverter): """Converts Trials to cumulative convergence curve for all multimetric studies. Attributes: metrics_config: Metrics config of the whole study. converter: Wrapped curve converter. """ metrics_config: pyvizier.MetricsCo...
@attr.define(init=True) class MultiMetricCurveConverter(StatefulCurveConverter): """Converts Trials to cumulative convergence curve for all multimetric studies. Attributes: metrics_config: Metrics config of the whole study. converter: Wrapped curve converter. """ metrics_config: pyvizier.MetricsCo...
if not trials: raise ValueError(f'No trials provided {trials}') # Add safety understanding by setting unsafe Trials to inf/-inf. safety_checker = multimetric.SafetyChecker(self.metrics_config) warped_trials = safety_checker.warp_unsafe_trials(copy.deepcopy(trials)) return self.converter.conv...
"""Returns ConvergenceCurve with a curve of shape 1 x len(trials).""" if not trials: raise ValueError(f'No trials provided {trials}') # Add safety understanding by setting unsafe Trials to inf/-inf. safety_checker = multimetric.SafetyChecker(self.metrics_config) warped_trials = safety_checker...
26
449
123
572
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,979
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve.py
979,980
968,990
score
OptimalityGapGainComparator
981,985
980,985
class OptimalityGapGainComparator(ConvergenceComparator): """Comparator method based on optimality gap gain. The optimality gap gain ('compared' - 'baseline') is normalized by the 'baseline' absolute optimality gap and then truncated. """ min_value: float = -0.5 max_value: float = 1.0 eps: float = 0.000...
class OptimalityGapGainComparator(ConvergenceComparator): """Comparator method based on optimality gap gain. The optimality gap gain ('compared' - 'baseline') is normalized by the 'baseline' absolute optimality gap and then truncated. """ min_value: float = -0.5 max_value: float = 1.0 eps: float = 0.000...
baseline_ys, compared_ys = self.standardize_curves() d = (compared_ys[-1] - baseline_ys[-1]) / (abs(baseline_ys[-1]) + self.eps) return min(max(d, self.min_value), self.max_value)
"""Computes the normalized simple regert score.""" baseline_ys, compared_ys = self.standardize_curves() d = (compared_ys[-1] - baseline_ys[-1]) / (abs(baseline_ys[-1]) + self.eps) return min(max(d, self.min_value), self.max_value)
17
184
79
263
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,980
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve.py
963,964
954,968
curve
OptimalityGapWinRateComparator
965,968
964,968
@attr.define class OptimalityGapWinRateComparator(ConvergenceComparator): """Comparator method based on win-rate of the optimality gap.""" def score(self): """Computes the normalized simple regert score.""" baseline_ys, compared_ys = self.standardize_curves() return float(compared_ys[-1] > baseline_ys[...
@attr.define class OptimalityGapWinRateComparator(ConvergenceComparator): """Comparator method based on win-rate of the optimality gap.""" def score(self): """Computes the normalized simple regert score.""" baseline_ys, compared_ys = self.standardize_curves() return float(compared_ys[-1] > baseline_ys[...
raise NotImplementedError('Curve not yet implemented.')
"""Returns a score curve for each xs.""" raise NotImplementedError('Curve not yet implemented.')
5
137
21
158
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,981
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve.py
878,879
826,907
score
PercentageBetterConvergenceCurveComparator
894,903
879,903
@attr.define class PercentageBetterConvergenceCurveComparator(ConvergenceComparator): """Comparator method based on percentage better. PercentageBetter is the average percentage of steps that one curve is better than the other. For example, assuming a study with 100 trials, a score of 0.07 means that on ave...
@attr.define class PercentageBetterConvergenceCurveComparator(ConvergenceComparator): """Comparator method based on percentage better. PercentageBetter is the average percentage of steps that one curve is better than the other. For example, assuming a study with 100 trials, a score of 0.07 means that on ave...
baseline_ys, compared_ys = self.standardize_curves(self._xs_cutoff) baseline_compared_score = self._compute_directional_score( baseline_ys, compared_ys ) compared_baseline_score = self._compute_directional_score( compared_ys, baseline_ys ) return baseline_compared_score - compare...
"""Computes the percentage better score. The score has two components: (a) sub-score quantifying how much 'compared' domniates 'baseline'. (b) sub-score quantifying how much 'baseline' domniates 'compared'. The final score is (a) - (b). Returns: The normalized percentage better converge...
20
765
111
876
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,982
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve.py
534,535
514,558
convert
RestartingCurveConverter
535,558
535,558
@attr.define(init=True) class RestartingCurveConverter(StatefulCurveConverter): """StatefulConverter that restarts the underlying stateful converters.""" converter_factory: Callable[[], StatefulCurveConverter] = attr.field() # The minimum number of Trials needed before restarts occur. restart_min_trials: int =...
@attr.define(init=True) class RestartingCurveConverter(StatefulCurveConverter): """StatefulConverter that restarts the underlying stateful converters.""" converter_factory: Callable[[], StatefulCurveConverter] = attr.field() # The minimum number of Trials needed before restarts occur. restart_min_trials: int =...
if self._converter is None: self._converter = self.converter_factory() if self._all_trials: self._converter.convert(self._all_trials) curve = self._converter.convert(trials) self._all_trials.extend(trials) if len(self._all_trials) < self.restart_min_trials: return curve #...
if self._converter is None: self._converter = self.converter_factory() if self._all_trials: self._converter.convert(self._all_trials) curve = self._converter.convert(trials) self._all_trials.extend(trials) if len(self._all_trials) < self.restart_min_trials: return curve #...
57
284
270
554
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,983
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve.py
928,929
907,954
curve
WinRateConvergenceCurveComparator
930,954
929,954
@attr.define class WinRateConvergenceCurveComparator(ConvergenceComparator): """Comparator method based on convergence curves simple win rate comparison. The comparator has two modes of comparing convergence curves: 1. Pairwise - Compare all pairs of repeated convergence curves and then compute the mean win...
@attr.define class WinRateConvergenceCurveComparator(ConvergenceComparator): """Comparator method based on convergence curves simple win rate comparison. The comparator has two modes of comparing convergence curves: 1. Pairwise - Compare all pairs of repeated convergence curves and then compute the mean win...
if self.comparison_mode == 'pairwise': baseline_ys, compared_ys = self.standardize_curves(apply_quantiles=False) # Compares all pairs of compared to baseline curve. all_comparisons = np.apply_along_axis( lambda base: np.mean(compared_ys > base, axis=0) + 0.5 * np.mean(base == c...
"""Computes the curve that represents the average win rate.""" if self.comparison_mode == 'pairwise': baseline_ys, compared_ys = self.standardize_curves(apply_quantiles=False) # Compares all pairs of compared to baseline curve. all_comparisons = np.apply_along_axis( lambda base: np.m...
100
271
390
661
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,985
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve_test.py
176,209
148,264
test_convert_with_batch_size
ConvergenceCurveConverterTest
209,219
209,219
class ConvergenceCurveConverterTest(parameterized.TestCase): @parameterized.named_parameters( ('maximize', pyvizier.ObjectiveMetricGoal.MAXIMIZE, [[2, 2, 3]]), ('minimize', pyvizier.ObjectiveMetricGoal.MINIMIZE, [[2, 1, 1]]), ) def test_convert_basic(self, goal, expected): trials = _gen_trials([2...
class ConvergenceCurveConverterTest(parameterized.TestCase): @parameterized.named_parameters( ('maximize', pyvizier.ObjectiveMetricGoal.MAXIMIZE, [[2, 2, 3]]), ('minimize', pyvizier.ObjectiveMetricGoal.MINIMIZE, [[2, 1, 1]]), ) def test_convert_basic(self, goal, expected): trials = _gen_trials([2...
trials = _gen_trials(values) generator = convergence.ConvergenceCurveConverter( pyvizier.MetricInformation(name='', goal=goal), flip_signs_for_min=False, batch_size=batch_size, ) curve = generator.convert(trials) np.testing.assert_array_equal(curve.xs, list(range(1, len(trial...
trials = _gen_trials(values) generator = convergence.ConvergenceCurveConverter( pyvizier.MetricInformation(name='', goal=goal), flip_signs_for_min=False, batch_size=batch_size, ) curve = generator.convert(trials) np.testing.assert_array_equal(curve.xs, list(range(1, len(trial...
21
1,515
146
1,661
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,986
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve_test.py
40,41
38,148
test_align_xs_merge_ys_on_different_lengths
ConvergenceCurveTest
41,58
41,58
class ConvergenceCurveTest(absltest.TestCase): def test_align_xs_merge_ys_on_different_lengths(self): FILL_FUNC_BODY def test_align_xs_merge_ys_on_distinct_xvalues(self): c1 = convergence.ConvergenceCurve( xs=np.array([1, 3, 4]), ys=np.array([[2, 1, 1]]), trend=convergence.ConvergenceCur...
class ConvergenceCurveTest(absltest.TestCase): def test_align_xs_merge_ys_on_different_lengths(self): FILL_FUNC_BODY def test_align_xs_merge_ys_on_distinct_xvalues(self): c1 = convergence.ConvergenceCurve( xs=np.array([1, 3, 4]), ys=np.array([[2, 1, 1]]), trend=convergence.ConvergenceCur...
c1 = convergence.ConvergenceCurve( xs=np.array([1, 2, 3]), ys=np.array([[2, 1, 1]]), trend=convergence.ConvergenceCurve.YTrend.DECREASING, ) c2 = convergence.ConvergenceCurve( xs=np.array([1]), ys=np.array([[3]]), trend=convergence.ConvergenceCurve.YTrend.DECR...
c1 = convergence.ConvergenceCurve( xs=np.array([1, 2, 3]), ys=np.array([[2, 1, 1]]), trend=convergence.ConvergenceCurve.YTrend.DECREASING, ) c2 = convergence.ConvergenceCurve( xs=np.array([1]), ys=np.array([[3]]), trend=convergence.ConvergenceCurve.YTrend.DECR...
35
1,429
255
1,684
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,988
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve_test.py
839,840
746,887
test_effiency_score_symmetry
LogEfficiencyConvergenceComparatorTest
840,848
840,848
class LogEfficiencyConvergenceComparatorTest(absltest.TestCase): def setUp(self): super(LogEfficiencyConvergenceComparatorTest, self).setUp() xs = np.array(range(0, 20)) xs_t = xs.reshape(1, len(xs)) self._baseline_curve = convergence.ConvergenceCurve( xs=xs, ys=np.exp(np.array([-0.9,...
class LogEfficiencyConvergenceComparatorTest(absltest.TestCase): def setUp(self): super(LogEfficiencyConvergenceComparatorTest, self).setUp() xs = np.array(range(0, 20)) xs_t = xs.reshape(1, len(xs)) self._baseline_curve = convergence.ConvergenceCurve( xs=xs, ys=np.exp(np.array([-0.9,...
base_score = convergence.LogEfficiencyConvergenceCurveComparator( baseline_curve=self._baseline_curve, compared_curve=self._better_curves ).score() reversed_score = convergence.LogEfficiencyConvergenceCurveComparator( baseline_curve=self._better_curves, compared_curve=self._baseline_curve ...
base_score = convergence.LogEfficiencyConvergenceCurveComparator( baseline_curve=self._baseline_curve, compared_curve=self._better_curves ).score() reversed_score = convergence.LogEfficiencyConvergenceCurveComparator( baseline_curve=self._better_curves, compared_curve=self._baseline_curve ...
15
1,850
141
1,991
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,989
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve_test.py
517,518
480,560
test_convert_multiobjective
MultiMetricCurveConverterTest
518,560
518,560
class MultiMetricCurveConverterTest(parameterized.TestCase): def test_convert_single_objective(self): generator = convergence.MultiMetricCurveConverter.from_metrics_config( metrics_config=pyvizier.MetricsConfig([ pyvizier.MetricInformation( name='min', goal=pyvizier.ObjectiveM...
class MultiMetricCurveConverterTest(parameterized.TestCase): def test_convert_single_objective(self): generator = convergence.MultiMetricCurveConverter.from_metrics_config( metrics_config=pyvizier.MetricsConfig([ pyvizier.MetricInformation( name='min', goal=pyvizier.ObjectiveM...
generator = convergence.MultiMetricCurveConverter.from_metrics_config( metrics_config=pyvizier.MetricsConfig([ pyvizier.MetricInformation( name='max', goal=pyvizier.ObjectiveMetricGoal.MAXIMIZE ), pyvizier.MetricInformation( name='min', goa...
generator = convergence.MultiMetricCurveConverter.from_metrics_config( metrics_config=pyvizier.MetricsConfig([ pyvizier.MetricInformation( name='max', goal=pyvizier.ObjectiveMetricGoal.MAXIMIZE ), pyvizier.MetricInformation( name='min', goa...
69
447
515
962
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,990
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve_test.py
960,987
958,995
test_score
OptimalityGapGainComparatorTest
987,995
987,995
class OptimalityGapGainComparatorTest(parameterized.TestCase): @parameterized.parameters( { 'ys1': np.array([[1, 4, 8, 10, 12]]), 'ys2': np.array([[2, 5, 6, 8, 10]]), 'trend': convergence.ConvergenceCurve.YTrend.INCREASING, 'res': (10 - 12) / 12, }, { ...
class OptimalityGapGainComparatorTest(parameterized.TestCase): @parameterized.parameters( { 'ys1': np.array([[1, 4, 8, 10, 12]]), 'ys2': np.array([[2, 5, 6, 8, 10]]), 'trend': convergence.ConvergenceCurve.YTrend.INCREASING, 'res': (10 - 12) / 12, }, { ...
xs1 = np.arange(ys1.shape[1]) xs2 = np.arange(ys2.shape[1]) curve1 = convergence.ConvergenceCurve(xs=xs1, ys=ys1, trend=trend) curve2 = convergence.ConvergenceCurve(xs=xs2, ys=ys2, trend=trend) comparator = convergence.OptimalityGapGainComparator(curve1, curve2) self.assertAlmostEqual(comparator...
xs1 = np.arange(ys1.shape[1]) xs2 = np.arange(ys2.shape[1]) curve1 = convergence.ConvergenceCurve(xs=xs1, ys=ys1, trend=trend) curve2 = convergence.ConvergenceCurve(xs=xs2, ys=ys2, trend=trend) comparator = convergence.OptimalityGapGainComparator(curve1, curve2) self.assertAlmostEqual(comparator...
23
452
155
607
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,991
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve_test.py
997,1024
995,1032
test_score
OptimalityGapWinRateComparatorTest
1024,1032
1024,1032
class OptimalityGapWinRateComparatorTest(parameterized.TestCase): @parameterized.parameters( { 'ys1': np.array([[1, 4, 8, 10, 12]]), 'ys2': np.array([[2, 5, 6, 8, 10]]), 'trend': convergence.ConvergenceCurve.YTrend.INCREASING, 'res': 0.0, }, { 'ys1'...
class OptimalityGapWinRateComparatorTest(parameterized.TestCase): @parameterized.parameters( { 'ys1': np.array([[1, 4, 8, 10, 12]]), 'ys2': np.array([[2, 5, 6, 8, 10]]), 'trend': convergence.ConvergenceCurve.YTrend.INCREASING, 'res': 0.0, }, { 'ys1'...
xs1 = np.arange(ys1.shape[1]) xs2 = np.arange(ys2.shape[1]) curve1 = convergence.ConvergenceCurve(xs=xs1, ys=ys1, trend=trend) curve2 = convergence.ConvergenceCurve(xs=xs2, ys=ys2, trend=trend) comparator = convergence.OptimalityGapWinRateComparator(curve1, curve2) self.assertEqual(comparator.sc...
xs1 = np.arange(ys1.shape[1]) xs2 = np.arange(ys2.shape[1]) curve1 = convergence.ConvergenceCurve(xs=xs1, ys=ys1, trend=trend) curve2 = convergence.ConvergenceCurve(xs=xs2, ys=ys2, trend=trend) comparator = convergence.OptimalityGapWinRateComparator(curve1, curve2) self.assertEqual(comparator.sc...
22
437
143
580
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,992
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve_test.py
926,944
924,958
test_score
PercentageBetterConvergenceComparatorTest
944,958
944,958
class PercentageBetterConvergenceComparatorTest(parameterized.TestCase): @parameterized.parameters( { 'ys1': np.array([[1, 2, 3, 4], [1, 2, 3, 4]]), 'ys2': np.array([[-1, 20, 30, 70]]), 'res': 0.5, }, { 'ys1': np.array([[1, 2, 3, 4]]), 'ys2': np.arr...
class PercentageBetterConvergenceComparatorTest(parameterized.TestCase): @parameterized.parameters( { 'ys1': np.array([[1, 2, 3, 4], [1, 2, 3, 4]]), 'ys2': np.array([[-1, 20, 30, 70]]), 'res': 0.5, }, { 'ys1': np.array([[1, 2, 3, 4]]), 'ys2': np.arr...
xs1 = np.arange(ys1.shape[1]) xs2 = np.arange(ys2.shape[1]) curve1 = convergence.ConvergenceCurve( xs=xs1, ys=ys1, trend=convergence.ConvergenceCurve.YTrend.INCREASING ) curve2 = convergence.ConvergenceCurve( xs=xs2, ys=ys2, trend=convergence.ConvergenceCurve.YTrend.INCREASING ) ...
xs1 = np.arange(ys1.shape[1]) xs2 = np.arange(ys2.shape[1]) curve1 = convergence.ConvergenceCurve( xs=xs1, ys=ys1, trend=convergence.ConvergenceCurve.YTrend.INCREASING ) curve2 = convergence.ConvergenceCurve( xs=xs2, ys=ys2, trend=convergence.ConvergenceCurve.YTrend.INCREASING ) ...
28
270
197
467
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,993
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve_test.py
618,619
560,674
test_convert_no_restart
RestartingCurveConverterTest
619,674
619,674
class RestartingCurveConverterTest(absltest.TestCase): def test_convert_with_restart(self): def converter_factory(): return convergence.HypervolumeCurveConverter( [ pyvizier.MetricInformation( name='max', goal=pyvizier.ObjectiveMetricGoal.MAXIMIZE ), ...
class RestartingCurveConverterTest(absltest.TestCase): def test_convert_with_restart(self): def converter_factory(): return convergence.HypervolumeCurveConverter( [ pyvizier.MetricInformation( name='max', goal=pyvizier.ObjectiveMetricGoal.MAXIMIZE ), ...
def converter_factory(): return convergence.HypervolumeCurveConverter( [ pyvizier.MetricInformation( name='max', goal=pyvizier.ObjectiveMetricGoal.MAXIMIZE ), pyvizier.MetricInformation( name='min', goal=pyvizier.Objective...
def converter_factory(): return convergence.HypervolumeCurveConverter( [ pyvizier.MetricInformation( name='max', goal=pyvizier.ObjectiveMetricGoal.MAXIMIZE ), pyvizier.MetricInformation( name='min', goal=pyvizier.Objective...
91
669
641
1,310
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,994
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve_test.py
679,680
674,746
setUp
WinRateConvergenceCurveComparatorAllComparisonsModeTest
680,700
680,700
class WinRateConvergenceCurveComparatorAllComparisonsModeTest( absltest.TestCase ): """Test the WinRateConvergenceCurveComparator with "all comparisons" mode.""" def setUp(self): FILL_FUNC_BODY def test_higher_quantile_curve(self): baseline_length = len(self._baseline_curve.xs) median_score = converge...
class WinRateConvergenceCurveComparatorAllComparisonsModeTest( absltest.TestCase ): """Test the WinRateConvergenceCurveComparator with "all comparisons" mode.""" def setUp(self): FILL_FUNC_BODY def test_higher_quantile_curve(self): baseline_length = len(self._baseline_curve.xs) median_score = converge...
super(WinRateConvergenceCurveComparatorAllComparisonsModeTest, self).setUp() xs = np.array(range(0, 20)) xs_t = xs.reshape(1, len(xs)) self._baseline_curve = convergence.ConvergenceCurve( xs=xs, ys=np.exp(np.array([-0.9, -1.0, -1.1]).reshape(3, 1) * xs_t), trend=convergence.Conve...
super(WinRateConvergenceCurveComparatorAllComparisonsModeTest, self).setUp() xs = np.array(range(0, 20)) xs_t = xs.reshape(1, len(xs)) self._baseline_curve = convergence.ConvergenceCurve( xs=xs, ys=np.exp(np.array([-0.9, -1.0, -1.1]).reshape(3, 1) * xs_t), trend=convergence.Conve...
43
667
340
1,007
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,995
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/convergence_curve_test.py
892,910
887,924
test_score_one_curve_above_other
WinRateConvergenceCurveComparatorQuantilesModeTest
910,924
910,924
class WinRateConvergenceCurveComparatorQuantilesModeTest( parameterized.TestCase ): """Tests for WinRateConvergenceCurveComparator with quantiles mode.""" @parameterized.parameters( { 'ys1': np.array([[11, 12, 20]]), 'ys2': np.array([[1, 2, 10]]), 'res': -0.5, }, ...
class WinRateConvergenceCurveComparatorQuantilesModeTest( parameterized.TestCase ): """Tests for WinRateConvergenceCurveComparator with quantiles mode.""" @parameterized.parameters( { 'ys1': np.array([[11, 12, 20]]), 'ys2': np.array([[1, 2, 10]]), 'res': -0.5, }, ...
xs1 = np.arange(ys1.shape[1]) xs2 = np.arange(ys2.shape[1]) curve1 = convergence.ConvergenceCurve( xs=xs1, ys=ys1, trend=convergence.ConvergenceCurve.YTrend.INCREASING ) curve2 = convergence.ConvergenceCurve( xs=xs2, ys=ys2, trend=convergence.ConvergenceCurve.YTrend.INCREASING ) ...
xs1 = np.arange(ys1.shape[1]) xs2 = np.arange(ys2.shape[1]) curve1 = convergence.ConvergenceCurve( xs=xs1, ys=ys1, trend=convergence.ConvergenceCurve.YTrend.INCREASING ) curve2 = convergence.ConvergenceCurve( xs=xs2, ys=ys2, trend=convergence.ConvergenceCurve.YTrend.INCREASING ) ...
29
278
203
481
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,997
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/exploration_score_utils_test.py
198,199
82,222
test_compute_average_marginal_parameter_entropy
ExplorationScoreUtilsTest
199,222
199,222
class ExplorationScoreUtilsTest(parameterized.TestCase): @parameterized.named_parameters( ('Continuous', vz.ParameterType.DOUBLE), ('Discrete', vz.ParameterType.DISCRETE), ('Integer', vz.ParameterType.INTEGER), ('Categorical', vz.ParameterType.CATEGORICAL), ) def test_compute_parameter_en...
class ExplorationScoreUtilsTest(parameterized.TestCase): @parameterized.named_parameters( ('Continuous', vz.ParameterType.DOUBLE), ('Discrete', vz.ParameterType.DISCRETE), ('Integer', vz.ParameterType.INTEGER), ('Categorical', vz.ParameterType.CATEGORICAL), ) def test_compute_parameter_en...
min_ent_study, max_ent_study = _generate_min_and_max_ent_studies() max_ent = ( exploration_score_utils.compute_average_marginal_parameter_entropy( {'spec_gen': {'hash_': {0: max_ent_study}}} ) ) min_ent = ( exploration_score_utils.compute_average_marginal_parameter_en...
min_ent_study, max_ent_study = _generate_min_and_max_ent_studies() max_ent = ( exploration_score_utils.compute_average_marginal_parameter_entropy( {'spec_gen': {'hash_': {0: max_ent_study}}} ) ) min_ent = ( exploration_score_utils.compute_average_marginal_parameter_en...
109
1,458
336
1,794
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,998
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/simple_regret_score_test.py
89,90
27,105
test_score_decreases_with_samples_two_sample
SimpleRegretScoreTest
90,105
90,105
class SimpleRegretScoreTest(parameterized.TestCase): # @parameterized.product( # create_problem=[ # create_continuous_problem, # create_categorical_problem, # create_mix_problem, # ], # n_features=list(range(10, 20)), # ) @parameterized.parameters( ...
class SimpleRegretScoreTest(parameterized.TestCase): # @parameterized.product( # create_problem=[ # create_continuous_problem, # create_categorical_problem, # create_mix_problem, # ], # n_features=list(range(10, 20)), # ) @parameterized.parameters( ...
goal = vz.ObjectiveMetricGoal.MAXIMIZE baseline_simple_regrets = np.ones(500) + 0.1 * np.random.normal(size=(500,)) candidate_simple_regrets = 1.2 * np.ones(200) p_value500 = simple_regret_score.t_test_mean_score( baseline_simple_regrets, candidate_simple_regrets, goal) baseline_simple_regr...
goal = vz.ObjectiveMetricGoal.MAXIMIZE baseline_simple_regrets = np.ones(500) + 0.1 * np.random.normal(size=(500,)) candidate_simple_regrets = 1.2 * np.ones(200) p_value500 = simple_regret_score.t_test_mean_score( baseline_simple_regrets, candidate_simple_regrets, goal) baseline_simple_regr...
51
715
272
987
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
46,999
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/analyzers/state_analyzer_test.py
86,87
27,183
test_record_conversion
StateAnalyzerTest
87,120
87,120
class StateAnalyzerTest(absltest.TestCase): def test_curve_conversion(self): dim = 10 experimenter = experimenters.BBOBExperimenterFactory('Sphere', dim)() def _designer_factory(config: vz.ProblemStatement, seed: int): return random.RandomDesigner(config.search_space, seed=seed) benchmark_sta...
class StateAnalyzerTest(absltest.TestCase): def test_curve_conversion(self): dim = 10 experimenter = experimenters.BBOBExperimenterFactory('Sphere', dim)() def _designer_factory(config: vz.ProblemStatement, seed: int): return random.RandomDesigner(config.search_space, seed=seed) benchmark_sta...
dim = 10 factory = experimenters.BBOBExperimenterFactory('Sphere', dim) experimenter = factory() def _designer_factory(config: vz.ProblemStatement, seed: int): return random.RandomDesigner(config.search_space, seed=seed) benchmark_state_factory = vzb.DesignerBenchmarkStateFactory( de...
dim = 10 factory = experimenters.BBOBExperimenterFactory('Sphere', dim) experimenter = factory() def _designer_factory(config: vz.ProblemStatement, seed: int): return random.RandomDesigner(config.search_space, seed=seed) benchmark_state_factory = vzb.DesignerBenchmarkStateFactory( de...
68
1,327
432
1,759
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,000
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/atari100k_experimenter_test.py
29,33
27,65
test_e2e_evaluation
Atari100KTest
33,65
33,65
class Atari100KTest(parameterized.TestCase): @absltest.skip("ALE ROMS must be installed manually.") @parameterized.parameters('DER', 'DrQ', 'DrQ_eps', 'OTRainbow') @absltest.skip('Jax versioning not updated in Dopamine.') def test_e2e_evaluation(self, agent_name): FILL_FUNC_BODY
class Atari100KTest(parameterized.TestCase): @absltest.skip("ALE ROMS must be installed manually.") @parameterized.parameters('DER', 'DrQ', 'DrQ_eps', 'OTRainbow') @absltest.skip('Jax versioning not updated in Dopamine.') def test_e2e_evaluation(self, agent_name): FILL_FUNC_BODY
from vizier._src.benchmarks.experimenters import atari100k_experimenter # pylint: disable=g-import-not-at-top initial_gin_bindings = { 'Runner.training_steps': 2, 'MaxEpisodeEvalRunner.num_eval_episodes': 2, 'Runner.num_iterations': 2, 'Runner.max_steps_per_episode': 2, ...
from vizier._src.benchmarks.experimenters import atari100k_experimenter # pylint: disable=g-import-not-at-top initial_gin_bindings = { 'Runner.training_steps': 2, 'MaxEpisodeEvalRunner.num_eval_episodes': 2, 'Runner.num_iterations': 2, 'Runner.max_steps_per_episode': 2, ...
71
110
441
551
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,001
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/combo/common.py
97,102
1,117
ising_dense
102,117
102,117
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
diff_horizontal = interaction_original[0] - interaction_sparsified[0] diff_vertical = interaction_original[1] - interaction_sparsified[1] kld = 0 n_spin = covariance.shape[0] for i in range(n_spin): i_h, i_v = int(i / ising_grid_h), int(i % ising_grid_h) for j in range(i, n_spin): j_h, j_v = in...
diff_horizontal = interaction_original[0] - interaction_sparsified[0] diff_vertical = interaction_original[1] - interaction_sparsified[1] kld = 0 n_spin = covariance.shape[0] for i in range(n_spin): i_h, i_v = int(i / ising_grid_h), int(i % ising_grid_h) for j in range(i, n_spin): j_h, j_v = in...
87
1,560
293
1,853
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,002
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/combo_experimenter_test.py
33,46
30,66
test_experimenters
ComboExperimenterTest
47,66
46,66
class ComboExperimenterTest(parameterized.TestCase): """Default lamda values found in README of https://github.com/QUVA-Lab/COMBO.""" @parameterized.named_parameters( ('contamination', functools.partial( combo_experimenter.ContaminationExperimenter, lamda=0.01), 20.0, 30.0), ...
class ComboExperimenterTest(parameterized.TestCase): """Default lamda values found in README of https://github.com/QUVA-Lab/COMBO.""" @parameterized.named_parameters( ('contamination', functools.partial( combo_experimenter.ContaminationExperimenter, lamda=0.01), 20.0, 30.0), ...
experimenter = experimenter_class() problem_statement = experimenter.problem_statement() logging.info(problem_statement) designer = random.RandomDesigner( search_space=problem_statement.search_space, seed=None) suggestions = designer.suggest(5) trials = [suggestion.to_trial() for sugge...
"""Tests if entire pipeline works and objective values make sense.""" experimenter = experimenter_class() problem_statement = experimenter.problem_statement() logging.info(problem_statement) designer = random.RandomDesigner( search_space=problem_statement.search_space, seed=None) sugge...
43
267
251
518
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,003
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/discretizing_experimenter.py
129,136
28,209
create_with_grid
DiscretizingExperimenter
155,209
136,209
class DiscretizingExperimenter(experimenter.Experimenter): """DiscretizingExperimenter discretizes the parameters of search space.""" def __init__( self, exptr: experimenter.Experimenter, discretization: Mapping[str, pyvizier.MonotypeParameterSequence], *, allow_oov: bool = False, )...
class DiscretizingExperimenter(experimenter.Experimenter): """DiscretizingExperimenter discretizes the parameters of search space.""" def __init__( self, exptr: experimenter.Experimenter, discretization: Mapping[str, pyvizier.MonotypeParameterSequence], *, allow_oov: bool = False, )...
if isinstance(convert_to_str, bool): convert_to_str = { k: convert_to_str for k in grid_discretization_count.keys() } if set(grid_discretization_count.keys()) != set(convert_to_str.keys()): raise ValueError( f'Grid discretization keys {grid_discretization_count.keys()} mus...
"""Creates Experimenter with continuous parameters discretized via grid. Note that the grid is generated according to ModelInputConverter scaling. Args: exptr: Experimenter with continuous parameters to be discretized. grid_discretization_count: Mapping from parameter names to number of ...
169
1,349
678
2,027
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,004
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/discretizing_experimenter_test.py
29,44
27,159
testNumpyExperimenter
DiscretizingExperimenterTest
44,84
44,84
class DiscretizingExperimenterTest(parameterized.TestCase): @parameterized.named_parameters( ('Sphere', bbob.Sphere), ('Rastrigin', bbob.Rastrigin), ('BuecheRastrigin', bbob.BuecheRastrigin), ('LinearSlope', bbob.LinearSlope), ('AttractiveSector', bbob.AttractiveSector), ('StepEllipsoid...
class DiscretizingExperimenterTest(parameterized.TestCase): @parameterized.named_parameters( ('Sphere', bbob.Sphere), ('Rastrigin', bbob.Rastrigin), ('BuecheRastrigin', bbob.BuecheRastrigin), ('LinearSlope', bbob.LinearSlope), ('AttractiveSector', bbob.AttractiveSector), ('StepEllipsoid...
dim = 3 exptr = numpy_experimenter.NumpyExperimenter( func, bbob.DefaultBBOBProblemStatement(dim)) # Asserts parameters are the same. parameters = list(exptr.problem_statement().search_space.parameters) self.assertLen(parameters, dim) discretization = { parameters[0].name: ['-1...
dim = 3 exptr = numpy_experimenter.NumpyExperimenter( func, bbob.DefaultBBOBProblemStatement(dim)) # Asserts parameters are the same. parameters = list(exptr.problem_statement().search_space.parameters) self.assertLen(parameters, dim) discretization = { parameters[0].name: ['-1...
79
1,248
495
1,743
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,005
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/experimenter_factory.py
101,103
70,107
recover
BBOBExperimenterFactory
103,107
103,107
@attr.define class BBOBExperimenterFactory(SerializableExperimenterFactory): """Factory for a BBOB function.""" # Should be a BBOB function name in bbob.py (name should match exactly). name: str = attr.field(default='', validator=attr.validators.instance_of(str)) dim: int = attr.field( default=1, v...
@attr.define class BBOBExperimenterFactory(SerializableExperimenterFactory): """Factory for a BBOB function.""" # Should be a BBOB function name in bbob.py (name should match exactly). name: str = attr.field(default='', validator=attr.validators.instance_of(str)) dim: int = attr.field( default=1, v...
metadata_dict = json.loads(metadata[BBOB_FACTORY_KEY]) return cls(**metadata_dict)
metadata_dict = json.loads(metadata[BBOB_FACTORY_KEY]) return cls(**metadata_dict)
5
438
40
478
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,006
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/experimenter_factory.py
220,224
107,248
recover
SingleObjectiveExperimenterFactory
224,248
224,248
@attr.define class SingleObjectiveExperimenterFactory(SerializableExperimenterFactory): """Factory for a single objective Experimenter. Attributes: base_factory: shift: An array of doubles that is broadcastable to dim of search space. should_restrict: Whether to restrict the parameter bounds of search ...
@attr.define class SingleObjectiveExperimenterFactory(SerializableExperimenterFactory): """Factory for a single objective Experimenter. Attributes: base_factory: shift: An array of doubles that is broadcastable to dim of search space. should_restrict: Whether to restrict the parameter bounds of search ...
if BBOB_FACTORY_KEY in metadata: base_factory = BBOBExperimenterFactory.recover(metadata) else: raise serializable.DecodeError( f'No valid base factory found in {metadata}' ) metadata_dict = json.loads( metadata[SINGLE_OBJECTIVE_FACTORY_KEY], cls=json_utils.NumpyDecoder ...
if BBOB_FACTORY_KEY in metadata: base_factory = BBOBExperimenterFactory.recover(metadata) else: raise serializable.DecodeError( f'No valid base factory found in {metadata}' ) metadata_dict = json.loads( metadata[SINGLE_OBJECTIVE_FACTORY_KEY], cls=json_utils.NumpyDecoder ...
67
1,407
293
1,700
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,009
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/infeasible_experimenter.py
41,42
30,62
evaluate
HashingInfeasibleExperimenter
42,52
42,52
@attrs.define class HashingInfeasibleExperimenter(experimenter.Experimenter): """Simulates randomly selected (deterministic) infeasibility function.""" exptr: experimenter.Experimenter = attrs.field() infeasible_prob: float = attrs.field(default=0.2, kw_only=True) seed: int = attrs.field(default=0, kw_only=Tru...
@attrs.define class HashingInfeasibleExperimenter(experimenter.Experimenter): """Simulates randomly selected (deterministic) infeasibility function.""" exptr: experimenter.Experimenter = attrs.field() infeasible_prob: float = attrs.field(default=0.2, kw_only=True) seed: int = attrs.field(default=0, kw_only=Tru...
metric_configs = self._problem.metric_information for suggestion in suggestions: if self._is_infeasible(suggestion.parameters): suggestion.complete( vz.Measurement(metrics={mc.name: np.nan for mc in metric_configs}), infeasibility_reason='HashingInfeasibleExperimenter', ...
metric_configs = self._problem.metric_information for suggestion in suggestions: if self._is_infeasible(suggestion.parameters): suggestion.complete( vz.Measurement(metrics={mc.name: np.nan for mc in metric_configs}), infeasibility_reason='HashingInfeasibleExperimenter', ...
20
292
122
414
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,010
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/infeasible_experimenter.py
82,83
62,99
evaluate
ParamRegionInfeasibleExperimenter
83,97
83,97
@attrs.define class ParamRegionInfeasibleExperimenter(experimenter.Experimenter): """Selects a parameter and splits its values into feasible/infeasible.""" exptr: experimenter.Experimenter = attrs.field() parameter_name: str = attrs.field() infeasible_interval: tuple[float, float] = attrs.field( default=...
@attrs.define class ParamRegionInfeasibleExperimenter(experimenter.Experimenter): """Selects a parameter and splits its values into feasible/infeasible.""" exptr: experimenter.Experimenter = attrs.field() parameter_name: str = attrs.field() infeasible_interval: tuple[float, float] = attrs.field( default=...
param_features = self._converter.convert(suggestions) metric_configs = self._problem.metric_information for sugg_index, param_feature in enumerate(param_features): p = param_feature.item() suggestion = suggestions[sugg_index] if self.infeasible_interval[0] <= p <= self.infeasible_interval...
param_features = self._converter.convert(suggestions) metric_configs = self._problem.metric_information for sugg_index, param_feature in enumerate(param_features): p = param_feature.item() suggestion = suggestions[sugg_index] if self.infeasible_interval[0] <= p <= self.infeasible_interval...
34
309
186
495
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,011
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/infeasible_experimenter_test.py
26,27
24,46
test_consistency
HashingInfeasibleExperimenterTest
27,46
27,46
class HashingInfeasibleExperimenterTest(absltest.TestCase): def test_consistency(self): FILL_FUNC_BODY
class HashingInfeasibleExperimenterTest(absltest.TestCase): def test_consistency(self): FILL_FUNC_BODY
exptr = numpy_experimenter.NumpyExperimenter( bbob.Sphere, bbob.DefaultBBOBProblemStatement(2) ) exptr = infeasible_experimenter.HashingInfeasibleExperimenter( exptr, infeasible_prob=0.5, seed=0 ) for i in range(10): trials = [vz.Trial(parameters={'x0': i, 'x1': -i}) for _ in ...
exptr = numpy_experimenter.NumpyExperimenter( bbob.Sphere, bbob.DefaultBBOBProblemStatement(2) ) exptr = infeasible_experimenter.HashingInfeasibleExperimenter( exptr, infeasible_prob=0.5, seed=0 ) for i in range(10): trials = [vz.Trial(parameters={'x0': i, 'x1': -i}) for _ in ...
48
40
264
304
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,012
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/infeasible_experimenter_test.py
48,49
46,64
test_e2e
ParamRegionInfeasibleExperimenterTest
49,64
49,64
class ParamRegionInfeasibleExperimenterTest(absltest.TestCase): def test_e2e(self): FILL_FUNC_BODY
class ParamRegionInfeasibleExperimenterTest(absltest.TestCase): def test_e2e(self): FILL_FUNC_BODY
exptr = numpy_experimenter.NumpyExperimenter( bbob.Sphere, bbob.DefaultBBOBProblemStatement(2) ) exptr = infeasible_experimenter.ParamRegionInfeasibleExperimenter( exptr, parameter_name='x0', infeasible_interval=(0.0, 0.5) ) infeasible_trial = vz.Trial(parameters={'x0': -3.5, 'x1': ...
exptr = numpy_experimenter.NumpyExperimenter( bbob.Sphere, bbob.DefaultBBOBProblemStatement(2) ) exptr = infeasible_experimenter.ParamRegionInfeasibleExperimenter( exptr, parameter_name='x0', infeasible_interval=(0.0, 0.5) ) infeasible_trial = vz.Trial(parameters={'x0': -3.5, 'x1': ...
30
42
243
285
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,013
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/l1_categorical_experimenter.py
93,94
32,96
problem_statement
L1CategorialExperimenter
95,96
94,96
class L1CategorialExperimenter(experimenter.Experimenter): """Categorical experimenter associated minimum optimization problem.""" def __init__( self, *, num_categories: Sequence[int], optimum: Optional[Sequence[int]] = None, seed: Optional[int] = None, verbose: bool = False, ...
class L1CategorialExperimenter(experimenter.Experimenter): """Categorical experimenter associated minimum optimization problem.""" def __init__( self, *, num_categories: Sequence[int], optimum: Optional[Sequence[int]] = None, seed: Optional[int] = None, verbose: bool = False, ...
return copy.deepcopy(self._problem)
"""See superclass.""" return copy.deepcopy(self._problem)
2
702
13
715
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,014
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/l1_categorical_experimenter_test.py
29,30
26,76
test_evaluate_optimum
L1CategoricalExperimenterTest
30,39
30,39
class L1CategoricalExperimenterTest(parameterized.TestCase): """Tests for CategoricalExperimenter.""" def test_evaluate_optimum(self): FILL_FUNC_BODY def test_evaluate_non_optimum(self): optimum = [0, 1] exptr = l1_categorical_experimenter.L1CategorialExperimenter( num_categories=[2, 2], optimum=o...
class L1CategoricalExperimenterTest(parameterized.TestCase): """Tests for CategoricalExperimenter.""" def test_evaluate_optimum(self): FILL_FUNC_BODY def test_evaluate_non_optimum(self): optimum = [0, 1] exptr = l1_categorical_experimenter.L1CategorialExperimenter( num_categories=[2, 2], optimum=o...
optimum = [0, 1] exptr = l1_categorical_experimenter.L1CategorialExperimenter( num_categories=[2, 2], optimum=optimum) suggestion = vz.Trial(parameters={'c0': '0', 'c1': '1'}) exptr.evaluate([suggestion]) self.assertEqual( suggestion.final_measurement_or_die.metrics['objective'].valu...
optimum = [0, 1] exptr = l1_categorical_experimenter.L1CategorialExperimenter( num_categories=[2, 2], optimum=optimum) suggestion = vz.Trial(parameters={'c0': '0', 'c1': '1'}) exptr.evaluate([suggestion]) self.assertEqual( suggestion.final_measurement_or_die.metrics['objective'].valu...
21
643
135
778
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,015
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/multiobjective_experimenter.py
78,79
27,101
evaluate
MultiObjectiveExperimenter
79,96
79,96
class MultiObjectiveExperimenter(experimenter.Experimenter): """MultiObjective Experimenter from a Dict of Experimenters.""" def __init__( self, exptrs: Dict[str, experimenter.Experimenter], ): """Creates a MultiObjectiveExperimenter from a Dict of Experimenters. Specifically, the Experiment...
class MultiObjectiveExperimenter(experimenter.Experimenter): """MultiObjective Experimenter from a Dict of Experimenters.""" def __init__( self, exptrs: Dict[str, experimenter.Experimenter], ): """Creates a MultiObjectiveExperimenter from a Dict of Experimenters. Specifically, the Experiment...
suggestions_copy = copy.deepcopy(suggestions) measurements = [pyvizier.Measurement() for _ in suggestions] for name, exptr in self._exptrs.items(): exptr.evaluate(suggestions_copy) previous_name = self._previous_names[name] for idx, copied in enumerate(suggestions_copy): measuremen...
suggestions_copy = copy.deepcopy(suggestions) measurements = [pyvizier.Measurement() for _ in suggestions] for name, exptr in self._exptrs.items(): exptr.evaluate(suggestions_copy) previous_name = self._previous_names[name] for idx, copied in enumerate(suggestions_copy): measuremen...
46
635
185
820
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,016
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/multiobjective_experimenter_test.py
61,62
26,74
test_dimension_mismatch
MultiobjectiveExperimenterTest
62,74
62,74
class MultiobjectiveExperimenterTest(absltest.TestCase): def test_mulitobjective_numpy(self): dim = 2 func1 = bbob.Sphere func2 = bbob.Rastrigin exptr1 = numpy_experimenter.NumpyExperimenter( func1, bbob.DefaultBBOBProblemStatement(dim) ) exptr2 = numpy_experimenter.NumpyExperimenter(...
class MultiobjectiveExperimenterTest(absltest.TestCase): def test_mulitobjective_numpy(self): dim = 2 func1 = bbob.Sphere func2 = bbob.Rastrigin exptr1 = numpy_experimenter.NumpyExperimenter( func1, bbob.DefaultBBOBProblemStatement(dim) ) exptr2 = numpy_experimenter.NumpyExperimenter(...
exptr1 = numpy_experimenter.NumpyExperimenter( bbob.Sphere, bbob.DefaultBBOBProblemStatement(dimension=3) ) exptr2 = numpy_experimenter.NumpyExperimenter( bbob.Rastrigin, bbob.DefaultBBOBProblemStatement(dimension=6) ) with self.assertRaisesRegex(ValueError, 'space must match'): ...
exptr1 = numpy_experimenter.NumpyExperimenter( bbob.Sphere, bbob.DefaultBBOBProblemStatement(dimension=3) ) exptr2 = numpy_experimenter.NumpyExperimenter( bbob.Rastrigin, bbob.DefaultBBOBProblemStatement(dimension=6) ) with self.assertRaisesRegex(ValueError, 'space must match'): ...
23
423
172
595
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,018
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/noisy_experimenter.py
58,59
28,74
evaluate
NoisyExperimenter
59,70
59,70
@attr.define(auto_attribs=True) class NoisyExperimenter(experimenter.Experimenter): """NoisyExperimenter applies noise to all metric(s) in final measurement. It stores the unnoised metric as metric_name + '_before_noise'. The noise function is a callable that is applied to metrics. """ exptr: experimenter.E...
@attr.define(auto_attribs=True) class NoisyExperimenter(experimenter.Experimenter): """NoisyExperimenter applies noise to all metric(s) in final measurement. It stores the unnoised metric as metric_name + '_before_noise'. The noise function is a callable that is applied to metrics. """ exptr: experimenter.E...
self.exptr.evaluate(suggestions) for suggestion in suggestions: if suggestion.final_measurement is None: continue metric_dict_with_noise = {} for name, metric in suggestion.final_measurement.metrics.items(): metric_dict_with_noise[name] = pyvizier.Metric( value=self...
self.exptr.evaluate(suggestions) for suggestion in suggestions: if suggestion.final_measurement is None: continue metric_dict_with_noise = {} for name, metric in suggestion.final_measurement.metrics.items(): metric_dict_with_noise[name] = pyvizier.Metric( value=self...
30
369
150
519
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,019
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/noisy_experimenter_test.py
72,85
30,155
testGaussianNoiseApply
NoisyExperimenterTest
85,113
85,113
class NoisyExperimenterTest(parameterized.TestCase): @parameterized.named_parameters( ('Sphere', bbob.Sphere), ('Rastrigin', bbob.Rastrigin), ('BuecheRastrigin', bbob.BuecheRastrigin), ('LinearSlope', bbob.LinearSlope), ('AttractiveSector', bbob.AttractiveSector), ('StepEllipsoidal', bb...
class NoisyExperimenterTest(parameterized.TestCase): @parameterized.named_parameters( ('Sphere', bbob.Sphere), ('Rastrigin', bbob.Rastrigin), ('BuecheRastrigin', bbob.BuecheRastrigin), ('LinearSlope', bbob.LinearSlope), ('AttractiveSector', bbob.AttractiveSector), ('StepEllipsoidal', bb...
dim = 2 exptr = numpy_experimenter.NumpyExperimenter( bbob.Sphere, bbob.DefaultBBOBProblemStatement(dim)) noisy_exptr = noisy_experimenter.NoisyExperimenter.from_type( exptr=exptr, noise_type=noise ) parameters = exptr.problem_statement().search_space.parameters t = pyvizier.Tri...
dim = 2 exptr = numpy_experimenter.NumpyExperimenter( bbob.Sphere, bbob.DefaultBBOBProblemStatement(dim)) noisy_exptr = noisy_experimenter.NoisyExperimenter.from_type( exptr=exptr, noise_type=noise ) parameters = exptr.problem_statement().search_space.parameters t = pyvizier.Tri...
67
1,477
415
1,892
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,020
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/normalizing_experimenter.py
85,86
28,102
evaluate
NormalizingExperimenter
86,97
86,97
class NormalizingExperimenter(experimenter.Experimenter): """Normalizes an Experimenter output via dividing by L1 norm at grid points.""" def __init__( self, exptr: experimenter.Experimenter, num_normalization_samples: int = 100, ): """Normalizing experimenter uses a grid to estimate a norm...
class NormalizingExperimenter(experimenter.Experimenter): """Normalizes an Experimenter output via dividing by L1 norm at grid points.""" def __init__( self, exptr: experimenter.Experimenter, num_normalization_samples: int = 100, ): """Normalizing experimenter uses a grid to estimate a norm...
self._exptr.evaluate(suggestions) for suggestion in suggestions: if suggestion.final_measurement is None: continue normalized_metrics: Dict[str, pyvizier.Metric] = {} for name, metric in suggestion.final_measurement.metrics.items(): normalized_metrics[name] = pyvizier.Metric( ...
self._exptr.evaluate(suggestions) for suggestion in suggestions: if suggestion.final_measurement is None: continue normalized_metrics: Dict[str, pyvizier.Metric] = {} for name, metric in suggestion.final_measurement.metrics.items(): normalized_metrics[name] = pyvizier.Metric( ...
30
708
140
848
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,021
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/normalizing_experimenter_test.py
28,50
26,75
testNormalizationApply
NormalizingExperimenterTest
50,75
50,75
class NormalizingExperimenterTest(parameterized.TestCase): @parameterized.named_parameters( ('Sphere', bbob.Sphere), ('Rastrigin', bbob.Rastrigin), ('BuecheRastrigin', bbob.BuecheRastrigin), ('LinearSlope', bbob.LinearSlope), ('AttractiveSector', bbob.AttractiveSector), ('StepElli...
class NormalizingExperimenterTest(parameterized.TestCase): @parameterized.named_parameters( ('Sphere', bbob.Sphere), ('Rastrigin', bbob.Rastrigin), ('BuecheRastrigin', bbob.BuecheRastrigin), ('LinearSlope', bbob.LinearSlope), ('AttractiveSector', bbob.AttractiveSector), ('StepElli...
dim = 5 exptr = numpy_experimenter.NumpyExperimenter( func, bbob.DefaultBBOBProblemStatement(dim) ) normalizing_exptr = normalizing_experimenter.NormalizingExperimenter( exptr=exptr ) parameters = exptr.problem_statement().search_space.parameters self.assertLen(parameters, d...
dim = 5 exptr = numpy_experimenter.NumpyExperimenter( func, bbob.DefaultBBOBProblemStatement(dim) ) normalizing_exptr = normalizing_experimenter.NormalizingExperimenter( exptr=exptr ) parameters = exptr.problem_statement().search_space.parameters self.assertLen(parameters, d...
43
407
266
673
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,022
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/numpy_experimenter.py
30,31
1,117
_get_name
32,40
31,40
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
if hasattr(f, '__name__'): return f.__name__ # Next clause handles functools.partial objects. if hasattr(f, 'func') and hasattr(f.func, '__name__'): return f.func.__name__ return repr(f)
"""Gets the name of underlying objects.""" if hasattr(f, '__name__'): return f.__name__ # Next clause handles functools.partial objects. if hasattr(f, 'func') and hasattr(f.func, '__name__'): return f.func.__name__ return repr(f)
21
1,088
86
1,174
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,023
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/numpy_experimenter.py
97,98
40,117
evaluate
NumpyExperimenter
98,115
98,115
class NumpyExperimenter(experimenter.Experimenter): """NumpyExperimenters take a deterministic function on ndarrays.""" def __init__( self, impl: Callable[[np.ndarray], float], problem_statement: pyvizier.ProblemStatement, ): """NumpyExperimenter with analytic function impl for one metric. ...
class NumpyExperimenter(experimenter.Experimenter): """NumpyExperimenters take a deterministic function on ndarrays.""" def __init__( self, impl: Callable[[np.ndarray], float], problem_statement: pyvizier.ProblemStatement, ): """NumpyExperimenter with analytic function impl for one metric. ...
# Features has shape (num_trials, num_features). features = self._converter.to_features(suggestions) for idx, suggestion in enumerate(suggestions): val = self.impl(features[idx]) if math.isfinite(val): suggestion.complete( pyvizier.Measurement(metrics={self._metric_name: val}...
# Features has shape (num_trials, num_features). features = self._converter.to_features(suggestions) for idx, suggestion in enumerate(suggestions): val = self.impl(features[idx]) if math.isfinite(val): suggestion.complete( pyvizier.Measurement(metrics={self._metric_name: val}...
38
646
188
834
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,024
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/numpy_experimenter_test.py
30,45
28,97
testNumpyExperimenter
NumpyExperimenterTest
45,64
45,64
class NumpyExperimenterTest(parameterized.TestCase): @parameterized.named_parameters( ('Sphere', bbob.Sphere), ('Rastrigin', bbob.Rastrigin), ('BuecheRastrigin', bbob.BuecheRastrigin), ('LinearSlope', bbob.LinearSlope), ('AttractiveSector', bbob.AttractiveSector), ('StepEllipsoidal', bb...
class NumpyExperimenterTest(parameterized.TestCase): @parameterized.named_parameters( ('Sphere', bbob.Sphere), ('Rastrigin', bbob.Rastrigin), ('BuecheRastrigin', bbob.BuecheRastrigin), ('LinearSlope', bbob.LinearSlope), ('AttractiveSector', bbob.AttractiveSector), ('StepEllipsoidal', bb...
dim = 2 exptr = numpy_experimenter.NumpyExperimenter( func, bbob.DefaultBBOBProblemStatement(dim)) parameters = exptr.problem_statement().search_space.parameters self.assertLen(parameters, dim) t = pyvizier.Trial(parameters={ param.name: float(index) for index, param in enumerate(p...
dim = 2 exptr = numpy_experimenter.NumpyExperimenter( func, bbob.DefaultBBOBProblemStatement(dim)) parameters = exptr.problem_statement().search_space.parameters self.assertLen(parameters, dim) t = pyvizier.Trial(parameters={ param.name: float(index) for index, param in enumerate(p...
35
747
235
982
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,025
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/permuting_experimenter.py
85,86
28,101
_permute
PermutingExperimenter
87,99
86,99
class PermutingExperimenter(experimenter.Experimenter): """PermutingExperimenter permutes discrete/categorical parameters.""" def __init__( self, exptr: experimenter.Experimenter, parameters_to_permute: Sequence[str], seed: int = 0, ): """PermutingExperiment permutes discrete paramete...
class PermutingExperimenter(experimenter.Experimenter): """PermutingExperimenter permutes discrete/categorical parameters.""" def __init__( self, exptr: experimenter.Experimenter, parameters_to_permute: Sequence[str], seed: int = 0, ): """PermutingExperiment permutes discrete paramete...
for suggestion in suggestions: new_parameters = {} for name, parameter in suggestion.parameters.items(): if name in self._parameter_permutation_dict: permutation_dict = self._parameter_permutation_dict[name] print('permutation dict', permutation_dict) logging.info('...
"""Permutes parameter values in place.""" for suggestion in suggestions: new_parameters = {} for name, parameter in suggestion.parameters.items(): if name in self._parameter_permutation_dict: permutation_dict = self._parameter_permutation_dict[name] print('permutation dic...
36
687
146
833
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,026
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/permuting_experimenter_test.py
30,52
28,99
testNumpyExperimenter
PermutingExperimenterTest
52,99
52,99
class PermutingExperimenterTest(parameterized.TestCase): @parameterized.named_parameters( ('Sphere', bbob.Sphere), ('Rastrigin', bbob.Rastrigin), ('BuecheRastrigin', bbob.BuecheRastrigin), ('LinearSlope', bbob.LinearSlope), ('AttractiveSector', bbob.AttractiveSector), ('StepEllips...
class PermutingExperimenterTest(parameterized.TestCase): @parameterized.named_parameters( ('Sphere', bbob.Sphere), ('Rastrigin', bbob.Rastrigin), ('BuecheRastrigin', bbob.BuecheRastrigin), ('LinearSlope', bbob.LinearSlope), ('AttractiveSector', bbob.AttractiveSector), ('StepEllips...
dim = 3 exptr = numpy_experimenter.NumpyExperimenter( func, bbob.DefaultBBOBProblemStatement(dim) ) # Asserts parameters are the same. parameters = list(exptr.problem_statement().search_space.parameters) self.assertLen(parameters, dim) discretization = { parameters[0].name:...
dim = 3 exptr = numpy_experimenter.NumpyExperimenter( func, bbob.DefaultBBOBProblemStatement(dim) ) # Asserts parameters are the same. parameters = list(exptr.problem_statement().search_space.parameters) self.assertLen(parameters, dim) discretization = { parameters[0].name:...
86
411
540
951
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,028
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/sign_flip_experimenter.py
55,56
23,70
evaluate
SignFlipExperimenter
56,70
56,70
class SignFlipExperimenter(experimenter_lib.Experimenter): """Flips the goal and objective values of the wrapped Experimenter.""" def __init__( self, experimenter: experimenter_lib.Experimenter, flip_objectives_only: bool = True, ): """Init. Args: experimenter: Original experimen...
class SignFlipExperimenter(experimenter_lib.Experimenter): """Flips the goal and objective values of the wrapped Experimenter.""" def __init__( self, experimenter: experimenter_lib.Experimenter, flip_objectives_only: bool = True, ): """Init. Args: experimenter: Original experimen...
self._experimenter.evaluate(suggestions) for suggestion in suggestions: if suggestion.final_measurement is None: continue metric_dict = {} for name, metric in suggestion.final_measurement.metrics.items(): if self._flip_objectives_only and name in self._original_objectives: ...
self._experimenter.evaluate(suggestions) for suggestion in suggestions: if suggestion.final_measurement is None: continue metric_dict = {} for name, metric in suggestion.final_measurement.metrics.items(): if self._flip_objectives_only and name in self._original_objectives: ...
44
379
198
577
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,029
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/sign_flip_experimenter_test.py
33,35
31,89
test_flipped_bbob
SignFlipExperimenterTest
35,89
35,89
class SignFlipExperimenterTest(parameterized.TestCase): @parameterized.parameters((True,), (False)) def test_flipped_bbob(self, flip_objectives_only: bool): FILL_FUNC_BODY
class SignFlipExperimenterTest(parameterized.TestCase): @parameterized.parameters((True,), (False)) def test_flipped_bbob(self, flip_objectives_only: bool): FILL_FUNC_BODY
exptr = numpy_experimenter.NumpyExperimenter( bbob.Sphere, bbob.DefaultBBOBProblemStatement(2) ) exptr = noisy_experimenter.NoisyExperimenter( exptr, noise_fn=lambda v: v - 1 ) flipped_exptr = sign_flip_experimenter.SignFlipExperimenter( exptr, flip_objectives_only ) ...
exptr = numpy_experimenter.NumpyExperimenter( bbob.Sphere, bbob.DefaultBBOBProblemStatement(2) ) exptr = noisy_experimenter.NoisyExperimenter( exptr, noise_fn=lambda v: v - 1 ) flipped_exptr = sign_flip_experimenter.SignFlipExperimenter( exptr, flip_objectives_only ) ...
76
62
606
668
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,030
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/sparse_experimenter.py
99,114
43,159
create
SparseExperimenter
133,159
114,159
class SparseExperimenter(experimenter.Experimenter): """Sparse experimenter. The sparse experimenter allows expanding an experimenter's search space with additional placeholder parameters that don't have affect during evaluation. """ def __init__( self, experiment: experimenter.Experimenter, ...
class SparseExperimenter(experimenter.Experimenter): """Sparse experimenter. The sparse experimenter allows expanding an experimenter's search space with additional placeholder parameters that don't have affect during evaluation. """ def __init__( self, experiment: experimenter.Experimenter, ...
sparse_search_space = vz.SearchSpace() for idx in range(float_count): sparse_search_space.root.add_float_param( name='FLOAT' + str(idx), min_value=float_min_value or _DEFAULT_FLOAT_BOUNDS[0], max_value=float_max_value or _DEFAULT_FLOAT_BOUNDS[1], ) for idx in range(...
"""Creates a sparse experimenter with different parameter types. Arguments: experiment: The experimenter to add sparsity to. float_count: The number of FLOAT sparse parameters to add. int_count: The number of INT sparse parameters to add. discrete_count: The number of DISCRETE sparse pa...
60
981
401
1,382
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,031
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/sparse_experimenter_test.py
67,81
28,124
test_sparse_experimenter_create
SparseExperimenterTest
81,124
81,124
class SparseExperimenterTest(parameterized.TestCase): @parameterized.parameters( vz.ParameterConfig.factory('_', bounds=(0.0, 5.0)), vz.ParameterConfig.factory('_', bounds=(0, 5)), vz.ParameterConfig.factory('_', feasible_values=[1, 2, 3]), vz.ParameterConfig.factory('_', feasible_values=['a'...
class SparseExperimenterTest(parameterized.TestCase): @parameterized.parameters( vz.ParameterConfig.factory('_', bounds=(0.0, 5.0)), vz.ParameterConfig.factory('_', bounds=(0, 5)), vz.ParameterConfig.factory('_', feasible_values=[1, 2, 3]), vz.ParameterConfig.factory('_', feasible_values=['a'...
sphere_experimenter = experimenter_factory.BBOBExperimenterFactory( name='Sphere', dim=2 )() experimenter = sparse_experimenter.SparseExperimenter.create( experiment=sphere_experimenter, float_count=float_count, int_count=int_count, discrete_count=discrete_count, ...
sphere_experimenter = experimenter_factory.BBOBExperimenterFactory( name='Sphere', dim=2 )() experimenter = sparse_experimenter.SparseExperimenter.create( experiment=sphere_experimenter, float_count=float_count, int_count=int_count, discrete_count=discrete_count, ...
125
731
593
1,324
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,032
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/switch_experimenter.py
62,63
26,83
problem_statement
SwitchExperimenter
63,83
63,83
@attrs.define class SwitchExperimenter(experimenter.Experimenter): """Creates conditional search space from multiple experimenters via a switch.""" experimenters: Sequence[experimenter.Experimenter] = attrs.field() _switch_param_name: str = attrs.field(default='switch') _metric_name: str = attrs.field(default...
@attrs.define class SwitchExperimenter(experimenter.Experimenter): """Creates conditional search space from multiple experimenters via a switch.""" experimenters: Sequence[experimenter.Experimenter] = attrs.field() _switch_param_name: str = attrs.field(default='switch') _metric_name: str = attrs.field(default...
problem_statement = vz.ProblemStatement() children = [] for i, problem in enumerate(self._exptr_problems): for pc in problem.search_space.parameters: children.append(([i], pc)) switching_param = vz.ParameterConfig.factory( self._switch_param_name, feasible_values=range(le...
problem_statement = vz.ProblemStatement() children = [] for i, problem in enumerate(self._exptr_problems): for pc in problem.search_space.parameters: children.append(([i], pc)) switching_param = vz.ParameterConfig.factory( self._switch_param_name, feasible_values=range(le...
33
449
208
657
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,033
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/switch_experimenter_test.py
26,27
24,44
test_switch_experimenter
SwitchExperimenterTest
27,44
27,44
class SwitchExperimenterTest(absltest.TestCase): def test_switch_experimenter(self): FILL_FUNC_BODY
class SwitchExperimenterTest(absltest.TestCase): def test_switch_experimenter(self): FILL_FUNC_BODY
exptr0 = numpy_experimenter.NumpyExperimenter( lambda x: 0.0 * x, bbob.DefaultBBOBProblemStatement(1, metric_name='0') ) exptr1 = numpy_experimenter.NumpyExperimenter( lambda x: 1.0 * x, bbob.DefaultBBOBProblemStatement(1, metric_name='1') ) switch_exptr = switch_experimenter.SwitchE...
exptr0 = numpy_experimenter.NumpyExperimenter( lambda x: 0.0 * x, bbob.DefaultBBOBProblemStatement(1, metric_name='0') ) exptr1 = numpy_experimenter.NumpyExperimenter( lambda x: 1.0 * x, bbob.DefaultBBOBProblemStatement(1, metric_name='1') ) switch_exptr = switch_experimenter.SwitchE...
48
38
316
354
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,034
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/synthetic/bbob_test.py
31,35
29,46
test_bbob_problem_statement_scale_type
BbobTest
35,39
35,39
class BbobTest(parameterized.TestCase): @parameterized.parameters( {'scale_type': vz.ScaleType.LINEAR}, {'scale_type': vz.ScaleType.LOG} ) def test_bbob_problem_statement_scale_type(self, scale_type): FILL_FUNC_BODY def test_rotation(self): rotation = bbob._R(5, sys.maxsize, 'A', b'XAFDAF', 3) rot...
class BbobTest(parameterized.TestCase): @parameterized.parameters( {'scale_type': vz.ScaleType.LINEAR}, {'scale_type': vz.ScaleType.LOG} ) def test_bbob_problem_statement_scale_type(self, scale_type): FILL_FUNC_BODY def test_rotation(self): rotation = bbob._R(5, sys.maxsize, 'A', b'XAFDAF', 3) rot...
problem = bbob.DefaultBBOBProblemStatement(10, scale_type=scale_type) for p in problem.search_space.parameters: self.assertEqual(p.scale_type, scale_type)
problem = bbob.DefaultBBOBProblemStatement(10, scale_type=scale_type) for p in problem.search_space.parameters: self.assertEqual(p.scale_type, scale_type)
10
209
61
270
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,035
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/synthetic/branin.py
26,27
1,70
_branin
38,51
27,51
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
a = 1 b = 5.1 / (4 * np.pi**2) c = 5 / np.pi r = 6 s = 10 t = 1 / (8 * np.pi) x1 = x[..., 0] x2 = x[..., 1] y = a * (x2 - b * x1**2 + c * x1 - r) ** 2 + s * (1 - t) * np.cos(x1) + s return y
"""Branin function. This function can accept batch shapes, although it is typed to return floats to conform to NumpyExperimenter API. Args: x: Shape (B*, 2) array. Returns: Shape (B*) array. """ a = 1 b = 5.1 / (4 * np.pi**2) c = 5 / np.pi r = 6 s = 10 t = 1 / (8 * np.pi) x1 = x[......
65
601
144
745
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,036
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/synthetic/branin.py
62,63
51,70
problem_statement
Branin2DExperimenter
63,70
63,70
class Branin2DExperimenter(experimenter.Experimenter): """2D minimization function. See https://www.sfu.ca/~ssurjano/branin.html.""" def __init__(self): self._impl = numpy_experimenter.NumpyExperimenter( _branin, self.problem_statement() ) def evaluate(self, suggestions: Sequence[vz.Trial]) -> N...
class Branin2DExperimenter(experimenter.Experimenter): """2D minimization function. See https://www.sfu.ca/~ssurjano/branin.html.""" def __init__(self): self._impl = numpy_experimenter.NumpyExperimenter( _branin, self.problem_statement() ) def evaluate(self, suggestions: Sequence[vz.Trial]) -> N...
problem = vz.ProblemStatement() problem.search_space.root.add_float_param("x1", -5, 10) problem.search_space.root.add_float_param("x2", 0, 15) problem.metric_information.append( vz.MetricInformation(name="value", goal=vz.ObjectiveMetricGoal.MINIMIZE) ) return problem
problem = vz.ProblemStatement() problem.search_space.root.add_float_param("x1", -5, 10) problem.search_space.root.add_float_param("x2", 0, 15) problem.metric_information.append( vz.MetricInformation(name="value", goal=vz.ObjectiveMetricGoal.MINIMIZE) ) return problem
15
159
118
277
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,037
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/synthetic/branin_test.py
27,28
25,51
test_branin_impl
Branin2DExperimenterTest
28,36
28,36
class Branin2DExperimenterTest(absltest.TestCase): def test_branin_impl(self): FILL_FUNC_BODY def test_experimenter_argmin(self): trial = vz.Trial(parameters={'x1': -np.pi, 'x2': 12.275}) branin.Branin2DExperimenter().evaluate([trial]) self.assertAlmostEqual( trial.final_measurement_or_die.metri...
class Branin2DExperimenterTest(absltest.TestCase): def test_branin_impl(self): FILL_FUNC_BODY def test_experimenter_argmin(self): trial = vz.Trial(parameters={'x1': -np.pi, 'x2': 12.275}) branin.Branin2DExperimenter().evaluate([trial]) self.assertAlmostEqual( trial.final_measurement_or_die.metri...
np.testing.assert_allclose( branin._branin( np.array([[-np.pi, 12.275], [np.pi, 2.275], [9.42478, 2.475]]) ), 0.397887, atol=1e-5, )
np.testing.assert_allclose( branin._branin( np.array([[-np.pi, 12.275], [np.pi, 2.275], [9.42478, 2.475]]) ), 0.397887, atol=1e-5, )
12
216
105
321
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,038
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/synthetic/hartmann.py
27,30
1,101
_hartmann
30,34
30,34
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# pylint:disable=invalid-name return -alpha @ np.exp(-np.sum(A * (x - P) ** 2, axis=1))
# pylint:disable=invalid-name return -alpha @ np.exp(-np.sum(A * (x - P) ** 2, axis=1))
13
1,227
47
1,274
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,039
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/synthetic/hartmann.py
49,50
34,59
problem_statement
HartmannExperimenter
50,59
50,59
class HartmannExperimenter(experimenter.Experimenter): """General Hartmann minimization function.""" # pylint:disable=invalid-name def __init__(self, alpha: np.ndarray, A: np.ndarray, P: np.ndarray): self._dimension = A.shape[-1] self._impl = numpy_experimenter.NumpyExperimenter( functools.parti...
class HartmannExperimenter(experimenter.Experimenter): """General Hartmann minimization function.""" # pylint:disable=invalid-name def __init__(self, alpha: np.ndarray, A: np.ndarray, P: np.ndarray): self._dimension = A.shape[-1] self._impl = numpy_experimenter.NumpyExperimenter( functools.parti...
problem = vz.ProblemStatement() for i in range(1, self._dimension + 1): problem.search_space.root.add_float_param(f"x{i}", 0, 1) problem.metric_information.append( vz.MetricInformation(name="value", goal=vz.ObjectiveMetricGoal.MINIMIZE) ) return problem
problem = vz.ProblemStatement() for i in range(1, self._dimension + 1): problem.search_space.root.add_float_param(f"x{i}", 0, 1) problem.metric_information.append( vz.MetricInformation(name="value", goal=vz.ObjectiveMetricGoal.MINIMIZE) ) return problem
19
201
115
316
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,040
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/synthetic/hartmann_test.py
28,29
26,47
test_experimenter_argmin
Hartmann3DExperimenterTest
29,41
29,41
class Hartmann3DExperimenterTest(absltest.TestCase): def test_experimenter_argmin(self): FILL_FUNC_BODY def test_experimenter(self): experimenter_testing.assert_evaluates_random_suggestions( self, hartmann.Hartmann3DExperimenter() )
class Hartmann3DExperimenterTest(absltest.TestCase): def test_experimenter_argmin(self): FILL_FUNC_BODY def test_experimenter(self): experimenter_testing.assert_evaluates_random_suggestions( self, hartmann.Hartmann3DExperimenter() )
trial = vz.Trial( parameters={ f'x{i+1}': x for i, x in enumerate([0.114614, 0.555649, 0.852547]) } ) hartmann.Hartmann3DExperimenter().evaluate([trial]) self.assertAlmostEqual( trial.final_measurement_or_die.metrics.get_value('value', np.nan), -3.86278, ...
trial = vz.Trial( parameters={ f'x{i+1}': x for i, x in enumerate([0.114614, 0.555649, 0.852547]) } ) hartmann.Hartmann3DExperimenter().evaluate([trial]) self.assertAlmostEqual( trial.final_measurement_or_die.metrics.get_value('value', np.nan), -3.86278, ...
22
92
159
251
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,041
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/synthetic/hartmann_test.py
49,50
47,71
test_experimenter_argmin
Hartmann6DExperimenterTest
50,65
50,65
class Hartmann6DExperimenterTest(absltest.TestCase): def test_experimenter_argmin(self): FILL_FUNC_BODY def test_experimenter(self): experimenter_testing.assert_evaluates_random_suggestions( self, hartmann.Hartmann6DExperimenter() )
class Hartmann6DExperimenterTest(absltest.TestCase): def test_experimenter_argmin(self): FILL_FUNC_BODY def test_experimenter(self): experimenter_testing.assert_evaluates_random_suggestions( self, hartmann.Hartmann6DExperimenter() )
trial = vz.Trial( parameters={ f'x{i+1}': x for i, x in enumerate( [0.20169, 0.150011, 0.476874, 0.275332, 0.311652, 0.6573] ) } ) hartmann.Hartmann6DExperimenter().evaluate([trial]) self.assertAlmostEqual( trial.final_measureme...
trial = vz.Trial( parameters={ f'x{i+1}': x for i, x in enumerate( [0.20169, 0.150011, 0.476874, 0.275332, 0.311652, 0.6573] ) } ) hartmann.Hartmann6DExperimenter().evaluate([trial]) self.assertAlmostEqual( trial.final_measureme...
27
92
197
289
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,043
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/synthetic/simplekd.py
207,209
88,230
optimal_objective
SimpleKDExperimenter
210,230
209,230
@attrs.define class SimpleKDExperimenter(experimenter.Experimenter): """Simple problem with arbitrary number of parameter of each type. SimpleKD is a carefully constructed function to trap an underexploring hillclimb algorithm to local optima. It is parameterized by "best_category", which optimization algorith...
@attrs.define class SimpleKDExperimenter(experimenter.Experimenter): """Simple problem with arbitrary number of parameter of each type. SimpleKD is a carefully constructed function to trap an underexploring hillclimb algorithm to local optima. It is parameterized by "best_category", which optimization algorith...
values = {} if self.best_category == 'corner': values['float'] = [-1.0 for _ in range(self.num_float_param)] values['int'] = [1 for _ in range(self.num_float_param)] values['discrete'] = [1 for _ in range(self.num_float_param)] values['categorical'] = ['corner'] if self.best_categor...
"""Computes the optimal objective value of a SimpleKD problem.""" values = {} if self.best_category == 'corner': values['float'] = [-1.0 for _ in range(self.num_float_param)] values['int'] = [1 for _ in range(self.num_float_param)] values['discrete'] = [1 for _ in range(self.num_float_para...
89
1,469
320
1,789
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,044
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/experimenters/synthetic/simplekd_test.py
86,94
27,122
test_optimal_relative_error
SimpleKDExperimenterTest
94,122
94,122
class SimpleKDExperimenterTest(parameterized.TestCase): @parameterized.product( best_category=['corner', 'center', 'mixed'], output_relative_error=[True, False], ) def test_sweep( self, best_category: simplekd.SimpleKDCategory, output_relative_error: bool, ) -> None: experimen...
class SimpleKDExperimenterTest(parameterized.TestCase): @parameterized.product( best_category=['corner', 'center', 'mixed'], output_relative_error=[True, False], ) def test_sweep( self, best_category: simplekd.SimpleKDCategory, output_relative_error: bool, ) -> None: experimen...
exptr_simple4d = simplekd.SimpleKDExperimenter( best_category, output_relative_error=True ) categorical_values = ['corner', 'center', 'mixed'] discrete_values = (1, 2, 5, 6, 8) integer_values = [1, 2, 3] continuous_values = np.linspace(-1, 1, 1001) opt_rel_error = np.nan for cat...
exptr_simple4d = simplekd.SimpleKDExperimenter( best_category, output_relative_error=True ) categorical_values = ['corner', 'center', 'mixed'] discrete_values = (1, 2, 5, 6, 8) integer_values = [1, 2, 3] continuous_values = np.linspace(-1, 1, 1001) opt_rel_error = np.nan for cat...
78
706
359
1,065
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,046
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/benchmarks/runners/benchmark_runner_test.py
45,75
43,194
test_benchmark_run
BaseRunnerTest
75,88
75,88
class BaseRunnerTest(parameterized.TestCase): @parameterized.parameters( { 'runner': benchmark_runner.BenchmarkRunner( benchmark_subroutines=[ benchmark_runner.GenerateSuggestions(), benchmark_runner.EvaluateActiveTrials(), ], ...
class BaseRunnerTest(parameterized.TestCase): @parameterized.parameters( { 'runner': benchmark_runner.BenchmarkRunner( benchmark_subroutines=[ benchmark_runner.GenerateSuggestions(), benchmark_runner.EvaluateActiveTrials(), ], ...
benchmark_state_factory = _get_designer_benchmark_state_factory() bench_state = benchmark_state_factory(seed=5) runner.run(bench_state) self.assertEmpty( bench_state.algorithm.supporter.GetTrials( status_matches=vz.TrialStatus.ACTIVE ) ) all_trials = bench_state.algor...
benchmark_state_factory = _get_designer_benchmark_state_factory() bench_state = benchmark_state_factory(seed=5) runner.run(bench_state) self.assertEmpty( bench_state.algorithm.supporter.GetTrials( status_matches=vz.TrialStatus.ACTIVE ) ) all_trials = bench_state.algor...
23
1,475
174
1,649
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
47,047
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier
/home/hieuvd/dung_repo/raw/stars_03/google_vizier/vizier/vizier/_src/jax/xla_pareto_test.py
43,44
26,62
test_get_pareto_rank
XlaParetoTest
44,49
44,49
class XlaParetoTest(absltest.TestCase): def test_get_pareto(self): ys = np.random.random([20000, 2]) is_frontier = xla_pareto.is_frontier(ys, num_shards=5) frontier = xla_pareto.get_frontier(ys, num_shards=5) # Two implementations should be consistent. self.assertEqual(frontier.shape[0], np.sum(...
class XlaParetoTest(absltest.TestCase): def test_get_pareto(self): ys = np.random.random([20000, 2]) is_frontier = xla_pareto.is_frontier(ys, num_shards=5) frontier = xla_pareto.get_frontier(ys, num_shards=5) # Two implementations should be consistent. self.assertEqual(frontier.shape[0], np.sum(...
ys = np.array([[6, 6], [4, 8], [2, 6], [3, 6], [1, 8], [7, 0], [4, 4], [9, 6], [5, 10], [8, 10]]) np.testing.assert_array_equal( xla_pareto.pareto_rank(ys), np.array([2, 2, 6, 5, 3, 2, 5, 0, 1, 0]))
ys = np.array([[6, 6], [4, 8], [2, 6], [3, 6], [1, 8], [7, 0], [4, 4], [9, 6], [5, 10], [8, 10]]) np.testing.assert_array_equal( xla_pareto.pareto_rank(ys), np.array([2, 2, 6, 5, 3, 2, 5, 0, 1, 0]))
34
399
140
539
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# Copyright 2024 Google LLC. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...