# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: 'Python 3.9.7 64-bit (''MSCS-basic'': conda)'
#     language: python
#     name: python3
# ---

import numpy as np
import pandas as pd
import sklearn as skl
import matplotlib.pyplot as plt
# %matplotlib inline

df = pd.read_csv('https://www.statlearning.com/s/Advertising.csv', index_col=0)

df

df.describe()

pd.plotting.scatter_matrix(df, figsize=(15,15))
plt.plot()

# ### Linear Regession
# $sales = m_1(tv) + m_2(radio) + m_3(paper)$

# +
from sklearn.linear_model import LinearRegression

model = LinearRegression()
model.fit(df[['TV', 'radio', 'newspaper']], df['sales'])
model.coef_

# +
x = np.array([[100, 50, 75]])

model.predict(x)
# -



StarcoderdataJupyterScriptsDedupFiltered