MCPcopy Index your code
hub / github.com/bayesian-optimization/BayesianOptimization / ScreenLogger

Class ScreenLogger

bayes_opt/logger.py:16–293  ·  view source on GitHub ↗

Logger that outputs text, e.g. to log to a terminal. Parameters ---------- verbose : int Verbosity level of the logger. is_constrained : bool Whether the logger is associated with a constrained optimization instance.

Source from the content-addressed store, hash-verified

14
15
16class ScreenLogger:
17 """Logger that outputs text, e.g. to log to a terminal.
18
19 Parameters
20 ----------
21 verbose : int
22 Verbosity level of the logger.
23
24 is_constrained : bool
25 Whether the logger is associated with a constrained optimization
26 instance.
27 """
28
29 _default_cell_size = 9
30 _default_precision = 4
31 _color_new_max = Fore.MAGENTA
32 _color_regular_message = Fore.RESET
33 _color_reset = Fore.RESET
34
35 def __init__(self, verbose: int = 2, is_constrained: bool = False) -> None:
36 self._verbose = verbose
37 self._is_constrained = is_constrained
38 self._header_length = None
39 self._iterations = 0
40 self._previous_max = None
41 self._previous_max_params = None
42 self._start_time = None
43 self._previous_time = None
44
45 @property
46 def verbose(self) -> int:
47 """Return the verbosity level."""
48 return self._verbose
49
50 @verbose.setter
51 def verbose(self, v: int) -> None:
52 """Set the verbosity level.
53
54 Parameters
55 ----------
56 v : int
57 New verbosity level of the logger.
58 """
59 self._verbose = v
60
61 @property
62 def is_constrained(self) -> bool:
63 """Return whether the logger is constrained."""
64 return self._is_constrained
65
66 def _format_number(self, x: float) -> str:
67 """Format a number.
68
69 Parameters
70 ----------
71 x : number
72 Value to format.
73

Callers 14

test_initializationFunction · 0.90
test_verbose_propertyFunction · 0.90
test_format_numberFunction · 0.90
test_format_boolFunction · 0.90
test_format_strFunction · 0.90
test_stepFunction · 0.90
test_print_headerFunction · 0.90
test_is_new_maxFunction · 0.90
test_update_trackerFunction · 0.90

Calls

no outgoing calls

Tested by 13

test_initializationFunction · 0.72
test_verbose_propertyFunction · 0.72
test_format_numberFunction · 0.72
test_format_boolFunction · 0.72
test_format_strFunction · 0.72
test_stepFunction · 0.72
test_print_headerFunction · 0.72
test_is_new_maxFunction · 0.72
test_update_trackerFunction · 0.72