Don't use _set_value for autoOpt-Spaces

This commit is contained in:
Matthias 2021-04-10 09:53:48 +02:00
parent 83fbaf16c8
commit 9804e20114
2 changed files with 3 additions and 11 deletions

View File

@ -27,7 +27,7 @@ class HyperOptAuto(IHyperOpt):
for attr_name, attr in self.strategy.enumerate_parameters('buy'):
if attr.optimize:
# noinspection PyProtectedMember
attr._set_value(params[attr_name])
attr.value = params[attr_name]
return self.strategy.populate_buy_trend(dataframe, metadata)
return populate_buy_trend
@ -37,7 +37,7 @@ class HyperOptAuto(IHyperOpt):
for attr_name, attr in self.strategy.enumerate_parameters('sell'):
if attr.optimize:
# noinspection PyProtectedMember
attr._set_value(params[attr_name])
attr.value = params[attr_name]
return self.strategy.populate_sell_trend(dataframe, metadata)
return populate_sell_trend

View File

@ -50,19 +50,11 @@ class BaseParameter(ABC):
return f'{self.__class__.__name__}({self.value})'
@abstractmethod
def get_space(self, name: str) -> Union['Integer', 'Real', 'Categorical']:
def get_space(self, name: str) -> Union['Integer', 'Real', 'SKDecimal', 'Categorical']:
"""
Get-space - will be used by Hyperopt to get the hyperopt Space
"""
def _set_value(self, value: Any):
"""
Update current value. Used by hyperopt functions for the purpose where optimization and
value spaces differ.
:param value: A numerical value.
"""
self.value = value
class NumericParameter(BaseParameter):
""" Internal parameter used for Numeric purposes """