validateFinal.m 389 B

123456789101112131415161718192021222324252627
  1. function [error_test] = ...
  2. validateFinal(X_poly, y, X_poly_test, ytest, lambda)
  3. m = rows(X_poly);
  4. error_test = zeros(m, 1);
  5. for i = 1:m
  6. theta = trainLinearReg(X_poly, y, lambda);
  7. [error_test(i,:), grad] = linearRegCostFunction(X_poly_test, ytest, theta, 0);
  8. endfor
  9. error_test
  10. % =========================================================================
  11. end