stable/freqtrade/optimize
Simon Ebner df033d92ef Improve performance of decimalspace.py
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()
```
2021-10-24 18:14:24 +02:00
..
space Improve performance of decimalspace.py 2021-10-24 18:14:24 +02:00
__init__.py Small adjustments for moved commands 2020-01-26 13:46:01 +01:00
backtesting.py Reduce backtest-noise from "pandas slice" warning 2021-09-27 20:52:19 +02:00
bt_progress.py Don't void backtest object when not necessary 2021-07-10 10:59:00 +02:00
edge_cli.py [SQUASH] Get rid of _initialize() and fix informatives for dynamic pairlists. 2021-09-18 10:48:53 +03:00
hyperopt_auto.py Simplify "no-space-configured" error handling by moving it to hyperopt_auto 2021-10-13 19:54:35 +02:00
hyperopt_epoch_filters.py Stream hyperopt-result in small batches 2021-08-10 10:12:57 +02:00
hyperopt_interface.py Add possibility to override estimator from within hyperopt 2021-09-15 21:36:53 +02:00
hyperopt_loss_interface.py Provide full backtest-statistics to Hyperopt loss functions 2021-07-04 10:15:19 +02:00
hyperopt_loss_max_drawdown.py simplify expression 2021-10-09 06:36:23 +05:30
hyperopt_loss_onlyprofit.py Update onlyprofit loss should use absolute profit 2021-05-28 08:38:46 +02:00
hyperopt_loss_sharpe_daily.py Don't use profit_percent for backtesting results anymore 2021-01-24 08:58:41 +01:00
hyperopt_loss_sharpe.py Don't use profit_percent for backtesting results anymore 2021-01-24 08:58:41 +01:00
hyperopt_loss_short_trade_dur.py rename default_hyperopt_loss file 2021-08-26 19:39:57 +02:00
hyperopt_loss_sortino_daily.py Don't use profit_percent for backtesting results anymore 2021-01-24 08:58:41 +01:00
hyperopt_loss_sortino.py Don't use profit_percent for backtesting results anymore 2021-01-24 08:58:41 +01:00
hyperopt_tools.py Merge pull request #5587 from raph92/patch-3 2021-09-18 08:08:18 +02:00
hyperopt.py Revert initial_points to 30 2021-10-20 07:46:15 +02:00
optimize_reports.py Styling fixes 2021-10-21 07:45:15 +02:00