
In image recognition a model that is right 99% of the time is ordinary. In US equities, the highest scoring model in the most quoted machine learning study explains 0.40% of next month's return variation. That is out of sample, over 30 years, across about 30,000 stocks. People quote it as proof that ML works. Read it properly and it says something narrower: there is a small signal, it sits in a handful of old ideas, and a model with the right amount of restraint can collect it.
Machine learning is part of how RupeeCase research is done, so this is not a sceptic's essay. It is a map of where ML helps, where it does not, what the main paper measured, and the bookkeeping that keeps a back test honest on Indian data.
- Features with a reasonEconomic priors first, not every column you have.
- Split by timeTrain on the past, test on the future, never shuffle.
- Walk forwardRefit on a rolling window, test on the next block.
- Regularise hardFewer parameters, shallow trees, penalties.
- Untouched hold outA final period nobody looked at during research.
Most ML projects that fail in production fail at step 2. Shuffle financial data at random and the model trains on information from the future.
5By the end you can
- Use the fundamental law (IR ≈ IC × √breadth) to see why a small edge across many bets can be enough.
- Read the Gu, Kelly and Xiu result and turn its R² into a correlation.
- Explain what ridge and lasso do to a coefficient, with a number.
- Purge and embargo overlapping labels, and date every fundamental by its filing, not its period end.
- Estimate how much of a back test's Sharpe ratio is luck from the number of configurations tried.
The term this section turns on: Ridge and lasso
The core problem: signal to noise ratio
In equity return prediction the predictable part of a stock's return is a small fraction of its total variance. A model that calls the direction of monthly returns correctly 55% of the time is genuinely strong. The sharper way to say the same thing is the information coefficient (IC): the correlation between your forecast and the return that follows.
That has a sharp consequence. Models built for high signal problems, deep networks with millions of parameters, are over specified for equity returns. With so little signal, extra capacity goes into memorising noise.
Worked example: why a small edge is enough
The fundamental law of active management, from Grinold (1989), links skill and breadth: information ratio ≈ IC × √(independent bets per year). Suppose your model has an IC of 0.05, barely visible on any single stock. Rank 200 stocks a month and treat about 200 of the 2,400 rankings a year as independent. IR ≈ 0.05 × √200 ≈ 0.71. That is a strong information ratio from a forecast that is wrong almost half the time.

- Returns, lag 1 day−0.01
- Absolute returns, lag 1 day0.19
- Squared returns, lag 1 day0.14
- Absolute returns, lag 5 days0.11
- Absolute returns, lag 20 days0.10
Autocorrelation of Nifty 50 daily log returns, 30 Aug 2024 to 31 Aug 2026, computed by RupeeCase from NSE daily index files.
Read one more paragraph, 70 words
Now the trap. Double the breadth by trading weekly and, on paper, IR rises to about 1.0. In practice weekly trading quadruples turnover, and at 0.100% STT on the purchase and 0.100% on the sale of a delivery trade (NSE schedule, effective 1 Apr 2026), plus stamp duty, exchange charges, GST and market impact, the extra costs can easily exceed the extra edge. Breadth is only free on a spreadsheet.
The sample size problem
Take the Nifty 500 and 20 years of monthly returns: 500 × 12 × 20 = 120,000 observations. It sounds like plenty. It is not, because the observations are not independent. Stocks move together on the same day, positions persist from month to month, and the market changes regime. The effective sample size is a small fraction of the raw count.
Read 2 more paragraphs, 172 words
The count that matters is the number of independent monthly cross sections, and that is 12 a year, whatever the number of stocks. Say a signal has a monthly IC with a standard deviation of 0.10. Over 120 months the standard error of its average is 0.10 / √120 = 0.009, so an average IC of 0.03 has a t statistic near 3.3. Over 36 months the standard error is 0.017 and the same 0.03 gives a t of 1.8. Same signal, same skill, different verdict, because three years is not enough data to tell.
Indian data is shorter than US data: Gu, Kelly and Xiu use 60 years of US returns, while the Indian machine learning study covered below uses 1994 to 2019. Fewer years means fewer independent cross sections, and a bigger penalty for every extra parameter. So complex models are almost always over fitted on financial data. The answer is not to avoid ML. It is to use regularised, parsimonious models and validate them on data they never touched.

