Menu

Importing Required Libraries

Importing Required Libraries

Python provides several powerful libraries that simplify data analysis, visualization, and machine learning.

Before loading the dataset, we must import the required dependencies.

Code

**import numpy as np**

**import pandas as pd**

**import matplotlib.pyplot as plt**

**import seaborn as sns**

**from sklearn.datasets import fetch_california_housing**

**from sklearn.model_selection import train_test_split**

**from xgboost import XGBRegressor**

**from sklearn import metrics**

Explanation

Each library serves a specific purpose:

Library

Purpose

NumPy

Numerical computations and array operations

Pandas

Data manipulation and DataFrame creation

Matplotlib

Data visualization

Seaborn

Statistical visualization

Scikit-learn

Dataset handling and machine learning utilities

XGBoost

Regression model implementation

Metrics

Model performance evaluation

These libraries form the foundation of the machine learning workflow used throughout this project.