Ali Hassan
pandas
, numpy
, matplotlib.pyplot
, seaborn
, and specific modules from scikit-learn
for machine learning.data
.isnull().sum()
method to calculate the number of missing values for each column.describe()
.sns.pairplot()
function generates scatterplots for the 'TV', 'Radio', and 'Newspaper' variables against the 'Sales' variable.plt.suptitle()
function is used to set the title for the pairplot.corr()
method.sns.heatmap()
function is used to generate a heatmap with annotations.X
containing the 'TV', 'Radio', and 'Newspaper' columns.y
containing the 'Sales' column.train_test_split()
from scikit-learn to split X
and y
into X_train
, X_test
, y_train
, and y_test
.random_state
) is set for reproducibility.LinearRegression()
.fit()
.predict()
method to generate predictions for X_test
, resulting in y_pred
.plt.scatter()
to create the scatter plot, where y_test
represents actual sales and y_pred
represents predicted sales.new_data
containing values for 'TV', 'Radio', and 'Newspaper'.predict()
method to predict sales for this new data point.