The research model: what Gu, Kelly and Xiu built
Gu, Kelly and Xiu (2020) compare thirteen methods on one problem: forecast each stock's excess return next month from information known at the time, using a function g of that stock's features z.
R2oos = 1 - SSE / SS0
SSE = sum (r - rhat)^2
SS0 = sum r^2
Every choice in the set up is one you will face on NSE data.
- Sample. March 1957 to December 2016, almost 30,000 US stocks, more than 6,200 in an average month.
- Features. 94 stock characteristics (61 updated annually, 13 quarterly, 20 monthly), 74 industry dummies and 8 market wide variables. Interacting each characteristic with the 8 market variables and a constant gives 94 × (8 + 1) + 74 = 920 inputs.
- Scaling. Each characteristic is ranked across stocks every month and mapped to the interval from −1 to 1, so outliers cannot dominate.
- Publication lags. Monthly characteristics are delayed by at least 1 month, quarterly ones by at least 4 months, annual ones by at least 6 months, so the model never uses a number before the world could have seen it.
- Time split. 18 years to train (1957 to 1974), 12 to validate (1975 to 1986), 30 to test (1987 to 2016). The models are refit once a year, each time adding a year of training data. The authors do not use random cross validation, to keep the time order.
₹100 in Dynamic Asset Allocator became about ₹393 in the model
The headline table is the out of sample R² per month, pooled over all stocks, and then for the largest and the smallest 1,000 stocks each month.
| Model | All stocks | Top 1,000 | Bottom 1,000 |
|---|---|---|---|
| OLS, all 920 inputs | −3.46% | −11.28% | −1.30% |
| OLS, size, value, momentum | 0.16% | 0.31% | 0.17% |
| Elastic net | 0.11% | 0.25% | 0.20% |
| Random forest | 0.33% | 0.63% | 0.35% |
| Boosted trees | 0.34% | 0.52% | 0.32% |
| Neural net, 3 layers | 0.40% | 0.70% | 0.45% |
Monthly out of sample R², 1987 to 2016. Gu, Kelly and Xiu (2020), Table 1; the elastic net, boosted trees and OLS rows use the paper's Huber loss versions.
Read 2 more paragraphs, 149 words
Read it in order. Plain OLS on all the inputs scores −3.46%: worse than forecasting zero for every stock. A three variable OLS (size, value, momentum) scores +0.16%. The nonlinear models roughly double that: 0.33% to 0.40%. Deeper is not better: the paper finds that networks with four and five layers fail to improve on three, and its table shows 0.39% and 0.36%. And the gains are larger among big stocks (0.70% for the three layer net), which answers the worry that the result only reflects illiquid microcaps.
Turn 0.40% into a correlation. If R² is roughly the square of the IC, a model with R² of 0.40% has an IC near √0.004 = 0.063. Put that in the fundamental law with 200 independent bets: IR ≈ 0.063 × √200 ≈ 0.89 before costs. A small number of correlation points, spread across thousands of stocks, is the entire prize.
Which inputs carried the signal
The models agree on what matters. Four groups lead: price trends (one month reversal, 12 month momentum, industry momentum, 36 month reversal), liquidity (turnover, size, dollar volume, the Amihud illiquidity measure, the bid ask spread), risk (volatility, beta), and, further down, valuation and fundamentals such as earnings to price and asset growth. Penalised linear models lean most on momentum and reversal; trees and networks draw from a wider set. These are the ideas of Module 3.1 (momentum) and Module 3.4 (low volatility). The machine did not find a new factor family. It found better ways to combine the old ones.
Two terms to hold on to from 5.3
From forecast to portfolio, and what it cost
The authors sort stocks into ten groups each month by predicted return, weight them by market value, and hold the top group long and the bottom group short. The strongest long short result was the four layer network: an average of 2.3% a month, with monthly volatility of 5.8%, an annualised out of sample Sharpe ratio of 1.35.
Read one more paragraph, 137 words
The same table carries the bill. Average monthly turnover (the average monthly change in holdings) is 123.5% for the three layer network and between 110% and 130% for neural networks generally, against 58.2% for the three variable OLS. For scale, the paper puts a one month reversal decile spread at 172.6% a month and a size decile spread at 22.9%. Two Indian readings follow. First, at 0.100% STT on each side, high turnover is expensive. A portfolio that replaces 50% of its value each month pays 0.5 × (0.100% + 0.100%) = 0.10% a month in STT alone, 1.2% a year, before stamp duty, exchange and SEBI charges, GST and impact. Second, a long short portfolio is not available to a cash market investor who takes delivery. The short leg is part of what the paper measured.
What later work found
Harvey, Liu and Zhu (2016), looking at hundreds of published factors, argue that a newly discovered factor needs a t statistic above 3.0, not the usual 2.0, once the number of tests is counted. Hou, Xue and Zhang, in the working paper version of "Replicating Anomalies", test 447 anomaly variables with value weights and breakpoints that limit the influence of microcaps: 286 of them (64%) are not significant at the 5% level, and 380 (85%) fail a t hurdle of 3. A model trained on 94 published characteristics inherits whatever weakness is in that library. Machine learning improves the combining. It does not improve the ingredients.
Shrinkage: the baseline that is hard to beat
In the table, the one move that fixes plain OLS is restraint: three variables, or a penalty. Penalised regression adds a cost for large coefficients, so the data has to earn every one it uses.
Ridge: min SSE + L*sum(b^2)
Lasso: min SSE + L*sum|b|
Elastic net: a mix of the two
Where this section sits in module 5.3
Worked example: shrinking one coefficient
An illustration with made up inputs. One standardised feature, 240 stock months, an OLS coefficient of 0.050. For a single standardised input, ridge gives the OLS coefficient times n / (n + L), where n is 240 here. A heavier penalty keeps less of it.
| Penalty L | Share kept, n/(n+L) | Ridge coefficient |
|---|---|---|
| 0 | 1.00 | 0.050 |
| 60 | 0.80 | 0.040 |
| 240 | 0.50 | 0.025 |
| 480 | 0.33 | 0.017 |
Illustration. n = 240, OLS coefficient 0.050. Lasso instead subtracts a fixed amount: with a threshold of 0.06 the same coefficient becomes exactly 0, and the feature leaves the model.
Read 2 more paragraphs, 148 words
That last line is the useful intuition. Lasso asks whether a feature's estimated effect is bigger than the cost of keeping it. In Gu, Kelly and Xiu, the elastic net typically kept fewer than five features in the first ten years of the test period, and between 20 and 40 after 2000. The market gave the model more evidence over time, and the model used more of it.
The wider lesson comes from forecasting the market itself. Welch and Goyal (2008) re-examined the variables proposed as predictors of the equity premium and found that they had "predicted poorly both in-sample and out-of-sample for 30 years", that the models looked unstable, and that they would not have helped an investor with only the data available then to time the market. A good forecasting model has to beat a naive forecast on data it has not seen. Most do not.
What actually works in practice

