diff options
author | Suraj Yerramilli | 2016-02-14 11:19:39 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2016-02-14 11:19:39 +0530 |
commit | b2ced3712b06118a15d32c586bbc1deeac2c304f (patch) | |
tree | c163243f05c949eda991b4a5922f0be44ea30bb5 /R/estUtil.R | |
parent | 329f36146737f378283c64f965d88e1802845ca2 (diff) | |
download | SysID-R-code-b2ced3712b06118a15d32c586bbc1deeac2c304f.tar.gz SysID-R-code-b2ced3712b06118a15d32c586bbc1deeac2c304f.tar.bz2 SysID-R-code-b2ced3712b06118a15d32c586bbc1deeac2c304f.zip |
changed termination criteria
Diffstat (limited to 'R/estUtil.R')
-rw-r--r-- | R/estUtil.R | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/R/estUtil.R b/R/estUtil.R index 6beb8a8..2d1a76f 100644 --- a/R/estUtil.R +++ b/R/estUtil.R @@ -31,7 +31,7 @@ levbmqdt <- function(...,obj,theta0,N,opt){ # Update Parameters H <- 1/N*t(l$grad)%*%l$grad + d*diag(dim(theta0)[1]) Hinv <- solve(H); - if(termPar < tol) break + theta <- theta0 + Hinv%*%g # Evaulate sum square error @@ -40,6 +40,7 @@ levbmqdt <- function(...,obj,theta0,N,opt){ sumSqDiff <- sumsq0-sumsq countObj <- countObj + 1 + if(termPar < tol) break # no major improvement if(abs(sumSqDiff) < 0.01*sumsq0) break @@ -56,14 +57,14 @@ levbmqdt <- function(...,obj,theta0,N,opt){ d <- d*mu } } - if(abs(sumSqDiff) < 0.01*sumsq0){ - WhyStop <- "No significant change" - break - } if(termPar < tol) { WhyStop <- "Tolerance" break } + if(abs(sumSqDiff) < 0.01*sumsq0){ + WhyStop <- "No significant change" + break + } if(i == maxIter){ WhyStop <- "Maximum Iteration Limit" break |