Recommendation engines are often used to maximise the revenue of online platforms in all sorts of industries. In this article, we thought it would be interesting to adapt the very popular Netflix prize algorithm 2010 to rank stocks rather than movies and generate portfolios based on iconic investment styles and beat the NASDAQ. The outcome will be dead simple!
1. Overview of the Netflix algorithm
The Netflix prize algorithm uses a collaborative approach that decides what to show you based on others.
Firstly, using this matrix, we create 2 new matrices, U and V, using a black magic interpolation:
Then, U and V, once found, can be multiplied together to give an affinity table:
Finally, this matrix enables recommendations to be generated for any user.
2. Adapt the algorithm for stocks rather than movies
Now, what would it take to use the same approach for stocks?
First, we need “users” or “investor profiles”:
Then, we can generate plenty of profiles for every financial ratio automatically. Bob will like companies with the highest net margins. Jenna will like companies with the lowest debt to equity ratio. Finally, the output is a table that looks like:
Finally, the software would then fill in the blanks to suggest the stocks to buy for any given user.
3. Generate investor profiles programmatically
However, rather than just imagining random virtual profiles like Bob, let’s generate them based on iconic investor styles.
In fact, the first one is obvious. The “Oracle of Omaha”, king of value investing:
We create 100 “variants of Buffet” programmatically with different levels of tolerance for the financial ratios (gradually becoming more and more strict in an already very selective range). Then, we infer what stocks our artificial “Warrens” would select among thousands of publicly traded companies. We end up with 100 Buffet profiles (i.e: buffet_1, buffet_2, …, buffet_100) and the companies each of them have selected, focusing on high margin, low debt, high returns, and low price.
Similarly, we imagine a second profile: “Crazy Cathie”, the queen of growth in Wall Street.
We create 100 “variants of Wood” to beat the NASDAQ, with different levels of tolerance for the financial ratios (gradually becoming more and more strict). Then, we infer what stocks our artificial “Cathies” would select among thousands of publicly traded companies. We end up with 100 Wood profiles (i.e: wood_1, wood_2, …, wood_100), having selected top companies with high network effect. Very often, this means: high price, high debt, no dividends, and underestimated growth.
Finally, having generated these profiles and their tastes using our favourite data provider FMP, we train our machine learning model using LightFM, a Machine Learning library for recommendations.
4. Generate a Buffet portfolio
Now let’s use the models we just created. Let’s assume that I want to build a portfolio based on the fact that I like Apple as a stock. I want the algorithm to recommend some stocks that Buffet would buy, similar in terms of fundamentals to this pick. Using the Warren Buffet recommender we get:
Finally, the Neftlix prize algorithm suggests the following “Buffet” portfolio:
4. Generate a Wood portfolio
Now, let’s assume that I want to build a portfolio based on the fact that I like Tesla as a stock. I want the algorithm to recommend some stocks that Wood would buy, similar in terms of fundamentals to this pick.
The result suggests the following “Wood” portfolio:
5. Conclusion
We’ve generated 2 very different portfolios. As a test, we’ve calculated their performance. For example, between march 2020 and December 2021:
There are two takeaways for us (except that we beat the NASDAQ!).
– First, It’s time to stop being “cute”. Currencies around the world are under attack. That’s why, In that toxic environment, we’re radicals. Avoid diversified ETFs. Instead, pick stocks with top fundamentals (“Buffet”) or powerful network effects (“Wood”).
– Second, being very strict and programmatic to determine our picks seems efficient. Then, the ML part is simply a nice way to decide on a basket of stocks with the same characteristics.
In the end, the outcome is simple: cut the noise.
Diversification? Modern portfolio theory? Greek letters? Answer:
Take care.
Clem
n.b: you can find another example of portfolios generation here.