summaryrefslogtreecommitdiff
path: root/R/estUtil.R
diff options
context:
space:
mode:
authorSuraj Yerramilli2016-02-14 11:19:39 +0530
committerSuraj Yerramilli2016-02-14 11:19:39 +0530
commitb2ced3712b06118a15d32c586bbc1deeac2c304f (patch)
treec163243f05c949eda991b4a5922f0be44ea30bb5 /R/estUtil.R
parent329f36146737f378283c64f965d88e1802845ca2 (diff)
downloadSysID-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.R11
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