implementation of linear regression in python code