cca_zoo.visualisation
.CovarianceHeatmapDisplay#
- class cca_zoo.visualisation.CovarianceHeatmapDisplay(train_covariances, test_covariances)[source]#
Bases:
object
Covariance Heatmap Display
Heatmap of the covariances between the latent variables of the representations.
- Parameters:
train_covariances (np.ndarray) – The train covariances between representations.
test_covariances (np.ndarray) – The test covariances between representations.
- figure_#
The figure of the plot.
- Type:
matplotlib.pyplot.figure
Examples
>>> from cca_zoo.visualisation import CovarianceHeatmapDisplay >>> 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 Covariance Heatmap >>> # ------------------------------- >>> CovarianceHeatmapDisplay.from_estimator(mcca, representations, test_views=test_views).plot() >>> plt.show()