cca_zoo.visualisation.CorrelationHeatmapDisplay#

class cca_zoo.visualisation.CorrelationHeatmapDisplay(train_correlations, test_correlations)[source]#

Bases: object

Correlation Heatmap Display

Heatmap of the correlations between the latent variables of the representations.

Parameters:
  • train_correlations (np.ndarray) – The train correlations between representations.

  • test_correlations (np.ndarray) – The test correlations between representations.

figure_#

The figure of the plot.

Type:

matplotlib.pyplot.figure

Examples

>>> from cca_zoo.visualisation import CorrelationHeatmapDisplay
>>> import matplotlib.pyplot as plt
>>> import numpy as np
>>> from cca_zoo.linear import MCCA
>>>
>>> # Generate Sample Data
>>> # --------------------
>>> X = np.random.rand(100, 10)
>>> Y = np.random.rand(100, 10)
>>>
>>> # Splitting the data into training and testing sets
>>> X_train, X_test = X[:50], X[50:]
>>> Y_train, Y_test = Y[:50], Y[50:]
>>>
>>> representations = [X_train, Y_train]
>>> test_views = [X_test, Y_test]
>>>
>>> # Train an MCCA Model
>>> # -------------------
>>> mcca = MCCA(latent_dimensions=2)
>>> mcca.fit(representations)
>>>
>>> # %%
>>> # Plotting the Correlation Heatmap
>>> # -------------------------------
>>> CorrelationHeatmapDisplay.from_estimator(mcca, representations, test_views=test_views).plot()
>>> plt.show()