trading.analyzer.graphing.parameter_importance
trading.analyzer.graphing.parameter_importance
build_parameter_importance
build_parameter_importance(df: DataFrame, param_columns: list[str], target_metric: str = 'calmar_ratio') -> go.Figure
Builds the parameter importance bar chart.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Tidy experiment DataFrame. |
required |
param_columns
|
list[str]
|
Parameter columns to score. |
required |
target_metric
|
str
|
Metric to explain. Defaults to "calmar_ratio" (risk-adjusted). |
'calmar_ratio'
|
Returns:
| Type | Description |
|---|---|
Figure
|
A plotly Figure. |
Source code in src\contango\trading\analyzer\graphing\parameter_importance.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 | |
compute_parameter_importance
compute_parameter_importance(df: DataFrame, target_metric: str, param_columns: list[str]) -> pd.DataFrame
Scores each parameter's importance to target_metric using an
eta-squared style measure: the share of total variance in the metric
explained by grouping on that parameter's values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
df
|
DataFrame
|
Experiment DataFrame. |
required |
target_metric
|
str
|
The metric column to explain (e.g. "calmar_ratio"). |
required |
param_columns
|
list[str]
|
Parameter columns to score, typically from
|
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
DataFrame with columns ["parameter", "importance"], sorted descending. |
Source code in src\contango\trading\analyzer\graphing\parameter_importance.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 | |