Teach a machine how to identify a great company: a simple supervised learning model

Updated: Jan 25, 2020

In this article, we train a machine to identify companies with good fundamentals that will perform well on the stock market. Throughout the process, we will discover what constitutes a safe debt ratio and net profit margin for individual investors to look out for when picking stocks. Keep reading to find out more about what surprising results we eventually uncovered.

1. First, we defined precisely what "performant company" means

We assumed a simple rule: if the company's stock price surged by more than 20% in 5 years (dividend excluded), it is "performant". This example is with Exxon (NYSE:XOM) and Microsoft (NASDAQ:MSFT):

Of course, this model is very simple but actionable and easy to script.

2. We applied this label on all companies within our dataset

Let's plot all the American companies based on their net profit margin and debt ratio:

Knowing the price evolution of these stocks between 2015 and 2020, we set a "performant" or "not performant" label for each of them:

As one could expect, it looks like companies with low debt and high enough net profit margin perform better (it's the blue cloud slightly to the right of the zero). But can we be more accurate and generate a predictive model ?

3. We applied a "k-nearest neighbors" model to generate a predictive map

Let's zoom on a realistic area of the distribution where most companies would be in:

On this sub-domain, we will generate a million-points mesh with each point of the mesh taking the colour of its (k) closest "neighbors". This is a famous supervised algorithm checking the colour of the surrounding points (k of them) to deduce the colour of a new one. A simple illustration:

Looking at the 3 items surrounding the mystery item, the algorithm detects that it should become a blue square because 2 blue squares are around against 1 red triangle. Applying this algorithm, we injected a million-point mesh in our initial scatterplot and ran the simulation for k=100 and k=200, giving us the following maps (with the same colour code: performing companies in blue, non-performing companies in red):

Here, we identified 2 regions of performance:

4. Conclusions based on the training step

Two conclusions: - It appears we have discovered a "performance tunnel" of companies with an extremely low debt ratio below 20% (performing area 1) regardless of what their net profit margin is. If you want companies that would very likely perform well over time then narrow down your research to positive net profit margins and a debt ratio below 20%

- Some companies with impressive net margins (over 22%) seem to perform well even with a moderately high debt (performing area 2). This could mean that they have enough entropy to use this debt to fuel their performance. If you're after these types of stocks, narrow down to companies with very solid net profit margin above 22%. Disclaimer: this is Information, not advice or recommendations.

594 views0 comments

©Stockomatics Ltd. 2020 

  • LinkedIn
  • Facebook
  • Twitter