df033d92ef
decimalspace.py is heavily used in the hyperoptimization. The following benchmark code runs an optimization which is taken from optimizing a real strategy (wtc). The optimized version takes on my machine approx. 11/12s compared to the original 32s. Results are equivalent in both cases. ``` import freqtrade.optimize.space import numpy as np import skopt import timeit def init(): Decimal = freqtrade.optimize.space.decimalspace.SKDecimal Integer = skopt.space.space.Integer dimensions = [Decimal(low=-1.0, high=1.0, decimals=4, prior='uniform', transform='identity')] * 20 return skopt.Optimizer( dimensions, base_estimator="ET", acq_optimizer="auto", n_initial_points=5, acq_optimizer_kwargs={'n_jobs': 96}, random_state=0, model_queue_size=10, ) def test(): opt = init() actual = opt.ask(n_points=2) expected = [[ 0.7515, -0.4723, -0.6941, -0.7988, 0.0448, 0.8605, -0.108, 0.5399, 0.763, -0.2948, 0.8345, -0.7683, 0.7077, -0.2478, -0.333, 0.8575, 0.6108, 0.4514, 0.5982, 0.3506 ], [ 0.5563, 0.7386, -0.6407, 0.9073, -0.5211, -0.8167, -0.3771, -0.0318, 0.2861, 0.1176, 0.0943, -0.6077, -0.9317, -0.5372, -0.4934, -0.3637, -0.8035, -0.8627, -0.5399, 0.6036 ]] absdiff = np.max(np.abs(np.asarray(expected) - np.asarray(actual))) assert absdiff < 1e-5 def time(): opt = init() print('dt', timeit.timeit("opt.ask(n_points=20)", globals=locals())) if __name__ == "__main__": test() time() ``` |
||
---|---|---|
.. | ||
space | ||
__init__.py | ||
backtesting.py | ||
bt_progress.py | ||
edge_cli.py | ||
hyperopt_auto.py | ||
hyperopt_epoch_filters.py | ||
hyperopt_interface.py | ||
hyperopt_loss_interface.py | ||
hyperopt_loss_max_drawdown.py | ||
hyperopt_loss_onlyprofit.py | ||
hyperopt_loss_sharpe_daily.py | ||
hyperopt_loss_sharpe.py | ||
hyperopt_loss_short_trade_dur.py | ||
hyperopt_loss_sortino_daily.py | ||
hyperopt_loss_sortino.py | ||
hyperopt_tools.py | ||
hyperopt.py | ||
optimize_reports.py |