Skip to content

Commit

Permalink
modular metric allow pass through of args, not just kwargs, makes som…
Browse files Browse the repository at this point in the history
…e metric funcs easier
  • Loading branch information
madeline-scyphers committed Sep 5, 2023
1 parent 16b959f commit c67cf30
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion boa/metrics/modular_metric.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,8 @@ def fetch_trial_data(self, trial: Trial, **kwargs):

def _evaluate(self, params: TParameterization, **kwargs) -> float:
kwargs.update(params.pop("kwargs"))
return self.f(**get_dictionary_from_callable(self.metric_to_eval, kwargs))
args = kwargs.pop("wrapper_args", [])
return self.f(*args, **get_dictionary_from_callable(self.metric_to_eval, kwargs))

def f(self, *args, **kwargs):
if self.metric_func_kwargs: # always pass the metric_func_kwargs, don't fail silently
Expand Down

4 comments on commit c67cf30

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
__main__.py90495%133, 167, 212, 220
ax_instantiation_utils.py47197%123
controller.py74297%74, 169
definitions.py80100% 
instantiation_base.py40197%39
metaclasses.py72395%50–51, 57
plot.py12120%15, 17–18, 20–21, 24, 27, 34, 40–41, 44–45
plotting.py1412880%51–52, 59, 94–95, 251–253, 301–305, 345, 429–432, 434–441, 443, 448
registry.py80100% 
runner.py45491%42, 76–78
scheduler.py621477%33, 104–107, 114–115, 129, 136–137, 144–145, 240–241
storage.py1131685%79, 82, 114–116, 166, 184, 261–269
template.py200100% 
utils.py902077%175, 189–190, 215, 225–229, 231–233, 235, 237, 241–246
config
   __main__.py00100% 
   config.py2882989%207, 213, 269, 392, 395, 403–404, 412, 585, 587, 589, 595–599, 601, 671, 704, 725, 732–733, 741, 754, 764–765, 777, 802, 805
   converters.py751382%14, 22, 25, 41, 46–48, 51–52, 65, 67, 71, 79
metrics
   metric_funcs.py34488%58, 80–81, 83
   metrics.py991386%127, 304–305, 312, 318, 329–331, 335–339
   modular_metric.py1202083%38–41, 43–50, 64, 131, 142, 184, 235–236, 255–256
   synthetic_funcs.py39489%31, 35, 58, 65
scripts
   moo.py30196%44
   run_branin.py34197%56
   script_wrappers.py31293%57–58
   synth_func_cli.py210100% 
wrappers
   base_wrapper.py1952686%62–63, 88–91, 93, 101, 109, 114, 146, 155, 214–215, 217, 268, 329, 402, 416, 589, 591–594, 602, 612
   script_wrapper.py83890%191, 202–203, 270, 313, 319, 324, 329
   wrapper_utils.py132993%147–148, 228, 277, 385–387, 395–396
TOTAL200323588% 

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
__main__.py90495%133, 167, 212, 220
ax_instantiation_utils.py47197%123
controller.py74297%74, 169
definitions.py80100% 
instantiation_base.py40197%39
metaclasses.py72395%50–51, 57
plot.py12120%15, 17–18, 20–21, 24, 27, 34, 40–41, 44–45
plotting.py1412880%51–52, 59, 94–95, 251–253, 301–305, 345, 429–432, 434–441, 443, 448
registry.py80100% 
runner.py45491%42, 76–78
scheduler.py621477%33, 104–107, 114–115, 129, 136–137, 144–145, 240–241
storage.py1131685%79, 82, 114–116, 166, 184, 261–269
template.py200100% 
utils.py902077%175, 189–190, 215, 225–229, 231–233, 235, 237, 241–246
config
   __main__.py00100% 
   config.py2882989%207, 213, 269, 392, 395, 403–404, 412, 585, 587, 589, 595–599, 601, 671, 704, 725, 732–733, 741, 754, 764–765, 777, 802, 805
   converters.py751382%14, 22, 25, 41, 46–48, 51–52, 65, 67, 71, 79
metrics
   metric_funcs.py34488%58, 80–81, 83
   metrics.py991386%127, 304–305, 312, 318, 329–331, 335–339
   modular_metric.py1202083%38–41, 43–50, 64, 131, 142, 184, 235–236, 255–256
   synthetic_funcs.py39489%31, 35, 58, 65
scripts
   moo.py30196%44
   run_branin.py34197%56
   script_wrappers.py31293%57–58
   synth_func_cli.py210100% 
