Heatmap

Heatmap visualization for correlation matrices in trainedml.

This module provides the HeatmapViz class, which generates correlation heatmaps using matplotlib and seaborn, supporting various correlation methods and masking options.

Mathematical context

  • Pearson, Spearman, Kendall correlation

  • Masking upper triangle for symmetric matrices

Exemples

>>> from trainedml.viz.heatmap import HeatmapViz
>>> viz = HeatmapViz(df)
>>> viz.vizs()
>>> viz.figure.show()
class trainedml.viz.heatmap.HeatmapViz(data, features='all', method='pearson', mask=True, save_path: str | None = None)[source]

Bases : Vizs

Correlation heatmap visualization.

Paramètres:
  • data (pandas.DataFrame) – The dataset.

  • features ('all' or list, default='all') – Features to include.

  • method (str, default='pearson') – Correlation method (“pearson”, “spearman”, “kendall”).

  • mask (bool, default=True) – Whether to mask the upper triangle.

data

The data.

Type:

pandas.DataFrame

features

Features used.

Type:

list

method

Correlation method.

Type:

str

mask

Masking option.

Type:

bool

figure

The generated figure (after calling vizs).

Type:

matplotlib.figure.Figure

Exemples

>>> viz = HeatmapViz(df, features=['A', 'B'])
>>> viz.vizs()
>>> viz.figure.show()
vizs()[source]

Calcule la matrice de corrélation et affiche la heatmap.