admm.tv {ADMM} | R Documentation |
1-dimensional total variation minimization - also known as signal denoising - is to solve the following
\textrm{min}_x ~ \frac{1}{2}\|x-b\|_2^2 + \lambda \sum_i |x_{i+1}-x_i|
for a given signal b
.
The implementation is borrowed from Stephen Boyd's
MATLAB code.
admm.tv(
b,
lambda = 1,
xinit = NA,
rho = 1,
alpha = 1,
abstol = 1e-04,
reltol = 0.01,
maxiter = 1000
)
b |
a length- |
lambda |
regularization parameter |
xinit |
a length- |
rho |
an augmented Lagrangian parameter |
alpha |
an overrelaxation parameter in |
abstol |
absolute tolerance stopping criterion |
reltol |
relative tolerance stopping criterion |
maxiter |
maximum number of iterations |
a named list containing
a length-m
solution vector
dataframe recording iteration numerics. See the section for more details.
When you run the algorithm, output returns not only the solution, but also the iteration history recording following fields over iterates,
object (cost) function value
norm of primal residual
norm of dual residual
feasibility tolerance for primal feasibility condition
feasibility tolerance for dual feasibility condition
In accordance with the paper, iteration stops when both r_norm
and s_norm
values
become smaller than eps_pri
and eps_dual
, respectively.
## generate sample data
x1 = as.vector(sin(1:100)+0.1*rnorm(100))
x2 = as.vector(cos(1:100)+0.1*rnorm(100)+5)
x3 = as.vector(sin(1:100)+0.1*rnorm(100)+2.5)
xsignal = c(x1,x2,x3)
## run example
output = admm.tv(xsignal)
## visualize
opar <- par(no.readonly=TRUE)
plot(1:300, xsignal, type="l", main="TV Regularization")
lines(1:300, output$x, col="red", lwd=2)
par(opar)