diff options
author | Suraj Yerramilli | 2016-02-12 13:26:31 +0530 |
---|---|---|
committer | Suraj Yerramilli | 2016-02-12 13:26:31 +0530 |
commit | 40f4055e6ba4ed836dc4765501c8147a2f5961c9 (patch) | |
tree | 9d10bc2413f98168c0640f8882648dce2c7b5bd8 | |
parent | 3cdd63cfa2e49238b7dba686972082f482166401 (diff) | |
download | SysID-R-code-40f4055e6ba4ed836dc4765501c8147a2f5961c9.tar.gz SysID-R-code-40f4055e6ba4ed836dc4765501c8147a2f5961c9.tar.bz2 SysID-R-code-40f4055e6ba4ed836dc4765501c8147a2f5961c9.zip |
updating residuals only when there is a decrease
-rw-r--r-- | R/estUtil.R | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/R/estUtil.R b/R/estUtil.R index 21e132f..f6f5619 100644 --- a/R/estUtil.R +++ b/R/estUtil.R @@ -31,8 +31,8 @@ levbmqdt <- function(...,obj,theta0,N,opt){ theta <- theta0 + Hinv%*%g # Update residuals - e <- l$Y-l$X%*%theta - sumsq <- sum(e^2) + fn <- l$Y-l$X%*%theta + sumsq <- sum(fn^2) sumSqDiff <- sumsq0-sumsq countObj <- countObj + 1 @@ -44,6 +44,7 @@ levbmqdt <- function(...,obj,theta0,N,opt){ d <- d/mu theta0 <- theta sumsq0 <- sumsq + e <- fn break } else{ # increase damping coefficient by a factor of mu d <- d*mu |