contango.trading.analysis.graphing.metric_distribution
contango.trading.analysis.graphing.metric_distribution
MetricDistribution
MetricDistribution(config: C)
Bases: GraphType[MetricDistributionConfig]
A graph type that shows the distribution of a metric grouped by a parameter.
Source code in src\contango\trading\analysis\graph_type.py
26 27 28 29 30 31 32 33 | |
build
build(df: DataFrame) -> go.Figure
Builds a distribution plot of target_metric grouped by group_by.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
The experiment DataFrame. |
required |
Returns:
| Type | Description |
|---|---|
Figure
|
A plotly Figure. |
Source code in src\contango\trading\analysis\graphing\metric_distribution.py
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 | |
MetricDistributionConfig
dataclass
MetricDistributionConfig(group_by: str, target_metric: str = 'total_return', plot_type: str = 'box')
Bases: GraphConfig
A graph configuration specific to the metric distribution graph.
Attributes:
| Name | Type | Description |
|---|---|---|
group_by |
str
|
The column to group by, including a parameter column, or a version of one for continuous parameters with various distinct values. |
target_metric |
str
|
The name for the targeted metric to graph. |
plot_type |
str
|
The distribution plot style, either "box" or "violin". |