Skip to content

Instantly share code, notes, and snippets.

@achrafsoltani
Created April 17, 2022 22:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save achrafsoltani/03f8b461d95748a5107710ed1b8dab27 to your computer and use it in GitHub Desktop.
Save achrafsoltani/03f8b461d95748a5107710ed1b8dab27 to your computer and use it in GitHub Desktop.
Cost function
function cost = compute_cost(H, Y, m)
% H hypothesis matrix
% Y Response Variable
% m training examples
cost = (1/(2*m))*sum((H-Y).^2);
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment