QuantDesk® Machine Learning Forecast

for the Week of June 8th, 2018

Success In Deep Learning Hinges On The Obvious, But The Obvious Is Often Missed

Erez Katz writes about Betting On US Defense Stocks

by Erez Katz, CEO and Co-founder of Lucena Research.


Background

At Lucena, we always try to understand the root cause of unexpected results. At times, we find it amusing when we come to realize that the machine actually did exactly what it was tasked to do, and it was us who failed to communicate the task with clarity. As you will see in the examples I share today, in many cases, the reason an experiment fails is due to the human designer not expressing the problem carefully. In machine learning lingo, we fail to define a representative objective function, or we fail to label the training data to support our objective.

To illustrate, I’d like to share with you two examples that were brought to me by Tucker Balch Ph.D., co-founder and Chief Scientist. Tucker is also currently teaching quantitative investment at the Georgia Institute of Technology and online at Coursera and Udacity.

Example # 1

A student produced a deep-learning based price forecast backtest of stocks in the S&P with average annual returns greater than 80%. If you have been looking at as many backtests as we have, you would immediately suspect the validity of these results. One of the most obvious causes of such unrealistic performance would normally be in-sample backtesting. Put simply, the model “is cheating” by backtesting using “familiar” data. This normally happens when the backtest is conducted on the same data that was used to train the model. To put this in context, below are backtest results using Lucena’s Price Forecaster (available on QuantDesk). This backtest simulates selecting the top 20 constituents every week from the S&P. As is shown here, a significant outperformance can be achieved with annualized returns of 12.45% and thus an 80+% average annual return for an equivalent backtest is quite remarkable.

Image 1: kNN forecaster backtest selecting top 20 securities from the S&P with the highest projected one-week return coupled with the highest confidence score. Results account for slippage and transactions cost. Past performance is not indicative of future returns.

Surprisingly, a comprehensive code review didn’t indicate overfitting and thus further investigation revealed the true reason for the student’s outstanding backtest performance. The student was using features and price history data from the Wharton School of Business called WRDS. The data includes artificial symbols generated by the NYSE and Nasdaq with price histories that follow a certain predictive pattern. The deep learner was able to exploit such patterns by singling out the synthetic symbols to drive the backtest’s performance.

Lesson learned:

  • Data validation is crucial in the context of machine learning. I’ve discussed this subject at length in last week’s posting.
  • Given that the synthetic data was blended with real data, the results of the student’s backtest are quite impressive as the deep learner was able to distinguish information from noise and exploit it. This tells us, that if there is information in the data (even if it is obscured and thinly represented), the deep learner is capable of finding it.

Example # 2

Another of Professor Balch’s students built a Reinforcement Learner to master the game Lunar Lander. For those who aren’t old enough to know what Lunar Lander is - it’s an old video game in which the player attempts to successfully land a spaceship on the moon. There are a few parameters that the player needs to adjust in order to lead the spaceship to a successful landing: Height, Tilt, Velocity, Acceleration (thrust), Time, Fuel level etc. The game begins when the spaceship suddenly appears from various locations on the screen and the player attempts to navigate it and land it between two flags on the ground.

https://www.youtube.com/watch?v=orHkWDmzkao
Image 2: Lunar Lander in action.

Q-Learning is a model-free reinforcement learning algorithm developed by Christopher Watkins in 1989. The algorithm is perfect for mastering games since it is able to learn the rules of an unfamiliar environment without a human-generated model. The application of reinforcement learning for games is appropriate since it strives to form policies that maximize rewards. Q-Learning attempts to achieve the highest reward through trial and error. It attempts to monitor states and their corresponding desired actions through random selection. We will cover Q-Learning in more detail at a later post.

The video below, showcases the Lunar Lander’s progress as it improved through trials and errors.

The video below, showcases the Lunar Lander’s progress as it improved through trials and errors.

https://www.youtube.com/watch?v=O25L7teHSs4 https://www.youtube.com/watch?v=O25L7teHSs4
Image 3: Q-Learning in action – adjusting through trial and error.
https://www.youtube.com/watch?v=W7LS1DiaSb0 https://www.youtube.com/watch?v=W7LS1DiaSb0
Image 4: Q-Learning in action – achieving better accuracy over time but still not perfect.

An attempt to further increase the model’s accuracy resulted unexpectedly in a spaceship that never lands. It turns out that increasing the penalty (negative reward) of the Q-Learner facilitated a policy of never even trying to land since the risk is simply too high.

https://www.youtube.com/watch?v=0VmVLYApUdo https://www.youtube.com/watch?v=0VmVLYApUdo
Image 5: Q-Learning in action – unexpected results – the spaceship never lands

Naturally, by adjusting the math and disregarding the true business objective we are destined to get a model that satisfies the science but doesn’t quite achieve a commercially viable solution.

Conclusion

