linear regression algorithm implementation in python