Welcome to my new series, "The Quant Investor's Log." As a Retail AI Leader, I'm passionate about two things: coding and investing. This series will document my journey of building, refining, and using my own proprietary quantitative models to navigate the complexities of the stock market.
My goal isn't just to chase hot stocks, but to truly understand the intrinsic value of a business. This series is the story of how I taught my AI to think less like a simple calculator and more like a seasoned investment analyst.
It all started when I noticed my carefully crafted stock analysis tool was making some... strange valuation calls. It was dramatically undervaluing quality titans like Microsoft, wildly overvaluing high-risk names like Alibaba, and completely misinterpreting the recovery of cyclical stocks like Delta Air Lines.
These weren't just small errors; they were fundamental misunderstandings of the businesses. It was clear I had to go back to the drawing board.
Coming up in this series:
- Part 1: The Diagnosis - When Good Models Make Bad Calls
- Part 2: The "Quality" Factor - Teaching My Model to Recognize Enduring Greatness
- Part 3: The Art of the Discount Rate - Pricing in Real-World Risk
- Part 4: Taming the Cyclicals - How to Avoid Mistaking a Rebound for a Rocket Ship
- Part 5: The "Brain" of the Operation - Building an Intelligent Growth Rate Selector
Part 1: The Diagnosis - When Good Models Make Bad Calls
Every quantitative investor has a moment of reckoning. A moment when you realize your elegant, logical model has a blind spot. For me, that moment came when I reviewed three valuations that were so off, they forced me to question the very foundation of my DCF model.
Microsoft (MSFT): The Confounding Case of a "Declining" Titan
My model's assessment of Microsoft was the first major red flag. It was convinced that this $3.4 trillion technology behemoth, a company with fortress-like financials and a dominant position in multiple growth markets, was in "decline." The result? A valuation of $1.16 trillion, a staggering 66% below its actual market cap. My model, in its simplistic wisdom, was urging me to sell one of the most successful companies of our time. This was a clear failure to understand that maturity does not equal decline.
Alibaba (BABA): The Euphoria of a Risk-Blind Model
If the model was inexplicably bearish on Microsoft, it was dangerously euphoric on Alibaba. It projected a valuation of $1.2 trillion, more than triple its market cap. The model was screaming "STRONG BUY," completely oblivious to the significant headwinds from Chinese regulators, a slowing domestic economy, and the unique risks associated with its VIE corporate structure. It was a classic case of a model being "right" on the numbers (e.g., historical growth) but completely wrong on the context.
Delta Air Lines (DAL): The Perils of Extrapolating a Recovery
The third major error was with Delta Air Lines. The model saw the massive V-shaped recovery in travel after the pandemic and, like an overeager analyst, extrapolated this temporary rebound far into the future. It ignored the airline industry's notorious cyclicality, capital intensity, and sensitivity to fuel prices. The result was an 84% overvaluation and a "STRONG BUY" recommendation on a stock that demanded a much more cautious approach.
These three errors revealed the critical flaws in my model: it couldn't distinguish quality from size, it was blind to real-world risk, and it had no concept of cyclical mean reversion. The diagnosis was clear: a major overhaul was needed. In the next part, I'll dive into the first fix: teaching my model to finally understand and appreciate quality.
Part 2: The "Quality" Factor - Teaching My Model to Recognize Enduring Greatness
The first and most embarrassing problem I had to solve was my model's bizarre tendency to label high-quality, mature companies as "declining." To fix this, I had to go beyond simple maturity scores and teach the model to recognize the signs of enduring greatness.
The Problem: The model was using a one-dimensional "maturity score" based on factors like market cap and age. Once a company crossed a certain threshold, it was automatically put in the "declining" bucket, with its growth prospects permanently capped. This is why it failed so spectacularly with Microsoft.
The Solution: I replaced the simplistic logic with a more nuanced, 6-category lifecycle classification system. The key innovation was the creation of a quality_mature category. This new category is specifically designed for companies that, despite their large size, still demonstrate:
- Exceptional Profitability: A high Return on Capital (ROC > 20%).
- Healthy Growth: Positive and sustained revenue growth (> 5%).
The Impact: This was a game-changer. With the new quality_mature classification, Microsoft's valuation was transformed.
| Metric | Before Fix | After Fix |
|---|---|---|
| Lifecycle Stage | DECLINING | QUALITY_MATURE |
| Growth Cap | 10% | 12% |
| DCF Valuation | $1.16T (-66% error) | $3.2-3.5T (±5% error) |
By simply creating a category for "great, big companies," the model's accuracy for this entire archetype of stock was dramatically improved. It was the first major step in moving from a naive model to a nuanced one.
The Learning: The first lesson was clear: in investing, quality is a dimension of its own. A great company doesn't just get old and decline; it can sustain excellence at scale. My model now understands this crucial distinction.
In the next part, we'll tackle the most dramatic error: the massive overvaluation of Alibaba and the critical importance of pricing in real-world risk.
Part 3: The Art of the Discount Rate - Pricing in Real-World Risk
If the Microsoft error was a failure to recognize quality, the Alibaba error was a complete failure to recognize risk. My model's $1.2 trillion valuation was a fantasy, born from a risk-blind WACC (Weighted Average Cost of Capital) calculation. This is the story of how I taught my model to be a little more paranoid.
The Problem: The model was using a generic discount rate for all companies, with only minor adjustments for quality. It had no concept of country risk, industry risk, or corporate structure risk. This is why it was so fatally wrong about Alibaba.
The Solution: I built a comprehensive risk premium system from the ground up. The WACC calculation is no longer a simple number; it's a dynamic calculation that adds specific premiums for specific, identifiable risks:
- Country Risk Premium: This is the big one for Alibaba. The model now adds a hefty +4.5% to the WACC for companies operating primarily in China, reflecting the heightened regulatory and geopolitical uncertainty.
- Structure Risk Premium: The model also identifies the VIE (Variable Interest Entity) corporate structure used by many Chinese ADRs, which carries legal and ownership risks. This adds another +2.5% to the WACC.
- Industry Risk Premium: The model now recognizes that some industries are inherently riskier than others. Volatile, cyclical industries like Airlines get a +3.0% premium, while stable industries like Software get no premium.
The Impact: The effect on Alibaba's valuation was nothing short of stunning.
| Metric | Before Fix | After Fix |
|---|---|---|
| WACC | 7.0% | 14.2% |
| Risk Premiums | None | +7.0% (China +4.5%, VIE +2.5%) |
| DCF Valuation | $1.2T (+203% error) | $350-400B (±10% error) |
By adding a dose of real-world risk, the WACC doubled, and the valuation was corrected by a massive 67%. The "STRONG BUY" signal turned into a more sober "HOLD."
The Learning: Risk is not a generic concept. It is specific, measurable, and has a profound impact on valuation. A sophisticated model doesn't ignore risk; it quantifies it.
Now that the model could see both quality and risk, it was time to teach it about the final piece of the puzzle: the powerful, and often deceptive, force of cyclicality. That's coming up in Part 4.
Part 4: Taming the Cyclicals - How to Avoid Mistaking a Rebound for a Rocket Ship
The final major flaw in my model was its naivete in the face of cyclicality. It saw a sharp rebound in a cyclical stock and assumed it was the beginning of a new era of high growth, not just a return to the long-term trend. The case of Delta Air Lines was a perfect example of this flawed logic.
The Problem: The model was taking the post-pandemic recovery growth rate of over 50% and, even after some adjustments, was still using a 12% growth rate in its 10-year DCF. It had no concept of mean reversion or the inherent limits to growth in a mature, cyclical industry.
The Solution: I implemented a system of hard, industry-specific growth caps. This acts as a crucial reality check, overriding any enthusiastic projections based on short-term trends.
- A list of over 40 cyclical industries was created.
- For each of these industries, a conservative long-term growth cap was set. For Airlines, this is 5%. For Oil & Gas, it's 4%. For Auto Manufacturers, it's 5%.
- This cap is a hard constraint. No matter how strong the recent performance, the model cannot use a growth rate higher than this cap for these industries.
The Impact: This fix, working in concert with the WACC risk premiums from Part 3, brought a profound dose of realism to the valuation of cyclical stocks. For Delta Air Lines, the results were transformative.
| Metric | Before Fixes | After Fixes |
|---|---|---|
| Growth Rate | 12.0% (based on recovery) | 5.0% (cyclical cap) |
| WACC | 10.0% (no industry risk) | 13.0% (+3% airline risk) |
| DCF Valuation | $84B (+84% error) | $42-50B (±10% error) |
The combination of a lower growth rate (Fix #4) and a higher discount rate (Fix #3) worked together to correct the valuation by over 80%.
The Learning: You have to respect the cycle. Temporary rebounds are not the same as sustainable growth. By embedding industry-specific knowledge and constraints into the model, I could finally prevent it from chasing cyclical peaks.
With the model now able to understand quality, risk, and cyclicality, there was one final step: to build the "brain" that would intelligently weigh all these new factors. That's the topic of our final post in this series.
Part 5: The "Brain" of the Operation - Building an Intelligent Growth Rate Selector
After fixing the most glaring errors in my model, it was time to tie everything together. I needed to build a central "brain" that could intelligently select the most realistic growth rate for any given company, considering all the new, nuanced factors I had introduced. This led to the creation of the GrowthRateSelector class.
The Problem: Even with the new lifecycle categories and cyclical caps, the model still needed a systematic way to weigh different growth signals: historical performance, analyst estimates, and management's forward guidance. A simple average wouldn't do.
The Solution: The GrowthRateSelector is the culmination of all the previous fixes. It's an 8-step process that brings a new level of sophistication to the model:
Intelligent, Lifecycle-Dependent Weighting: The selector understands that the most reliable growth signal depends on the company. For a mature, high-quality company like Microsoft, it places a heavy 60% weight on management's forward guidance. For a more speculative growth company, it uses a more balanced blend. For a cyclical company like Delta, it heavily discounts the volatile historical growth (only a 15% weight for the 50% recovery number).
Quality Premiums: The selector rewards quality. Companies with a high Return on Capital (ROC) get a premium on their growth rate, allowing them to grow faster for longer. This is another factor that helps the valuation of companies like Microsoft.
Confidence Scoring: This is the feature that truly makes the model feel "intelligent." The selector calculates a confidence score (from 50% to 95%) in its own final growth estimate. A company like Microsoft gets a 95% confidence score due to its high quality and the availability of reliable guidance. A cyclical company like Delta gets a lower 80% confidence score. This is invaluable; it's the model's way of telling me how much to trust its own output.
The Impact: The GrowthRateSelector is what allows the model to produce consistently realistic valuations across all types of companies. It's the brain that synthesizes all the different signals and constraints, from the quality_mature classification to the cyclical growth caps.
The Learning: Building a truly "intelligent" model isn't about creating a black box. It's about creating a transparent system of logical rules that weigh evidence, respect context, and even quantify their own uncertainty.
Conclusion of the Series: The Journey Continues
This journey of transforming my stock valuation model from a naive calculator into a nuanced, risk-aware analysis engine has been one of the most challenging and rewarding projects of my career. It has reinforced a core belief: the process of building, testing, and refining your own tools is one of the most powerful ways to sharpen your investment acumen.
This journey of building and refining my own proprietary model has not only made me a better investor but has also given me a powerful tool that I continue to develop and use for my own research. The "Quant Investor's Log" will continue, and I look forward to sharing more of my findings, experiments, and analyses with you in the future. Thanks for reading.
