AI branches (part 2): expert systems & fuzzy logic

Nicolo Carpaneda

July 29, 2024

Start-up life

In our previous post (here) we have reported which are the main branches of AI. Then, we focused on describing machine learning & robotics.

As a refresher - we have anticipated that AI has four main branches (and several sub-branches):

  1. Machine learning (ML)
    • Neural networks & deep learning
    • Natural language processing
    • Computer vision
  2. Robotics
  3. Fuzzy logic
  4. Expert systems

Today we will focus on expert systems and fuzzy logic.

Before jumping into AI expert systems and making a case for their protagonist role into the future of investing, we need to discuss what's wrong with machine learning models trying to predict financial market - i.e. what everyone is focusing on these days - and what we need to fix first.

ML predictions & financial markets

We have learned in our previous post that machine learning models exist to make future predictions, given past data.

Those models are robust enough to power self-driving cars (via computer vision), have written conversations with humans (chatGPT), listen and understand humans (think Alexa), but we should not believe that they can (or will) do everything else well.

For example, ML models are NOT able to accurately predict financial markets.

Yes. Read it again.

Machine learning is just unable to accurately predict what financial markets do.

The reason is simple: machine learning has to leverage advanced statistics to identify patterns in data. But financial markets by definition have white noise (a type of time series that has no predictable pattern, trend, or seasonality - composed of random values that are independent and identically distributed). Therefore they simply do not offer stable patterns to take advantage of.

No clear or stable patterns means no accurate machine learning predictions.

A deep learning black box able to make easy money is just not possible - at least with the current state of technology.

See it this way.

We humans can all agree that a window is a window: big, long, yellow, with or without glass, small, grey. And we have been able to pass the insight to AI systems (image recognition). But there is no consensus on what's cheap or expensive in stock markets, how future earnings of company X will compare to company Y, what the current politician in the Z region will do or say tomorrow, if inflation growth will push aggregate consumer demand up or down. So how can we explain to AI when things work well or not in markets, given an infinite stream of variables with perennially shifting relationships?

If you have done some previous research on such topic, you will know that the majority of research papers and blog posts on the internet will conclude that their ML predictions on financial markets are just not good enough.

You will also find much less competent pieces of work claiming accurate predictions and easy money to make, eventually showing their market forecasts being identical to what would have happened in reality.

Ignore them.

Accurate predictions can be achieved via manipulation by tricking models to react to the known past in specific ways. That would be over-fitting. The first real prediction to be done on tomorrow's market behavior by over-fitted models will likely be wrong.

All hopes to leverage AI in investing are lost then?

No.

They aren't.

Specialized vs generalized intelligence

As of today, humanity has achieved narrow AI: artificial intelligence performing specific tasks well. But we have not achieved general artificial intelligence (AGI) yet - and we might never do who knows.

This is just to say that AI can smartly follow specific rules and discover patterns, but is not smart enough to generalize, or to apply broad inferences while deciding if and when to consider or exclude exceptions to known rules.

Humans instead do know how to generalize and how to distinguish when relationships between variables are meaningful or not.

Here's an example.

If oil supply goes down and oil demand goes up, oil prices are likely to go up (ignoring other macroeconomic factors). AI would be able to recognize those patterns over time - given enough data history for training of the model - and eventually make good predictions on where oil prices might go, given supply and demand dynamics and assuming such drivers were the only ones affecting oil prices.

Cool! What's the problem then?

Similarly, imagine to feed an AI model with data that includes both US stock market prices and lunar phases. If by random chance the lunar phases were correlated with market outcomes - say that the US stock market would randomly go up with the full moon for absolutely no reason - our machine learning model would learn that any full moon would cause the US stock market to go up.

Do you see?

The AI model would infer that the moon, genuinely correlated with stock prices in our silly example, would be the reason why stock prices go up. AI cannot split correlation and causation. As humans, we do know that causation between moon phases and stock prices does not exist.

So AI on a stand-alone basis - in our opinionated view - is not the answer to replace humans to invest more wisely.

What if we try to merge human generalized intelligence, capable to identify broad (not narrow) patterns, understanding when to skip specific exceptions, spotting when correlation does not explain causation, together with AI's ability to analyze data quickly?

Expert systems

An AI expert system is a computer system emulating the decision-making ability of human experts in a specific field.

Designed to solve complex problems by reasoning through bodies of knowledge, they are mainly represented in the form of rules and general-purpose reasoning rather than through conventional procedural programming code (= commands listed sequentially).

Geek for geeks

Expert systems are not new: they were first introduced by Stanford University researchers in the 1970s and, after a massive hype in the 1980s, they have quickly become obsolete as their knowledge base would quickly become outdated.

Not many care nowadays, as expert systems remain under the radar - a great place to quietly work at new discoveries:

Expert systems are composed by two core elements:

=> a knowledge base representing facts and rules about the world, consisting of broad knowledge in a particular domain

=> an inference engine working as an automated reasoning system that fetches insights from the knowledge base and applies relevant rules.

After much experimentation with the vast majority of available ML models, we turned a page and we have instead developed an AI expert system interpreting markets and making investment decisions, fixing some of the shortcomings of pure ML formulas trying to predict  financial markets.

So how did we build an expert system to interpret market dynamics and thus adapt the asset allocation of an investment portfolio to perform under all weathers?

=> Step 1: map the normal interaction between relevant market variables and the resulting outcomes (prices up/down) on key asset classes

Imagine to be able to collect and crystalize a complete, broad set of market behaviors and interactions - learned by humans over the past 70+ years of real-life market experience - representing the way that key market or economic variables "normally" interact on a daily basis.

=> Step 2: link key variables' dynamics with market outcomes

