0% found this document useful (0 votes)
6 views2 pages

Program 2

The document outlines a program to analyze the California Housing dataset by computing and visualizing the correlation matrix using a heatmap and creating a pair plot for pairwise relationships between features. It includes steps to load the dataset, display basic information, check for missing values, and visualize feature distributions and outliers. The program utilizes libraries such as Matplotlib and Seaborn for data visualization.

Uploaded by

shadowff066
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views2 pages

Program 2

The document outlines a program to analyze the California Housing dataset by computing and visualizing the correlation matrix using a heatmap and creating a pair plot for pairwise relationships between features. It includes steps to load the dataset, display basic information, check for missing values, and visualize feature distributions and outliers. The program utilizes libraries such as Matplotlib and Seaborn for data visualization.

Uploaded by

shadowff066
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

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]()

You might also like