trading.analyzer.graphing.metric_distribution
trading.analyzer.graphing.metric_distribution
build_metric_distribution
build_metric_distribution(df: DataFrame, group_by: str, target_metric: str = 'total_return', plot_type: str = 'box') -> go.Figure
Builds a distribution plot of target_metric grouped by group_by.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Experiment DataFrame. |
required |
group_by
|
str
|
Column to group by — a parameter column, or a pre-binned version of one for continuous parameters with many distinct values. |
required |
target_metric
|
str
|
Metric column to show the distribution of. |
'total_return'
|
plot_type
|
str
|
"box" (default) or "violin". |
'box'
|
Returns:
| Type | Description |
|---|---|
Figure
|
A plotly Figure. |
Source code in src\contango\trading\analyzer\graphing\metric_distribution.py
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | |