x <- stats::toeplitz(.9 ^ (0:31))
nmf <- naive_nmf(x, k = 7, verbose = FALSE)
fitted <- nmf$W %*% nmf$H
oldpar <- par(mfrow = c(1, 2))
on.exit({ par(oldpar )})
image(x, zlim = c(0, 1), main = "Input")
image(fitted, zlim = c(0, 1),
main = sprintf("Fitted with rank=%d", nmf$k))
Run the code above in your browser using DataLab