|
@@ -38,7 +38,7 @@ if (sys.version_info.major == 3) & (sys.version_info.minor >= 8):
|
|
else:
|
|
else:
|
|
# from typing_extensions import *
|
|
# from typing_extensions import *
|
|
from typing_extensions import Callable, Optional,\
|
|
from typing_extensions import Callable, Optional,\
|
|
- Literal, Union
|
|
|
|
|
|
+ Literal
|
|
|
|
|
|
from cdplib.log import Log
|
|
from cdplib.log import Log
|
|
|
|
|
|
@@ -61,7 +61,8 @@ class HyperoptPipelineSelector(PipelineSelector):
|
|
a better pipeline was found.
|
|
a better pipeline was found.
|
|
"""
|
|
"""
|
|
def __init__(self,
|
|
def __init__(self,
|
|
- cost_func: Union[Callable, str],
|
|
|
|
|
|
+ # cost_func: Union[Callable, str],
|
|
|
|
+ cost_func,
|
|
greater_is_better: bool,
|
|
greater_is_better: bool,
|
|
trials_path: str,
|
|
trials_path: str,
|
|
backup_trials_freq: Optional[int] = None,
|
|
backup_trials_freq: Optional[int] = None,
|
|
@@ -180,7 +181,7 @@ class HyperoptPipelineSelector(PipelineSelector):
|
|
self._logger.log_and_raise_error(err)
|
|
self._logger.log_and_raise_error(err)
|
|
|
|
|
|
@property
|
|
@property
|
|
- def number_of_trials(self) -> Union[int, None]:
|
|
|
|
|
|
+ def number_of_trials(self):# -> Union[int, None]:
|
|
"""
|
|
"""
|
|
:return: number of trials run so far
|
|
:return: number of trials run so far
|
|
with the given Trials object
|
|
with the given Trials object
|
|
@@ -251,7 +252,7 @@ class HyperoptPipelineSelector(PipelineSelector):
|
|
|
|
|
|
self._logger.log_and_raise_error(err)
|
|
self._logger.log_and_raise_error(err)
|
|
|
|
|
|
- def _get_pipeline_from_index(self, i: int) -> Union[Pipeline, None]:
|
|
|
|
|
|
+ def _get_pipeline_from_index(self, i: int):# -> Union[Pipeline, None]:
|
|
"""
|
|
"""
|
|
Gets a pipeline with set parameters from the trial number i
|
|
Gets a pipeline with set parameters from the trial number i
|
|
"""
|
|
"""
|
|
@@ -267,7 +268,7 @@ class HyperoptPipelineSelector(PipelineSelector):
|
|
self._logger.log_and_raise_error(err)
|
|
self._logger.log_and_raise_error(err)
|
|
|
|
|
|
@property
|
|
@property
|
|
- def best_trial(self) -> Union[dict, None]:
|
|
|
|
|
|
+ def best_trial(self):# -> Union[dict, None]:
|
|
"""
|
|
"""
|
|
:return: dictionary with the summary of the best trial
|
|
:return: dictionary with the summary of the best trial
|
|
and space element (name, pipeline, params)
|
|
and space element (name, pipeline, params)
|
|
@@ -308,7 +309,7 @@ class HyperoptPipelineSelector(PipelineSelector):
|
|
self._logger.log_and_raise_error(err)
|
|
self._logger.log_and_raise_error(err)
|
|
|
|
|
|
@property
|
|
@property
|
|
- def best_trial_score(self) -> Union[float, None]:
|
|
|
|
|
|
+ def best_trial_score(self):# -> Union[float, None]:
|
|
"""
|
|
"""
|
|
"""
|
|
"""
|
|
try:
|
|
try:
|
|
@@ -324,7 +325,7 @@ class HyperoptPipelineSelector(PipelineSelector):
|
|
self._logger.log_and_raise_error(err)
|
|
self._logger.log_and_raise_error(err)
|
|
|
|
|
|
@property
|
|
@property
|
|
- def best_trial_score_variance(self) -> Union[float, None]:
|
|
|
|
|
|
+ def best_trial_score_variance(self):# -> Union[float, None]:
|
|
"""
|
|
"""
|
|
"""
|
|
"""
|
|
try:
|
|
try:
|
|
@@ -340,7 +341,7 @@ class HyperoptPipelineSelector(PipelineSelector):
|
|
self._logger.log_and_raise_error(err)
|
|
self._logger.log_and_raise_error(err)
|
|
|
|
|
|
@property
|
|
@property
|
|
- def best_trial_pipeline(self) -> Union[Pipeline, None]:
|
|
|
|
|
|
+ def best_trial_pipeline(self):# -> Union[Pipeline, None]:
|
|
"""
|
|
"""
|
|
"""
|
|
"""
|
|
try:
|
|
try:
|
|
@@ -376,8 +377,8 @@ class HyperoptPipelineSelector(PipelineSelector):
|
|
|
|
|
|
self._logger.log_and_raise_error(err)
|
|
self._logger.log_and_raise_error(err)
|
|
|
|
|
|
- def get_n_best_trial_pipelines(self, n: int)\
|
|
|
|
- -> Union[List[Pipeline], None]:
|
|
|
|
|
|
+ def get_n_best_trial_pipelines(self, n: int):#\
|
|
|
|
+ # -> Union[List[Pipeline], None]:
|
|
"""
|
|
"""
|
|
:return: the list of n best pipelines
|
|
:return: the list of n best pipelines
|
|
documented in trials
|
|
documented in trials
|