plot_similarity_heatmap
Compute model similarity and plot it as a heatmap.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
models
|
Dict[str, object]
|
Mapping of model ids to GRADIEND models. |
required |
measure
|
str
|
Similarity measure. |
'cosine'
|
part
|
Optional[str]
|
Model part used by weight-based measures. |
None
|
topk
|
Optional[Union[int, float]]
|
Number or fraction of top weights for top-k measures. |
None
|
value
|
str
|
Value variant for overlap-style measures. |
'intersection_frac'
|
order
|
Union[str, List[str]]
|
|
'input'
|
cluster
|
bool
|
Whether to cluster rows/columns. |
False
|
annot
|
Union[bool, str]
|
Whether/how to annotate cells. |
'auto'
|
fmt
|
Optional[str]
|
Deprecated alias for |
None
|
annot_fmt
|
Optional[str]
|
Cell annotation format. |
None
|
figsize
|
Optional[Tuple[float, float]]
|
Optional figure size. |
None
|
cmap
|
str
|
Heatmap colormap. |
'viridis'
|
vmin
|
Optional[float]
|
Optional lower value bound. |
None
|
vmax
|
Optional[float]
|
Optional upper value bound. |
None
|
title
|
Optional[Union[str, bool]]
|
Optional title, or False to omit. |
False
|
output_path
|
Optional[str]
|
Optional output path. |
None
|
show
|
bool
|
Whether to display the plot. |
True
|
return_data
|
bool
|
Whether to include computed data. |
True
|
return_fig_ax
|
bool
|
Whether to include matplotlib figure/axis. |
False
|
ax
|
Optional[Any]
|
Optional existing matplotlib axis. |
None
|
pretty_groups
|
Optional[Dict[str, List[str]]]
|
Optional model-id groups shown as brackets. |
None
|
scale
|
str
|
Color scale type. |
'linear'
|
scale_gamma
|
Optional[float]
|
Optional gamma for power scaling. |
None
|
annot_fontsize
|
Optional[Union[int, float]]
|
Optional annotation font size. |
None
|
tick_label_fontsize
|
Optional[Union[int, float]]
|
Optional tick-label font size. |
None
|
group_label_fontsize
|
Optional[Union[int, float]]
|
Optional group-label font size. |
None
|
group_label_rotation_top
|
Union[int, float]
|
Rotation for top group labels. |
0
|
group_label_rotation_right
|
Union[int, float]
|
Rotation for right group labels. |
0
|
cbar_pad
|
Optional[float]
|
Optional colorbar padding. |
None
|
cbar_y_pad
|
Optional[float]
|
Optional vertical colorbar offset as a fraction of the heatmap height; negative values move it down. |
None
|
cbar_fontsize
|
Optional[Union[int, float]]
|
Optional colorbar font size. |
None
|
cbar_shrink
|
Optional[float]
|
Optional colorbar shrink factor (width relative to heatmap). |
None
|
percentages
|
bool
|
Whether to show values as percentages. |
False
|
row_metric
|
Optional[Dict[str, float]]
|
Optional side metric by row id. |
None
|
row_metric_label
|
Optional[str]
|
Label for the side metric. |
None
|
row_metric_cmap
|
str
|
Colormap for the side metric. |
'magma'
|
row_metric_vmin
|
Optional[float]
|
Optional side-metric lower bound. |
None
|
row_metric_vmax
|
Optional[float]
|
Optional side-metric upper bound. |
None
|
row_label_mapping
|
Optional[Dict[str, str]]
|
Optional mapping for row labels. |
None
|
column_label_mapping
|
Optional[Dict[str, str]]
|
Optional mapping for column labels. |
None
|
seed_aggregate
|
str
|
Seed aggregation mode. |
'mean'
|
dispersion
|
str
|
Dispersion mode. |
'none'
|
seed_pairing_mode
|
str
|
|
'matched'
|
dispersion_display
|
str
|
How to show dispersion values. |
'none'
|
seed_annotation
|
Union[bool, Dict[str, Any]]
|
Whether/how to annotate seed counts. |
False
|
converged_by_id
|
Optional[Dict[str, Optional[bool]]]
|
Optional explicit convergence status by stable model id. |
None
|
highlight_non_convergence
|
bool
|
Whether labels mark non-converged runs. |
True
|
Source code in gradiend/visualizer/heatmaps/similarity.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 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 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 | |