Using Nonnegative Matrix Factorization to Explore Stock Factors
Summary
The document discusses using nonnegative matrix factorization (NMF) to identify latent factors in stock data. It describes decomposing a positive input matrix into loadings and factors, and recounts attempts using stock prices and returns shifted to positive values with a multiplicative update algorithm. Those trials produced factors that were difficult to interpret, raising questions about which inputs, algorithms, and factor patterns might be useful.
The responses suggest that NMF has been applied to stock trading volumes and closing prices to investigate co-movement, extract trends, or support prediction. They caution that unsupervised factors can be meaningful in some datasets and uninformative in others. A second proposal is to apply collective factorization to financial news: discover latent topics, track how they change over time, and relate those changes to market information. The discussion offers research directions rather than comparative tests or evidence that these methods produce reliable trading signals; interpretation and predictive value remain dataset-dependent.
Key ideas
- NMF decomposes a nonnegative data matrix into components that can be viewed as factor loadings and latent factors.
- Stock prices or shifted returns can be made positive for NMF, but positivity alone does not ensure interpretable results.
- Prior examples apply NMF to trading volumes and closing prices to study co-movement or extract trends.
- Latent factors from unsupervised methods may be useful in some datasets and meaningless in others.
- News topic factorization is proposed as a way to discover and track information over time.
Tags
Full text
# Non-negative matrix factorization for factor analysis of stocks # Non-negative matrix factorization for factor analysis of stocks 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. ## Answer by xgdgsc (score 2, accepted) https://quant.stackexchange.com/a/12862 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. ## Answer by user7056 (score 0) https://quant.stackexchange.com/a/12821 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.
Shown in full with attribution under the source's licence. Licence: CC BY-SA 4.0 (Stack Exchange)
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.