In today’s post, we’ve showcased how the effectiveness of ANNs (artificial neural nets) can lead at times to unexpected results. It’s imperative to accurately state the objective of our research. We do this by defining a representative objective function. In addition, we need to ensure valid labeled data that is representative of real-world scenarios. Furthermore, we have to label the data (tell the machine what data yields a positive outcome) in the most supportive way to satisfy our objective function. For example, if we wish to train a deep model for profitable investment, training the network to identify positive returns with high accuracy may not be sufficient. The model will most likely train for many small future returns vs fewer but more sizable returns. Small returns are more likely to occur, but in reality, investment based on such forecast will most likely fall short of overcoming transactions cost and slippage and thus cannot be used effectively for trading.

Finally, and unrelated, I wanted to include a pretty cool video I came across that simulates the journey to Mars. “How To get to Mars" is a clip from the IMAX documentary "Roving Mars" from 2006. This is an edited short version.

Enjoy 🙂

Strategies Update

As in the past, we will provide weekly updates on how the model portfolios and the theme-based strategies we cover in this newsletter are performing.

Tiebreaker – Lucena’s Long/Short Equity Strategy - Since Inception 49.93% vs. benchmark of 6.34%
Image 1: Tiebreaker YTD– benchmark is VMNIX (Vanguard Market Neutral Fund Institutional Shares)
Past performance is no guarantee of future returns.

Tiebreaker has been forward traded since 2014 and to date it has enjoyed remarkably low volatility and boasts an impressive return of 49.93%, low volatility as expressed by its max-drawdown of only 6.16%, and a Sharpe of 1.62!

BlackDog – Lucena’s Risk Parity - Since Inception 49.49% vs. benchmark of 20.94%

We have recently developed a sophisticated multi-sleeve optimization engine set to provide the most suitable asset allocation for a given risk profile, while respecting multi-level allocation restriction rules.

Essentially, we strive to obtain an optimal decision while taking into consideration the trade-offs between two or more conflicting objectives. For example, if you consider a wide universe of constituents, we can find a subset selection and their respective allocations to satisfy the following:

  • Maximizing Sharpe
  • Widely diversified portfolio with certain allocation restrictions across certain asset classes, market sectors and growth/value classifications
  • Restricting volatility
  • Minimizing turnover

We can also determine the proper rebalance frequency and validate the recommended methodology with a comprehensive backtest.

Image 2: BlackDog YTD– benchmark is AQR’s Risk Parity Fund Class B
Past performance is no guarantee of future returns.

Forecasting the Top 10 Positions in the S&P

Lucena’s Forecaster uses a predetermined set of 10 factors that are selected from a large set of over 500. Self-adjusting to the most recent data, we apply a genetic algorithm (GA) process that runs over the weekend to identify the most predictive set of factors based on which our price forecasts are assessed. These factors (together called a “model”) are used to forecast the price and its corresponding confidence score of every stock in the S&P. Our machine-learning algorithm travels back in time over a look-back period (or a training period) and searches for historical states in which the underlying equities were similar to their current state. By assessing how prices moved forward in the past, we anticipate their projected price change and forecast their volatility.

The charts below represent the new model and the top 10 positions assessed by Lucena’s Price Forecaster.

Image 3: Default model for the coming week.

The top 10 forecast chart below delineates the ten positions in the S&P with the highest projected market-relative return combined with their highest confidence score.

Image 4: Forecasting the top 10 position in the S&P 500 for the coming week. The yellow stars (0 stars meaning poorest and 5 stars meaning strongest) represent the confidence score based on the forecasted volatility, while the blue stars represent backtest scoring as to how successful the machine was in forecasting the underlying asset over the lookback period -- in our case, the last 3 months.

To view a brief video of all the major functions of QuantDesk, please click on the following link:
Forecaster
QuantDesk Overview

Analysis

The table below presents the trailing 12-month performance and a YTD comparison between the two model strategies we cover in this newsletter (BlackDog and Tiebreaker), as well as the two ETFs representing the major US indexes (the DOW and the S&P).

12 Month Performance BlackDog and Tiebreaker
Image 5: Last week’s changes, trailing 12 months, and year-to-date gains/losses.
Past performance is no guarantee of future returns.

Appendix

For those of you unfamiliar with BlackDog and Tiebreaker, here is a brief overview: BlackDog and Tiebreaker are two out of an assortment of model strategies that we offer our clients. Our team of quants is constantly on the hunt for innovative investment ideas. Lucena’s model portfolios are a byproduct of some of our best research, packaged into consumable model-portfolios. The performance stats and charts presented here are a reflection of paper traded portfolios on our platform, QuantDesk®. Actual performance of our clients’ portfolios may vary as it is subject to slippage and the manager’s discretionary implementation. We will be happy to facilitate an introduction with one of our clients for those of you interested in reviewing live brokerage accounts that track our model portfolios.

Tiebreaker: Tiebreaker is an actively managed long/short equity strategy. It invests in equities from the S&P 500 and Russell 1000 and is rebalanced bi-weekly using Lucena’s Forecaster, Optimizer and Hedger. Tiebreaker splits its cash evenly between its core and hedge holdings, and its hedge positions consist of long and short equities. Tiebreaker has been able to avoid major market drawdowns while still taking full advantage of subsequent run-ups. Tiebreaker is able to adjust its long/short exposure based on idiosyncratic volatility and risk. Lucena’s Hedge Finder is primarily responsible for driving this long/short exposure tilt.

