Program 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.
#import numpy as np
#import pandas as pd
import [Link] as plt
import seaborn as sns
from [Link] import fetch_california_housing
#Load California Housing dataset
df = fetch_california_housing(as_frame=True).frame
print(df)
print("\nBasic Information about Dataset:")
print([Link]()) # Overview of dataset
print("\nFirst Five Rows of Dataset:")
print([Link]()) # Display first few rows
print("\nSummary Statistics:")
print([Link]()) # Summary statistics of dataset
print("\nMissing Values in Each Column:")
print([Link]().sum()) # Count of missing values
[Link](figsize=(12, 8))
[Link](figsize=(12, 8), bins=30, edgecolor='black')
[Link]("Feature Distributions", fontsize=16)
[Link]()
[Link](figsize=(12, 6))
[Link](data=df)
[Link](rotation=45)
[Link]("Boxplots of Features to Identify Outliers")
[Link]()
[Link](figsize=(10, 6))
corr_matrix = [Link]()
[Link](corr_matrix, annot=True, cmap='coolwarm', fmt='.2f')
[Link]("Feature Correlation Heatmap")
[Link]()
[Link](df[['MedInc', 'HouseAge', 'AveRooms', 'AveOccup', 'MedHouseVal']],
diag_kind="kde")
[Link]()