wrappers
   base_wrapper.py1952686%62–63, 88–91, 93, 101, 109, 114, 146, 155, 214–215, 217, 268, 329, 402, 416, 589, 591–594, 602, 612
   script_wrapper.py83890%191, 202–203, 270, 313, 319, 324, 329
   wrapper_utils.py132993%147–148, 228, 277, 385–387, 395–396
TOTAL200323588% 

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
__main__.py90495%133, 167, 212, 220
ax_instantiation_utils.py47197%123
controller.py74297%74, 169
definitions.py80100% 
instantiation_base.py40197%39
metaclasses.py72395%50–51, 57
plot.py12120%15, 17–18, 20–21, 24, 27, 34, 40–41, 44–45
plotting.py1412880%51–52, 59, 94–95, 251–253, 301–305, 345, 429–432, 434–441, 443, 448
registry.py80100% 
runner.py45491%42, 76–78
scheduler.py621477%33, 104–107, 114–115, 129, 136–137, 144–145, 240–241
storage.py1131685%79, 82, 114–116, 166, 184, 261–269
template.py200100% 
utils.py902077%175, 189–190, 215, 225–229, 231–233, 235, 237, 241–246
config
   __main__.py00100% 
   config.py2882989%207, 213, 269, 392, 395, 403–404, 412, 585, 587, 589, 595–599, 601, 671, 704, 725, 732–733, 741, 754, 764–765, 777, 802, 805
   converters.py751382%14, 22, 25, 41, 46–48, 51–52, 65, 67, 71, 79
metrics
   metric_funcs.py34488%58, 80–81, 83
   metrics.py991386%127, 304–305, 312, 318, 329–331, 335–339
   modular_metric.py1202083%38–41, 43–50, 64, 131, 142, 184, 235–236, 255–256
   synthetic_funcs.py39489%31, 35, 58, 65
scripts
   moo.py30196%44
   run_branin.py34197%56
   script_wrappers.py31293%57–58
   synth_func_cli.py210100% 
wrappers
   base_wrapper.py1952686%62–63, 88–91, 93, 101, 109, 114, 146, 155, 214–215, 217, 268, 329, 402, 416, 589, 591–594, 602, 612
   script_wrapper.py83890%191, 202–203, 270, 313, 319, 324, 329
   wrapper_utils.py132993%147–148, 228, 277, 385–387, 395–396
TOTAL200323588% 

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
__main__.py90495%133, 167, 212, 220
ax_instantiation_utils.py47197%123
controller.py74297%74, 169
definitions.py80100% 
instantiation_base.py40197%39
metaclasses.py72395%50–51, 57
plot.py12120%15, 17–18, 20–21, 24, 27, 34, 40–41, 44–45
plotting.py1412880%51–52, 59, 94–95, 251–253, 301–305, 345, 429–432, 434–441, 443, 448
registry.py80100% 
runner.py45491%42, 76–78
scheduler.py621477%33, 104–107, 114–115, 129, 136–137, 144–145, 240–241
storage.py1131685%79, 82, 114–116, 166, 184, 261–269
template.py200100% 
utils.py902077%175, 189–190, 215, 225–229, 231–233, 235, 237, 241–246
config
   __main__.py00100% 
   config.py2882989%207, 213, 269, 392, 395, 403–404, 412, 585, 587, 589, 595–599, 601, 671, 704, 725, 732–733, 741, 754, 764–765, 777, 802, 805
   converters.py751382%14, 22, 25, 41, 46–48, 51–52, 65, 67, 71, 79
metrics
   metric_funcs.py34488%58, 80–81, 83
   metrics.py991386%127, 304–305, 312, 318, 329–331, 335–339
   modular_metric.py1202083%38–41, 43–50, 64, 131, 142, 184, 235–236, 255–256
   synthetic_funcs.py39489%31, 35, 58, 65
scripts
   moo.py30196%44
   run_branin.py34197%56
   script_wrappers.py31293%57–58
   synth_func_cli.py210100% 
wrappers
   base_wrapper.py1952686%62–63, 88–91, 93, 101, 109, 114, 146, 155, 214–215, 217, 268, 329, 402, 416, 589, 591–594, 602, 612
   script_wrapper.py83890%191, 202–203, 270, 313, 319, 324, 329
   wrapper_utils.py132993%147–148, 228, 277, 385–387, 395–396
TOTAL200323588% 

Please sign in to comment.