MulaiMulai sekarang secara gratis

Visualizing the correlation matrix

Reading the correlation matrix of ansur_df in its raw, numeric format doesn't allow us to get a quick overview. Let's improve this by removing redundant values and visualizing the matrix using seaborn.

Seaborn has been pre-loaded as sns, matplotlib.pyplot as plt, NumPy as np and pandas as pd.

Latihan ini adalah bagian dari kursus

Dimensionality Reduction in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Create the correlation matrix
corr = ansur_df.____

# Draw a heatmap of the correlation matrix
sns.____(____,  cmap=cmap, center=0, linewidths=1, annot=True, fmt=".2f")
plt.show()
Edit dan Jalankan Kode