import sklearn
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
weights = [87, 81, 82, 92, 90, 61, 86, 66, 69, 69]
heights = [187, 174, 179, 192, 188, 160, 179, 168, 168, 174]
print(len(weights))
print(len(heights))
df = pd.DataFrame({'height' : heights, 'weight' : weights})
df.head()
sns.scatterplot( data = df, x = 'weight', y = 'height')
plt.title('weight vs height')
plt.xlabel('weight (kg)')
plt.ylabel('height (cm)')
plt.show()

from sklearn.linear_model import LinearRegression
model_lr = LinearRegression()
type(model_lr)
X = df[['weight']]
y = df[['height']]
X.head()
y.head()
model_lr.fit(X = X , y = y)
print(model_lr.coef_)
print(model_lr.intercept_)
w1 = model_lr.coef_[0][0]
w0 = model_lr.intercept_[0]
print('y = {}x + {}'.format(w1.round(2),w0.round(2)))