# HG changeset patch # User Jordi GutiƩrrez Hermoso # Date 1322427494 18000 # Node ID eddd33e57f6a55ef11fe19305a5104e950d1f96f # Parent 4b6c21158ba68bd8ed4f5af1cec7743339be6eef Justify loop in trainLinearReg diff --git a/learningCurve.m b/learningCurve.m --- 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);