fix formatting
This commit is contained in:
@@ -422,9 +422,9 @@ class HyperOptimizer:
|
|||||||
list(original_dim.bounds)
|
list(original_dim.bounds)
|
||||||
)
|
)
|
||||||
# for preparing to remove old skopt spaces
|
# for preparing to remove old skopt spaces
|
||||||
elif isinstance(
|
elif isinstance(original_dim, ft_CategoricalDistribution) or isinstance(
|
||||||
original_dim, ft_CategoricalDistribution
|
original_dim, ft_IntDistribution
|
||||||
) or isinstance(original_dim, ft_IntDistribution):
|
):
|
||||||
o_dimensions[original_dim.name] = original_dim
|
o_dimensions[original_dim.name] = original_dim
|
||||||
else:
|
else:
|
||||||
raise Exception(f"Unknown search space {original_dim} / {type(original_dim)}")
|
raise Exception(f"Unknown search space {original_dim} / {type(original_dim)}")
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
class ft_CategoricalDistribution(CategoricalDistribution):
|
class ft_CategoricalDistribution(CategoricalDistribution):
|
||||||
name: str
|
name: str
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
categories: Sequence[Any],
|
categories: Sequence[Any],
|
||||||
@@ -34,8 +35,10 @@ class ft_CategoricalDistribution(CategoricalDistribution):
|
|||||||
):
|
):
|
||||||
return super().__init__(categories)
|
return super().__init__(categories)
|
||||||
|
|
||||||
|
|
||||||
class ft_IntDistribution(IntDistribution):
|
class ft_IntDistribution(IntDistribution):
|
||||||
name: str
|
name: str
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
low: int,
|
low: int,
|
||||||
@@ -44,6 +47,7 @@ class ft_IntDistribution(IntDistribution):
|
|||||||
):
|
):
|
||||||
return super().__init__(low, high, **kwargs)
|
return super().__init__(low, high, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
class BaseParameter(ABC):
|
class BaseParameter(ABC):
|
||||||
"""
|
"""
|
||||||
Defines a parameter that can be optimized by hyperopt.
|
Defines a parameter that can be optimized by hyperopt.
|
||||||
@@ -88,9 +92,9 @@ class BaseParameter(ABC):
|
|||||||
return f"{self.__class__.__name__}({self.value})"
|
return f"{self.__class__.__name__}({self.value})"
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def get_space(self, name: str) -> Union[
|
def get_space(
|
||||||
"ft_IntDistribution", "Real", "SKDecimal", "ft_CategoricalDistribution"
|
self, name: str
|
||||||
]:
|
) -> Union["ft_IntDistribution", "Real", "SKDecimal", "ft_CategoricalDistribution"]:
|
||||||
"""
|
"""
|
||||||
Get-space - will be used by Hyperopt to get the hyperopt Space
|
Get-space - will be used by Hyperopt to get the hyperopt Space
|
||||||
"""
|
"""
|
||||||
@@ -187,9 +191,7 @@ class IntParameter(NumericParameter):
|
|||||||
:param name: A name of parameter field.
|
:param name: A name of parameter field.
|
||||||
"""
|
"""
|
||||||
# return Integer(low=self.low, high=self.high, name=name, **self._space_params)
|
# return Integer(low=self.low, high=self.high, name=name, **self._space_params)
|
||||||
result = ft_IntDistribution(
|
result = ft_IntDistribution(self.low, self.high, **self._space_params)
|
||||||
self.low, self.high, **self._space_params
|
|
||||||
)
|
|
||||||
result.name = name
|
result.name = name
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user