Tiebreaker Model Portfolio Performance Calculation Methodology Tiebreaker's model portfolio’s performance is a paper trading simulation and it assumes opening account balance of $1,000,000 cash. Tiebreaker started to paper trade on April 28, 2014 as a cash neutral and Bata neutral strategy. However, it was substantially modified to its current dynamic mode on 9/1/2014. Trade execution and return figures assume positions are opened at the 11:00AM EST price quoted by the primary exchange on which the security is traded and unless a stop is triggered, the positions are closed at the 4:00PM EST price quoted by the primary exchange on which the security is traded. In the case of a stop loss, a trailing 5% stop loss is imposed and is measured from the intra-week high (in the case of longs) and low (in the case of shorts). If the stop loss was triggered, an exit from the position 5% below, in the case of longs, and 5% above, in the case of shorts. Tiebreaker assesses the price at which the position is exited with the following modification: prior to March 1st, 2016, at times but not at all times, if, in consultation with a client executing the strategy, it is found that the client received a less favorable price in closing out a position when a stop loss is triggered, the less favorable price is used in determining the exit price. On September 28, 2016 we have applied new allocation algorithms to Tiebreaker and modified its rebalancing sequence to be every two weeks (10 trading days). Since March 1st, 2016, all trades are conducted automatically with no modifications based on the guidelines outlined herein. No manual modifications have been made to the gain stop prices. In instances where a position gaps through the trigger price, the initial open gapped trading price is utilized. Transaction costs are calculated as the larger of 6.95 per trade or $0.0035 * number of shares trades.

BlackDog: BlackDog is a paper trading simulation of a tactical asset allocation strategy that utilizes highly liquid ETFs of large cap and fixed income instruments. The portfolio is adjusted approximately once per month based on Lucena’s Optimizer in conjunction with Lucena’s macroeconomic ensemble voting model. Due to BlackDog’s low volatility (half the market in backtesting) we leveraged it 2X. By exposing twice its original cash assets, we take full advantage of its potential returns while maintaining market-relative low volatility and risk. As evidenced by the chart below, BlackDog 2X is substantially ahead of its benchmark (S&P 500).

In the past year, we covered QuantDesk's Forecaster, Back-tester, Optimizer, Hedger and our Event Study. In future briefings, we will keep you up-to-date on how our live portfolios are executing. We will also showcase new technologies and capabilities that we intend to deploy and make available through our premium strategies and QuantDesk® our flagship cloud-based software.
My hope is that those of you who will be following us closely will gain a good understanding of Machine Learning techniques in statistical forecasting and will gain expertise in our suite of offerings and services.

Specifically:

  • Forecaster - Pattern recognition price prediction
  • Optimizer - Portfolio allocation based on risk profile
  • Hedger - Hedge positions to reduce volatility and maximize risk adjusted return
  • Event Analyzer - Identify predictable behavior following a meaningful event
  • Back Tester - Assess an investment strategy through a historical test drive before risking capital

Your comments and questions are important to us and help to drive the content of this weekly briefing. I encourage you to continue to send us your feedback, your portfolios for analysis, or any questions you wish for us to showcase in future briefings.
Send your emails to: info@lucenaresearch.com and we will do our best to address each email received.

Please remember: This sample portfolio and the content delivered in this newsletter are for educational purposes only and NOT as the basis for one's investment strategy. Beyond discounting market impact and not counting transaction costs, there are additional factors that can impact success. Hence, additional professional due diligence and investors' insights should be considered prior to risking capital.

If you have any questions or comments on the above, feel free to contact me: erez@lucenaresearch.com

Have a great week!

Erez Katz Signature

erez@lucenaresearch.com


Disclaimer Pertaining to Content Delivered & Investment Advice

This information has been prepared by Lucena Research Inc. and is intended for informational purposes only. This information should not be construed as investment, legal and/or tax advice. Additionally, this content is not intended as an offer to sell or a solicitation of any investment product or service.

Please note: Lucena is a technology company and neither manages funds nor functions as an investment advisor. Do not take the opinions expressed explicitly or implicitly in this communication as investment advice. The opinions expressed are of the author and are based on statistical forecasting on historical data analysis.
Past performance does not guarantee future success. In addition, the assumptions and the historical data based on which opinions are made could be faulty. All results and analyses expressed are hypothetical and are NOT guaranteed. All Trading involves substantial risk. Leverage Trading has large potential reward but also large potential risk. Never trade with money you cannot afford to lose. If you are neither a registered nor a certified investment professional this information is not intended for you. Please consult a registered or a certified investment advisor before risking any capital.
The performance results for active portfolios following the screen presented here will differ from the performance contained in this report for a variety of reasons, including differences related to incurring transaction costs and/or investment advisory fees, as well as differences in the time and price that securities were acquired and disposed of, and differences in the weighting of such securities. The performance results for individuals following the strategy could also differ based on differences in treatment of dividends received, including the amount received and whether and when such dividends were reinvested. Historical performance can be revisited to correct errors or anomalies and ensure it most accurately reflects the performance of the strategy.