The honest bottom line: a well built rule with an economic reason, careful costs and disciplined rebalancing beats a complex model most of the time. ML earns its place in search, feature construction and text processing. It never replaces the question of why a signal would keep working.
Feature engineering from Indian prices and fundamentals
Features are where Indian data needs the most care, because the same idea is easy to compute wrongly. A starter set:
Rev = P(t)/P(t-1) - 1
Vol = stdev(daily r) * sqrt(252)
Dist = P / max(P, 252d) - 1
Illiq = mean(|r| / value)
Four rules keep these honest.
- Adjust for corporate actions. A 1 for 1 bonus halves the quoted price. Unadjusted, it reads as a 50% crash and gets ranked last.
- Rank, do not scale. Rank each feature across stocks every month and map the ranks to the range from −1 to 1, as the US study does: x = 2 × (rank − 1) / (N − 1) − 1. Thin trading and price band moves create extreme values that ranks absorb.
- Treat missing as information. A company that has not yet filed is not an average company. Fix the fill rule before you see returns.
- Date every fundamental by its filing. This is the next section.

A worked rank, as an illustration with made up returns: five stocks with 12 minus 1 returns of 38%, 12%, 5%, −3% and −20% rank 5, 4, 3, 2, 1. The formula maps them to 1.0, 0.5, 0.0, −0.5 and −1.0. Stock C: 2 × (3 − 1) / 4 − 1 = 0.
Read one more paragraph, 103 words
Does this work on Indian stocks? Lalwani and Meshram (2022) are the closest published test I could verify. Per the abstract, they study 35 stock characteristics on a survivorship bias free sample of listed Indian firms from 1994 to 2019, find 14 characteristics with Fama-MacBeth t statistics above three, and then use machine learning to build rolling one month ahead out of sample forecasts that are substantially more accurate than OLS, with investment strategies on those forecasts earning significant returns. I have read the abstract, not the full paper, so I quote no further numbers from it. Read it before leaning on it.
Validating without fooling yourself
Split by time, then purge
The rule is simple: train on the past, test on the future. The detail that breaks it is overlap. Suppose the label for date t is the return over the next 21 sessions. Neighbouring labels share 20 days of the same future. If the training period ends at session T and the test starts at T + 1, the labels of the last 21 training dates reach into the test period.
Train ends T, test starts T+1
Label touches test if t >= T-20
Purge t = T-20 to T: 21 rows
Embargo: 5 more sessions
López de Prado (2018) calls the k-fold version of this purged cross validation with an embargo. In a pure walk forward test you need the purge only at the boundary. You still need it, and most first attempts forget.

