Implemented linear regression algorithm