Home » Train a Neural Network To Invest

Train a Neural Network To Invest

In this article, we designed a neural network to invest and spot well-managed and profitable companies. A neural network is a black box that can learn anything. We decided to teach it to recognise good patterns (just like a new-born) and, eventually, tested its level of accuracy. Overall, it was a long process looking like our first predictive model, but keep scrolling to discover the potential of this supervised learning approach.

1. We defined metrics for “well-managed” and “profitable” companies

For example, a good indicator of a “well-managed” company is how it deals with its debt. We starte d by considering the ratio “Net-Debt-To-EBIDTA” over a couple of years. We want to see this ratio staying under control over time. This means, not skyrocketing and in a stable tunnel, meaning that the company monitors the debt well.

You can see an example of this with Alphabet (NASDAQ:GOOGL) in green versus the whole internet sector in blue:

As for an example of a “profitable” company is, we can consider how the Return-On-Equity (ROE) grows. We want to see it over 10% and stable or following an upward trend.

For example, a good ROE is Apple (NASDAQ: AAPL):

We collected all these ratios for American companies, here is an extract:

2. We trained a Neural Network to learn based on this metrics

Firstly, we defined a neural network specialised in time series: a Recurrent Neural Network (RNN) with Long Short-Term Memory (LTSM). Like all neural networks, it contains a collection of “neurons” (the red and orange points) organised in layers. These layers are plastic enough to “learn” how to carry the information:

See also  Midjourney: An AI-Powered Art Generator

To train our neural network, we fed it with the Return-On-Equity (ROE) and Net-Debt-To-EBIDTA charts over 5 years (2010-2015) for a given company.

Then, we trained the neural network for it to remember that these charts belong to a “performing” company.

Side note: we declare that a company is “performing” if the stock price raised more than 20% on the stock market over the following 5 years, excluding dividends:

We repeated this operation for every company on the American stock market to get a “trained” neural network:

This training step is iterative and is never definitive (or “converged”), which means we can only assume that the training is completed based on the stabilisation of the error after running the algorithm for long enough. Here’s a visual of the error (called “loss“) decreasing as we train the network:

Finally, we eventually converged after tuning various parameters (e.g: number of “neurons”) to reach an accuracy of 65% for the overall model:

The evaluation of the model has been performed on a dedicated pool of companies that have been isolated for that purpose, amounting to 20% of the dataset.

The accuracy obtained is significantly better than flipping a coin, which is not the case of all investment funds.

3. We test our brain on famous stocks in 2020 and conclude

Out of curiosity, we asked our brain to predict the success on 5 years for 2 random international stocks based on their up-to-date Net-Debt-To-EBIDTA and ROE historical data (2015-2019).

Here, the prediction model shows that one company would be “performing” (on the left) and the other one not (on the right):

See also  Top Indicators For Altcoins: A Random Forest Analysis

The algorithm does not come with many hints on the reasons “why” as it acts like a black box copying human intuition.

To conclude, we believe that there are endless potential applications for a neural network to invest, such as:

– building tailored predictive models based on personalised metrics – back-testing hypotheses and improve them with a feedback loop

– automating the work of analysts so they become supervisors

Disclaimer: This is just information and is NOT given as advice or recommendations.

Related Posts

Leave a Comment