changeset 5:eddd33e57f6a default tip

Justify loop in trainLinearReg
author Jordi Gutiérrez Hermoso <jordigh@octave.org>
date Sun, 27 Nov 2011 15:58:14 -0500
parents 4b6c21158ba6
children
files learningCurve.m
diffstat 1 files changed, 6 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/learningCurve.m
+++ b/learningCurve.m
@@ -19,7 +19,12 @@
   ## Initialise outputs
   error_train = zeros(m, 1);
   error_val   = zeros(m, 1);
-  
+
+  ## It is not worth getting rid of this loop because the complexity is
+  ## inside trainLinearReg which in turn is inside fmincg. While you
+  ## *could* do some matrix gymnastics to perform a single minimisation
+  ## in a much higher dimensional space instead of m minimimsations, the
+  ## effort is unlikely to produce faster code.
   for i = 1:m
     Xtrain = X(1:i, :);
     ytrain = y(1:i);