Also imagine to find out and map the proven relationship between relevant independent variables and a subsequent market outcome.

Those insights would help our system focus on key dynamics to spot what market outcome would possibly emerge.

=> Step 3: observe and infer

Our system would therefore monitor - see below - the individual, relevant variable to then start inferring what possible market outcome is likely to show up, same things equal.

Such process would be multiplied n times for each key variable driving market outcomes. The result would be a broad real-time understanding of how markets normally work by decoding human expert investing experience (by saying normally, we mean at least 50% of the times plus one).

At this point, we have basically delegated to an efficient thinking system when to expect certain market outcomes given context, without having to rely on statistical predictions.

But we still have two challenges.

First, what happens when markets behave not normally?

Second, how do we update the knowledge of an expert system to be ready when things change?

Overlays

To complement the initial map of normal interactions between market variables and outcomes/returns, we need to monitor and interpret unexpected, non-standard behaviors. In parallel, we also need functions and models to enrich the system with new knowledge and new understanding as markets evolve.

Let's look at an example.

We know that meaningful (high/low) inflation levels drive bond yields (up/down). As humans we do know that such relationship is valid. What is unclear is what is the level making inflation "meaningful", because it has changed over time.

In other words, we know that inflation often drives yields. But when and how exactly will dependent on context.

This is where ML models would likely fail their predictions without stable patterns.

=> Step 4: add focus and boundaries to the monitoring of the non-standard, to trust it when something relevant happens

So we ask our AI system to keep an eye on different selected factors within selected boundaries, such as specific inflation levels and trends, shifting correlations with bond yields (see chart below) and ...

... a plethora of additional causal variables that might also affect yields, such as monetary policy decisions (and subsequently the expected, upcoming interest rate cuts or hikes).

Relevant variables and fundamental causation (via human decoded heuristics) are embedded in our knowledge system, while fresh data and the ongoing interpretation of emerging correlations and non-standard market behaviors are all mapped and pondered on-the-go in the back-end.

This is where the shortcomings of earlier expert systems are being fixed: after absorbing fresh data and map known/unknown interactions, the system decides if to trust "normal" rules or unfolding new patterns.  

We have not discarded ML models entirely though.

We make very specific predictions where causation is not a concern: for example we have shaped a recurrent neural network with Long-Short Term memory (as described in our first post on AI branches) to run multivariate regressions between a plethora of macro and market variables and the final value of specific assets to define them cheap or expensive according to the unfolding context.

We do not make direct investment decisions on that ML prediction, but we use it to change some of our portfolio weights.

By the way, after pulling data, mapping key variables' interactions, and discovering the likelihood of possible market outcomes, we need to start investing.

Investing is not a 0 to 1 game (buy or sell US stocks) but it is translated into an investment portfolio with several asset classes. So how much of each asset class do we buy and how much of each do we sell, in continuously shifting markets?

Managing ambiguous results

Let's imagine that our AI expert system might have decided that 3% is a dangerous inflation level for the US, so to say. Same things equal, with rising inflation it would emerge a decision to sell all inflation-sensitive asset classes, such as government and corporate bonds.

Buy hey, investors might be keen to sell only long-duration bonds and keep short-duration bonds. Or keep some European bonds for the time being as - let's assume - inflation will only hit the US right know.

So how much weight to give to all these asset classes, as we need to keep a 100% portfolio?

The solution is not black & white. It is shades of grey.

This is where we need fuzzy logic.

Fuzzy logic

The Fuzzy word means the things that are not clear.

Fuzzy logic is a heuristic approach that allows for more advanced decision-tree processing. It is a generalization from standard logic (in which all statements have a truth value of one or zero) where statements can have a value of partial truth (such as 0.9 or 0.5).

In artificial intelligence, fuzzy logic occupies a unique space: it deals with uncertainty and imprecise information, unlike most traditional AI techniques. It brings to AI is a mathematical framework for capturing gradedness in reasoning devices. Integrated in AI, it adds a layer of nuance making AI more robust in handling the complexities of the real world.

Intuition: we can imagine why a good self-driving car cannot work with a braking system only considering a binary output of 0 or 1 (brake entirely to stop / do not brake). Fuzzy logic will instead help to decide how much to gradually break depending on relative distance vs the car in front.

In investing terms, we may think of inflation as negative (< 0), cool (0-2%), higher (2-4%) and excessive (> 4%) for the US market using randomly decided levels. Subsequently, subject to the inflation level - which is not anymore classified as good/bad in a binary system, and instead categorized with fuzzy logic - we can implement specific degrees of gradual buying/selling trading rules.

By scaling the interpretation of ambiguity across the system, we make it much more robust in handling the complexities of everyday investing.

Given the primary role of fuzzy logic in our AI expert system that we internally call "Spectra - X", we define it as an AI fuzzy expert system: it is a form of AI that uses membership functions and a set of fuzzified inference rules to solve investing problems.

Conclusion

Artificial intelligence is advancing at fast speed and is becoming more and more successful at several human-like tasks, thanks to the recent development of machine learning and deep learning neural networks.

This does not mean that ML models are good at doing everything. For example, they are not able to make accurate predictions on financial markets, ruled by white noise.

We programmed an AI expert system containing human expert investing knowledge with the ability to make inferences on both known normal market behaviors and map emerging new relationships between key variables.

Fuzzy logic is added to the AI to interpret different degrees of ambiguity in interpreting reality of allocating to the portfolio.

The result is an intelligent system that - much better than ML predictions - can interpret markets and make superior investment decisions that end-up in reliable performance under all weathers.


We run investment strategies with adaptive asset allocation, investing in the right place at the right time.

Click here for more insights
Pic source: freepik, unsplash, pexels.
Disclaimers, terms & conditions apply.


________________________________________________________
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.