Dates for Indian fundamentals
The US study assumes quarterly numbers are known 4 months after the period and annual numbers 6 months after. In India the listing rules set outer limits: quarterly results within 45 days of quarter end, annual audited results within 60 days of year end (SEBI LODR Regulation 33, as amended to 15 Oct 2026). That is a latest date, not the usual one. Large companies file earlier and the exchange stamps each filing, so the timestamp is the right "known from" date.
| Period | Period end | Latest filing | Days allowed |
|---|---|---|---|
| Q1 FY26 | 30 Jun 2025 | 14 Aug 2025 | 45 |
| Q2 FY26 | 30 Sep 2025 | 14 Nov 2025 | 45 |
| Q3 FY26 | 31 Dec 2025 | 14 Feb 2026 | 45 |
| FY26 annual | 31 Mar 2026 | 30 May 2026 | 60 |
Dates computed from Regulation 33 limits. A feature built from Q3 FY26 earnings enters the model on the day the filing is stamped, not on 31 Dec 2025.
A model that uses the 31 December figure on 1 January has seen up to six weeks into the future for a slow filer. That alone can turn an average back test into a spectacular one.
How many tries did it take
The second leak is the one you commit yourself. Try 100 configurations and keep the one with the highest Sharpe ratio, and that Sharpe ratio is inflated by the selection. Bailey and López de Prado (2014), in the Deflated Sharpe Ratio paper, give the expected maximum of N independent trials whose true Sharpe ratio is zero: the standard deviation of the trials times ((1 − γ) × Φ⁻¹(1 − 1/N) + γ × Φ⁻¹(1 − 1/(N × e))), where γ ≈ 0.5772 is the Euler-Mascheroni constant and Φ⁻¹ the inverse normal. Call the bracket z.
Dynamic Asset Allocator fell at most 6.0% below its model high, month end to month end
| Tries N | z | Luck, 5 years | Luck, 10 years |
|---|---|---|---|
| 10 | 1.58 | 0.70 | 0.50 |
| 50 | 2.28 | 1.02 | 0.72 |
| 100 | 2.53 | 1.13 | 0.80 |
| 1,000 | 3.26 | 1.46 | 1.03 |
Computed from the Bailey and López de Prado formula, for independent trials with a true Sharpe ratio of zero. Annualised Sharpe ratios.
Read 2 more paragraphs, 100 words
For a track record of Y years the standard error of an annualised Sharpe ratio near zero is about 1 / √Y (Lo, 2002), so the luck to expect from the highest of N tries is z / √Y.
Read the row for 100 tries and 5 years. A Sharpe ratio of 1.13 is what luck alone hands you as the winner. A back test that reports 1.1 from 100 configurations and 5 years of data has told you nothing. This is the same multiple testing problem that Module 5.1 develops, and the answer is the same: count your tries.
The probability of backtest overfitting
Bailey, Borwein, López de Prado and Zhu give a test that needs no assumption about the shape of returns. Record the return series of every configuration you tried. Cut the history into S equal blocks, say 16. Choose half the blocks (8) as a training set, find the configuration with the highest in sample Sharpe ratio, and check where that same configuration ranks among all the configurations on the other 8 blocks. Repeat for every way of choosing half the blocks: C(16, 8) = 12,870 splits. The probability of backtest overfitting is the share of splits in which the in sample winner lands below the median out of sample.

