PROGRAM BCSL606 Program 2
In [1]: import pandas as pd
import seaborn as sns
import [Link] as plt
from [Link] import fetch_california_housing
# Step 1: Load the California Housing Dataset
california_data = fetch_california_housing(as_frame=True)
data = california_data.frame
# Step 2: Compute the correlation matrix
correlation_matrix = [Link]()
# Step 3: Visualize the correlation matrix using a heatmap
[Link](figsize=(10, 8))
[Link](correlation_matrix, annot=True, cmap='coolwarm', fmt='.2f',linewidths=0.5)
[Link]('Correlation Matrix of California Housing Features')
[Link]()
# Step 4: Create a pair plot to visualize pairwise relationships
[Link](data, diag_kind='kde', plot_kws={'alpha': 0.5})
[Link]('Pair Plot of California Housing Features', y=1.02)
[Link]()
2. Develop a program to Compute the correlation matrix to understand the relationships
between pairs of features. Visualize the correlation matrix using a heatmap to know
which variables have strong positive/negative correlations. Create a pair plot to visualize
pairwise relationships between features. Use California Housing dataset.
In [ ]: