explicit dtype

This commit is contained in:
Italo 2022-01-25 12:29:55 +00:00
parent f7a5b2cb71
commit 30b27ae736
2 changed files with 4 additions and 4 deletions

View File

@ -105,7 +105,7 @@ You can define your own estimator for Hyperopt by implementing `generate_estimat
```python
class MyAwesomeStrategy(IStrategy):
class HyperOpt:
def generate_estimator(dimensions, **kwargs):
def generate_estimator(dimensions: List['Dimension'], **kwargs):
return "RF"
```
@ -119,7 +119,7 @@ Example for `ExtraTreesRegressor` ("ET") with additional parameters:
```python
class MyAwesomeStrategy(IStrategy):
class HyperOpt:
def generate_estimator(dimensions, **kwargs):
def generate_estimator(dimensions: List['Dimension'], **kwargs):
from skopt.learning import ExtraTreesRegressor
# Corresponds to "ET" - but allows additional parameters.
return ExtraTreesRegressor(n_estimators=100)
@ -131,7 +131,7 @@ The `dimensions` parameter is the list of `skopt.space.Dimension` objects corres
```python
class MyAwesomeStrategy(IStrategy):
class HyperOpt:
def generate_estimator(dimensions, **kwargs):
def generate_estimator(dimensions: List['Dimension'], **kwargs):
from skopt.utils import cook_estimator
from skopt.learning.gaussian_process.kernels import (Matern, ConstantKernel)
kernel_bounds = (0.0001, 10000)

View File

@ -40,7 +40,7 @@ class IHyperOpt(ABC):
IHyperOpt.ticker_interval = str(config['timeframe']) # DEPRECATED
IHyperOpt.timeframe = str(config['timeframe'])
def generate_estimator(self, dimensions, **kwargs) -> EstimatorType:
def generate_estimator(self, dimensions: List[Dimension], **kwargs) -> EstimatorType:
"""
Return base_estimator.
Can be any of "GP", "RF", "ET", "GBRT" or an instance of a class