Nik_Perepelov

Регрессия-хуессия

Dec 1st, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. import numpy as np
  2. import pandas as pd
  3.  
  4. df = pd.read_csv('weight-height.csv')
  5.  
  6.  
  7. x = np.array(df['Height'])
  8. y = np.array(df['Weight'])
  9.  
  10. a = (np.mean(x * y) - np.mean(x) * np.mean(y)) / (np.mean(x ** 2) - np.mean(x)**2)
  11. b = np.mean(y) - a * np.mean(x)
  12. print(a, b)
Add Comment
Please, Sign In to add comment