  Matrix factorization methods - including Factor analysis (FA), and Principal
Components Analysis (PCA) - are widely used for inferring and summarizing
structure in multivariate data. Many matrix factorization methods exist,
corresponding to different assumptions on the elements of the underlying matrix
factors. For example, many recent methods use a penalty or prior distribution
to achieve sparse representations ("Sparse FA/PCA"). Here we introduce a
general Empirical Bayes approach to matrix factorization (EBMF), whose key
feature is that it uses the observed data to estimate prior distributions on
matrix elements. We derive a correspondingly-general variational fitting
algorithm, which reduces fitting EBMF to solving a simpler problem - the
so-called "normal means" problem. We implement this general algorithm, but
focus particular attention on the use of sparsity-inducing priors that are
uni-modal at 0. This yields a sparse EBMF approach - essentially a version of
sparse FA/PCA - that automatically adapts the amount of sparsity to the data.
We demonstrate the benefits of our approach through both numerical comparisons
with competing methods and through analysis of data from the GTEx (Genotype
Tissue Expression) project on genetic associations across 44 human tissues. In
numerical comparisons EBMF often provides more accurate inferences than other
methods. In the GTEx data, EBMF identifies interpretable structure that
concords with known relationships among human tissues. Software implementing
our approach is available at https://github.com/stephenslab/flashr
