Random Projections for the Nonnegative Least-Squares Problem
Christos Boutsidis, Petros Drineas
Introduction
The Nonnegative Least Squares (NNLS) problem is a constrained least-squares regression problem where the variables are allowed to take only nonnegative values. More specifically, the NNLS problem is defined as follows:
NNLS is a quadratic optimization problem with linear inequality constraints. As such, it is a convex optimization problem and thus it is solvable (up to arbitrary accuracy) in polynomial time . In words, NNLS seeks to find the best nonnegative vector in order to approximately express as a strictly nonnegative linear combination of the columns of , i.e., .
The motivation for NNLS problems in data mining and machine learning stems from the fact that given least-squares regression problems on nonnegative data such as images, text, etc., it is natural to seek nonnegative solution vectors. (Examples of data applications are described in .) NNLS is also useful in the computation of the Nonnegative Matrix Factorization , which has received considerable attention in the past few years. Finally, NNLS is the core optimization problem and the computational bottleneck in designing a class of Support Vector Machines . Since modern datasets are often massive, there is continuous need for faster, more efficient algorithms for NNLS.
The following theorem is the main quality-of-approximation result for our randomized NNLS algorithm.
holds with probability at least Note that a small number of repetitions of the algorithm suffices to boost its success probability.. The running time of the RandomizedNNLS algorithm is
The latter term corresponds to the time required to exactly solve an NNLS problem on an input matrix of dimensions .
One should compare the running time of our method to , which corresponds to the time required to solve the NNLS problem exactly. We experimentally evaluate our approach on 3,000 NNLS problems constructed from a large and sparse term-document data collection. On average (see section 4.1), the proposed algorithm achieves a three-fold speedup when compared to a state-of-the-art NNLS solver with a small (approx. ) loss in accuracy; a two-fold speedup is achieved with a loss in accuracy. Computational savings are more pronounced for NNLS problems with denser input matrices and vectors (see section 4.2).
The remainder of the paper is organized as follows. Section 2 reviews basic linear algebraic definitions and discusses related work. In Section 3 we present our randomized algorithm for approximating the NNLS problem, discuss its running time, and give the proof of Theorem 1. Finally, in section 4 we provide an experimental evaluation of our method.
Background and related work
The (non-normalized) matrix of the Hadamard-Walsh transform is defined recursively as follows:
The normalized matrix of the Hadamard-Walsh transform is equal to ; hereafter, we will denote this normalized matrix by ( is a power of ). For simplicity, throughout this paper we will assume that is a power of two; padding and with all-zero rows suffices to remove the assumption. Finally, all logarithms are base two.
2 Algorithms for the NNLS problem
A Random Projection Type Algorithm for the NNLS problem
This section describes our main algorithm for the NNLS problem. Our algorithm employs a randomized Hadamard transform to construct a much smaller NNLS problem and solves this smaller problem exactly using a standard NNLS solver. The approximation accuracy of our algorithm is a function of the size of the small NNLS problem.
In section 3.3 we will argue that, for any , if we set
2 The proof of Theorem 1
for some , and the parameter satisfies
for a sufficiently large constant , then with probability at least all -dimensional vectors satisfy,
Using Theorem 7 of (originally proven by Rudelson and Virshynin in ), we see that
for a sufficiently large constant ( is not specified in ). Markov’s inequality implies that
with probability at least 2/3. Finally, using equation (9) concludes the proof of the lemma.
2.2 Another useful result
Let be an orthogonal matrix ( and ). Then, for all ,
2.3 The proof of Theorem 1
We are now ready to prove Theorem 1. We apply lemma 1 for \Phi=\left[\begin{array}[]{cc}H_{n}DA&-H_{n}Db\\ \end{array}\right]\in R^{n\times(d+1)}, the parameter of Theorem 1, sampling probabilities , for all , , and , where is the parameter of Theorem 1. Let be the matrix of the left singular vectors of . Note that is exactly equal to , where is the matrix of the left singular vectors of . Lemma 2 for and our choice of , guarantee that for all , with probability at least
Manipulating equations (14) and (15) we get
3 What is the minimal value of r𝑟r ?
To derive values of for which the RandomizedNNLS algorithm satisfies the relative error guarantees of Theorem 1, we need to solve equation (2); this is hard since the solution depends on the Lambart function. Thus, we identify a range of values of that are sufficient for our purposes. Using the fact that for any , and for any ,
and by setting in equation (2) (note that ), it can be proved that every such that
satisfies the inequality 2 ( is the constant of Theorem 1).
4 Running time analysis
After this preconditioning step, we employ an NNLS solver on the smaller problem. The computational cost of the NNLS solver on the small problem was denoted as in Theorem 1. cannot be specified exactly since theoretical running times for exact NNLS solvers are unknown. In the sequel we comment on the computational costs of some well defined segments of some NNLS solvers.
The NNLS formulation of Definition 1 is a convex quadratic program, and is equivalent to
On the other hand, many standard implementations of NNLS solvers (and in particular those that are based on active set methods) work directly on the formulation of Definition 1. A typical cost of these implementations is of the order per iteration. Other approaches, for example the NNLS method of , proceed by computing matrix-vector products of the form , for an appropriate -dimensional vector , thus cost typically time per iteration. In these cases our algorithm needs again preprocessing time, but costs only or time per iteration, respectively. Again, if given our choice of , the computational savings per iteration are comparable with the speedup described above.
Experimental Evaluation
In this section, we experimentally evaluate our RandomizedNNLS algorithm on (i) large, sparse matrices from a text-mining application, and (ii) random matrices with varying sparsity. We mainly focus on employing the state-of-the-art solver of to solve the small NNLS problem.
Our data come from the Open Directory Project (ODP) , a multilingual open content directory of WWW links that is constructed and maintained by a community of volunteer editors. ODP uses a hierarchical ontology scheme for organizing site listings. Listings on similar topics are grouped into categories, which can then include smaller subcategories. Gabrilovich and Markovitch constructed a benchmark set of 300 term-document matrices from ODP, called TechTC300 (Technion Repository of Text Categorization Datasets ), which they made publicly available. Each term-document matrix of the TechTC300 dataset consists of a total of 150 to 400 documents from two different ODP categories, and a total of 15,000 to 35,000 terms. We chose this dataset because we believe that it does represent an important application area, namely text mining, and we do believe that the results from our experiments will be representative of the potential usefulness of our randomized NNLS algorithm in large, sparse, term-document NNLS problems.
We present average results from 3,000 NNLS problems. More specifically, for each of the 300 matrices of the TechTC300 dataset, we randomly choose a column from the term-document matrix as the vector , we assign the remaining columns of the same term-document matrix to the matrix , and solve the resulting NNLS problem with inputs and . We repeat this process ten times for each term-document matrix of the TechTC300 dataset, and thus solve a total of 3,000 problems. Whenever an NNLS routine is called, it is initialized with the all-zeros vector. We evaluate the accuracy and the running time of our algorithm when compared to two standard NNLS algorithms. The first one is described in We would like to thank the authors of for providing us with a Matlab implementation of their algorithm., and the second one is the active set method of , implemented as the built-in function lsqnonneg in Matlab. We would also like to emphasize that in the authors compare their approach to other NNLS approaches and conclude that their algorithm is significantly faster. Note that the method of operates on the quadratic programming formulation discussed in Section 3.1The actual implementation involves computations of the form and , avoiding the computation and storage of the matrix ., while lsqnonneg operates on the formulation of Definition 1. Finally, we implemented our RandomizedNNLS algorithm in Matlab. The platform used for the experiments was a 2.0 GHz Pentium IV with 1GB RAM.
Our (average) results are shown in Figure 1. We only focus on the algorithm of , which was significantly faster, running (on average) in five seconds, compared to more than one minute for the lsqnonneg function. We experimented with eight different values of the parameter , which dictates the size of the small subproblem (see the RandomizedNNLS algorithm). More specifically, we set to , for , where is the number of columns in the matrix . Our results verify that () the RandomizedNNLS algorithm is very accurate, () that it reduces the running time of the NNLS method of , and that there exists a natural tradeoff between the approximation accuracy and the number of sampled rows. Notice, for example, that the running time of the state-of-the-art NNLS solver of can be reduced from two to three times, while the residual error is from up to worse than the optimal residual error.
We briefly comment on the performance of RandomizedNNLS when compared to the lsqnonneg algorithm. As expected, the accuracy results are essentially identical with the method of , since both methods solve the NNLS problem exactly. Our speedup, however, was much more significant, ranging from 14-fold to 10-fold for and respectively (data not shown).
2 Sparse vs dense NNLS problems
The astute reader might notice that we evaluated the performance of our algorithm in a rather adversarial setting. The TechTC300 data are quite sparse, hence existing NNLS methods would operate on sparse matrices. However, our preprocessing step in the RandomizedNNLS algorithm destroys the sparsity, and the induced subproblem becomes dense. Thus, we are essentially comparing the time required to solve a sparse, large NNLS problem to the time required to solve a dense, small NNLS problem. If the original problem were dense as well, we would expect more pronounced computational savings. In this section we experiment with random matrices of varying density in order to confirm this hypothesis.
First, it is worth noting that the sparsity of the input matrix and/or the target vector do not seem to affect the approximation accuracy of the RandomizedNNLS algorithm. This should not come as a surprise since our results in Theorem 1 do not make any assumptions on the inputs and . Indeed, our experiments in Figure 2 confirm our expectations.
Prior to discussing our experiments on random matrices of varying density, it is worth noting that the NNLS solver of has a running time that is a function of the number of non-zero entries of . Indeed, the method of is an iterative method where the computational bottleneck in the -th iteration involves computations of the form , for a -dimensional vector . implemented their algorithm by computing the two matrix-vector products and separately, thus never forming the matrix and thus taking advantage of the sparsity of . Indeed, NNLS problems with sparse coefficient matrices are solved faster than NNLS problems with similar-size dense coefficient matrices by using the method of The authors of performed extensive numerical experiments to verify that observation; for example see the last row of Table 4 on page 14 in and notice that the running time of their method increases as the density of increases..
In order to measure how the speedup of our RandomizedNNLS algorithm improves as the matrix and vector become denser, we designed the following experiment. First, let the density of an NNLS problem denote the percentage of non-zero entries in and ; for example, means that approximately entries in the matrix and the vector are zero. We chose six density parameters (, , , , , and ) and generated NNLS problems for each density parameter. More specifically, we first constructed ten random matrices with the target density (the non-zero entries are normally distributed in $bdAn\times(d+1)100Abn=10,000d=300r=(d,d+50,d+100,d+150)100AbAbr=300density=2\%density=64\%18\%4\%T_{x_{opt}}$ (see the caption of Figure 2), we conclude that the random projection ideas empirically seem more promising for dense rather than sparse NNLS problems.
Conclusions
We presented a random projection algorithm for the Nonnegative Least Squares Problem. We experimentally evaluated our algorithm on a large, text-mining dataset, and verified that, as promised in our theoretical findings, practically it does give very accurate approximate solutions, while outperforming two standard NNLS methods in terms of computational efficiency. Future work includes the extension of our theoretical findings of Theorem 1 to NNLS problems with multiple right hand side vectors. An immediate application of this would be the computation of Nonnegative Matrix Factorizations based on Alternating Least Squares type approaches . Finally, notice that, since our analysis is independent of the type of constraints on the vector , our main algorithm can be employed to approximate a least-squares problem with any type of constraints on .
We would like to thank Kristin P. Bennett and Michael W. Mahoney for useful discussions. The first author would like also thank the Institute of Pure and Applied Mathematics of the University of California at Los Angeles for its generous hospitality during the period Sept. 2008 - Dec. 2008, when part of this work was done.