MCPcopy Index your code
hub / github.com/kernc/backtesting.py / plot_heatmaps

Function plot_heatmaps

backtesting/lib.py:118–147  ·  view source on GitHub ↗

Plots a grid of heatmaps, one for every pair of parameters in `heatmap`. See example in [the tutorial]. [the tutorial]: https://kernc.github.io/backtesting.py/doc/examples/Parameter%20Heatmap%20&%20Optimization.html#plot-heatmap # noqa: E501 `heatmap` is a Series as returned by

(heatmap: pd.Series,
                  agg: Union[str, Callable] = 'max',
                  *,
                  ncols: int = 3,
                  plot_width: int = 1200,
                  filename: str = '',
                  open_browser: bool = True)

Source from the content-addressed store, hash-verified

116
117
118def plot_heatmaps(heatmap: pd.Series,
119 agg: Union[str, Callable] = 'max',
120 *,
121 ncols: int = 3,
122 plot_width: int = 1200,
123 filename: str = '',
124 open_browser: bool = True):
125 """
126 Plots a grid of heatmaps, one for every pair of parameters in `heatmap`.
127 See example in [the tutorial].
128
129 [the tutorial]: https://kernc.github.io/backtesting.py/doc/examples/Parameter%20Heatmap%20&%20Optimization.html#plot-heatmap # noqa: E501
130
131 `heatmap` is a Series as returned by
132 `backtesting.backtesting.Backtest.optimize` when its parameter
133 `return_heatmap=True`.
134
135 When projecting the n-dimensional (n > 2) heatmap onto 2D, the values are
136 aggregated by 'max' function by default. This can be tweaked
137 with `agg` parameter, which accepts any argument pandas knows
138 how to aggregate by.
139
140 .. todo::
141 Lay heatmaps out lower-triangular instead of in a simple grid.
142 Like [`sambo.plot.plot_objective()`][plot_objective] does.
143
144 [plot_objective]: \
145 https://sambo-optimization.github.io/doc/sambo/plot.html#sambo.plot.plot_objective
146 """
147 return _plot_heatmaps(heatmap, agg, ncols, filename, plot_width, open_browser)
148
149
150def quantile(series: Sequence, quantile: Union[None, float] = None):

Callers 3

test_plot_heatmapsMethod · 0.90
test_MultiBacktestMethod · 0.90

Calls

no outgoing calls

Tested by 2

test_plot_heatmapsMethod · 0.72
test_MultiBacktestMethod · 0.72