Skip to content

Instantly share code, notes, and snippets.

@vijaykiran
Created November 20, 2011 23:31
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 vijaykiran/1381153 to your computer and use it in GitHub Desktop.
Save vijaykiran/1381153 to your computer and use it in GitHub Desktop.
for i = 1:length(lambda_vec)
subsetX = X(1:i, :);
subsetY = y(1:i);
[theta] = trainLinearReg(subsetX, subsetY,lambda_vec(i));
[error_train(i),grad_train] = linearRegCostFunction(subsetX, subsetY, theta, lambda_vec(i));
[error_val(i),grad_val] = linearRegCostFunction(Xval, yval, theta, lambda_vec(i));
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment