added cost function and grad for linear regression