Single Value Decomposition is a useful tool for the analysis and filtering of matrices. I regularly use these SVD functions for things like:
Install svdtools from Github using devtools:
devtools::install_github('https://github.com/jimeharrisjr/svdtools')
Single Value Decomposition can remove noise from matrices in the process of reducing them. One example is image filtering. The included data object noisymatrix is one such example. This is a grayscale image of Linux Penguin on Wikimedia Commons from Larry Ewing lewing@isc.tamu.edu. At random, some pixels have been deleted, creating noise.
library(svdtools)
# show the noisy image
image(noisymatrix, col=gray.colors(65536))
# Plot the explanation
plot_explanation(noisymatrix, limit=.99)
There are a lot of components to play with. One brute force way of doing this would be to try specifying some percentage of components to keep. We could try 98%:
m<-reduce_percentage(noisymatrix, .98)
image(m, col=gray.colors(65536))
This image is obviously overfiltered. Instead, we could simply eliminate all the components above some threshold - for example, discard 51-411:
# Keep the first 50 components
m<-reduce_components(noisymatrix, 50)
image(m, col=gray.colors(65536))
See the vignettes for more detail, and for signal filter examples.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.