Implement closed form solution for the linear regression.