Quantitative Finance Stack Exchange is a question and answer site for finance professionals and academics. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I stumbled over the term Non-negative matrix factorization in presentations such as Application of Machine Learning to Finance and this Big Data in Asset Management.

The basic idea is to decompose a positive (!) matrix $A$ in $$ A = BC. $$

Then one can interpret $B$ as factor loadings and $C$ as factors. I assume that $A$ is not a correlation matrix (which is not necessarily positive) neither a return matrix for the same reason. The authors of the first presentation use the logarithm of stock prices shifted to the right as input. I tried this myself and did not find any useful decomposition.

I have used stock prices and also shifted returns (just adding $1$) to have the whole matrix positive. Then I applied the R function nnmf of the package NMFN which uses the Multiplicative Update Algorithm. I get some "factors" but the interpretation is by far not clear. In the presentation they say that one can (probably) recognize a bear and a bull market factor.

Did you ever try such a decomposition? Which input do you use? Which algorithm and which factors do you analyze? Thanks!

PS:I am aware of PCA but I wanted to try an alternative.

EDIT: For NMF I am having a look at this as a first start.

EDIT: Apparently there are is another stream of research of cardinality constraint and non-negative exposures in PCA. Christian Sigg provides an R-package and Matlab code for doing this here.

share|improve this question
Did you look at lee & Seung (2001) ? – Were_cat May 8 '14 at 12:27
Yes, I quickly browsed it but I didn't see anything related to stocks or finance ... – Richard May 8 '14 at 13:08
up vote 2 down vote accepted

In the chapter that deals with NMF of the book "Programming collective intelligence" , the author did NMF on several stock trading volumes and found some comovement.

I googled a little. This did NMF on 40 chinese stock close prices. This developed A variant of nonnegative matrix factorization for Stock Trend Extraction. Another google found this also did NMF on stock close prices. This develops a method of Automatic Relevance Determination with demonstration on stock prediction task.

In my opinion, for these unsupervised learning methods such as NMF, you may need to seek hard to find the interpretation of latent factors. They might perform very well on some data, while totally meaningless in some other. They are good tools to help you explore the probable factors that affecting the outcome.

share|improve this answer
Thanks for pointing to the book. Do you have any free reference from the web too? thanks! – Richard Jul 1 '14 at 11:53
Added some references, don' t know if it' s free for you, though. – xgdgsc Jul 1 '14 at 12:48

I am not sure if I have correctly understood your problem. But, as you want to detect the market sentiment (bear/bull), you imply that there is extra information in the market that is not included in the stock prices yet. You should then rather use a collective factorization on (on-line) news monitoring, in order to detect previously unknown topics, as you assume that the market (returns) are not aware of the change/do not include the information.

By defining topics based on words related to stocks/economic sectors of interest to you, they will show on as bursts (natural calamities) or periodically (weekly broadcasted TV shows) and the goal is to map the topics discovered at time t+1 with those discovered at time t. Monitoring the textual Yahoo news stream, with the goal of predicting the word distribution for each topic at time t, would be a good starting point, in my opinion.

A good paper on this would be "Detect and Track Latent Factors with Online Nonnegative Matrix Factorization" by Bin Cao & all.

share|improve this answer
Thanks for your answer but my question is about the concept nnmf as described and not about factor models in general. – Richard Jun 29 '14 at 8:47
Please use the math notation for your equations next time. – SRKX Jun 30 '14 at 8:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.