Read one more paragraph, 46 words
A value near 50% means the in sample winner does no better than a coin flip. A real signal pushes it toward zero. The method is called combinatorially symmetric cross validation. The same authors' 2014 paper sets out how backtest overfitting damages out of sample performance.
From a learned model to a fixed, published rule
A learned model is a research tool. A rule that ships passes five gates, in this order.
Cost belongs in step 2. Run the walk forward with STT of 0.100% on the purchase and on the sale, stamp duty, exchange charges, GST and an impact allowance inside every trade. A signal that turns over 120% a month clears a far higher bar than one that turns over 20%.
Leakage: the silent killer
Leakage means information from the future sneaking into training. It produces spectacular back tests and live disasters. The common Indian forms:
- Overlapping labels. Predict 21 day forward returns every day, and neighbouring labels share 20 days of the same future. A random train test split puts near copies of test rows in training. Purge the overlap and add an embargo between training and test periods.
- Restated fundamentals. Using the restated version of a company's past results instead of what was filed on the day. Use data as of the filing timestamp, which is within 45 days of quarter end, or 60 days for the year end, under SEBI's listing rules.
- Survivorship. Training only on stocks that are still listed drops every company that was delisted or went bust. The model learns that falling stocks recover.
- Index membership. Using the current Nifty 500 list for a 2015 back test. Membership must be point in time; NSE reviews its indices twice a year.
- Whole sample scaling. Computing a mean or standard deviation over the full history before splitting. Fit every scaler on training rows only.
- Peeking at the test set. Choosing a penalty or stopping point because the test score improved. After that the test set is training data.
MythA more complex model finds more alpha.
FactWith weak signals and short, overlapping data, extra complexity mostly fits noise. In the largest US test, plain OLS on every input lost to a forecast of zero, and networks stopped improving after three layers.
The Derivatives School has the longer version: Financial machine learning done carefully, with purging and embargo worked through, and the short answer page Does machine learning work for trading?
Common mistake: reporting the top result of many models
The common mistake is not a bad model. It is a good looking one picked from hundreds. Every hyper parameter tried, every feature set tested, every random seed is another draw. Report the top result and you have a multiple testing problem wearing an ML costume. Module 5.1 has the maths, and Module 5.5 shows how to build a test that survives it.
Read one more paragraph, 40 words
The defence is bookkeeping. Write down every configuration you try, with the date. Judge the final choice on a hold out period you have never looked at. And discount the result for the number of tries, because the market will.
How this shows up in RupeeCase
Machine learning is used in RupeeCase research to search and optimise the model behind each strategy: which signals rank the universe, how many names to hold and how often to rebalance, tested out of sample. The rule that ships is then frozen and published, so the live strategy is a fixed, readable algorithm, not a black box that changes on its own. Every rebalance is published, and every return figure is labelled model, back tested. Read the methodology on any strategy page, for example Large Midcap, and the rest of the record on the track record page.
Key takeaways
- In US equities, 30 years out of sample, the highest scoring model explains 0.40% of monthly return variation: an IC near 0.06.
- An IC of 0.05 across about 200 independent bets a year gives an IR near 0.71, before costs.
- Plain OLS on all 920 inputs scored −3.46%, worse than forecasting zero. Restraint, by a penalty or by choosing three variables, is what repairs it.
- Gains came from nonlinear models, stopped at three layers, and sat in momentum, liquidity and volatility.
- Date fundamentals by their filing: 45 days after a quarter, 60 after the year, at the latest.
- The highest of 100 tries over 5 years: a Sharpe ratio of about 1.13 comes from luck alone.
- RupeeCase uses ML in research and then freezes the published rule.
Questions readers ask
Can AI predict the stock market?
Not the way headlines suggest. Models can find small, persistent tilts across many stocks, which is valuable at scale. No model reliably predicts the direction of a single stock or the index tomorrow, and anyone showing very high accuracy on Indian returns is almost certainly showing an over fitted back test.
Is a machine learning fund better than a factor fund?
Not by label. Judge any strategy on its rules, its out of sample evidence, its costs and its drawdowns. ML is a research method; it does not make a strategy safer or better by itself.
Why freeze a model instead of letting it learn every day?
A model that refits itself constantly is hard to audit and easy to over fit to recent noise. A frozen rule behaves the same way in the live market as in its tests, and every decision it makes can be checked against the published rule.
Why not use random cross validation on stock returns?
Because neighbouring rows share information. A 21 day forward label on Monday and the one on Tuesday overlap on 20 days. Shuffled folds put near copies of test rows in training, and the score looks far better than live results will. Split by time, purge and embargo.
