<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Nikita Gupta on Medium]]></title>
        <description><![CDATA[Stories by Nikita Gupta on Medium]]></description>
        <link>https://medium.com/@gupta.nikita0801?source=rss-ece3510a58c9------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*KiK_FsYdF2STvwqM1moeJA.jpeg</url>
            <title>Stories by Nikita Gupta on Medium</title>
            <link>https://medium.com/@gupta.nikita0801?source=rss-ece3510a58c9------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 06:05:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gupta.nikita0801/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[The World’s Most Expensive Bottleneck: Second Edition]]></title>
            <link>https://medium.com/culture-data-science/the-worlds-most-expensive-bottleneck-second-edition-2f9b9bb309df?source=rss-ece3510a58c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/2f9b9bb309df</guid>
            <category><![CDATA[lstm]]></category>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[geopolitics]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[risk-management]]></category>
            <dc:creator><![CDATA[Nikita Gupta]]></dc:creator>
            <pubDate>Thu, 16 Jul 2026 15:07:56 GMT</pubDate>
            <atom:updated>2026-07-16T15:07:56.245Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Written by </em><a href="https://medium.com/@gupta.nikita0801"><em>Nikita Gupta</em></a><em> and </em><a href="https://medium.com/@yashvg.ai"><em>Yash Vardhan Gupta</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N_fWYMsKXEcb3Eu_RkKEew.png" /></figure><p>Haven’t read v1 yet? Start here: <a href="https://medium.com/culture-data-science/the-worlds-most-expensive-bottleneck-3d86aec769cc">The World’s Most Expensive Bottleneck</a> , this piece builds directly on it.</p><blockquote><strong><em>A note before you read</em></strong><em>: we built this after the Strait of Hormuz had already closed. There was no hypothetical to test: the crisis came first, and the model came after, built from general structural data rather than this specific event. What follows is the story of what we built, and how well a structural model: never tuned to this crisis, held up against what actually happened.</em></blockquote><p>On February 28, 2026, the United States and Israel launched airstrikes on Iran. Within days, the IRGC issued warnings forbidding passage through the Strait of Hormuz, boarded merchant vessels, and laid sea mines in the channel. By May, open transits had fallen to near zero. The strait that carries 20% of the world’s seaborne oil closed.</p><p>We did not see it coming, and we are not going to pretend otherwise. What we did was sit down afterward and ask a narrower question: could a structural model of this network: built from general data about pipeline capacity, historical war-risk premiums, and shipping routes, not from this specific event: say anything useful about a crisis it was never trained on?</p><h3>Where V1 Left Off</h3><p>If you haven’t read v1, a quick orientation.</p><p>We built the global oil supply chain as a directed graph: 19 nodes (Gulf producers, maritime chokepoints, ocean waypoints, consuming regions) connected by 25 directed edges (shipping lanes and pipelines), each carrying real numbers for cost, transit time, throughput capacity, and a time-varying risk score. We then asked: what does optimal routing look like when “optimal” includes risk, not just cost?</p><p>The answer was a modified Dijkstra algorithm : the same shortest-path logic used by every GPS, but with edge weights redefined as cost + α·time + λ·risk. As the risk aversion parameter λ rises, dangerous routes become “expensive” in the algorithm’s view, until at a precise threshold λ* the algorithm abandons Hormuz entirely and reroutes via Yanbu and the Cape of Good Hope. That threshold : the exact point where the bypass becomes cheaper in risk-adjusted terms , is the price of resilience.</p><p>We added a Monte Carlo stress-tester (500 random crisis scenarios) and an economic cascade model tracing a Hormuz disruption through oil prices, freight premiums, consumer inflation, food prices, and GDP across five global regions. v1’s app also quietly shipped an experimental Q-learning routing agent- we never wrote about how it worked. That gap gets closed below, right before we replace it.</p><blockquote>V1 answered the question: <em>given a crisis, what do you do?</em></blockquote><blockquote>V2 asks: <em>can you see the crisis coming before it arrives?</em></blockquote><h3>What Actually Matched</h3><p>The bypass gap was real and showed immediately , the Saudi East-West pipeline hit its 7 MBD capacity milestone in March, exactly the figure we used from general EIA data. Our model still underestimated it, though: about 3 of those 7 MBD are consumed domestically, so real net export capacity is closer to 4 MBD. Against 20 MBD of disrupted Hormuz flow, the real bypass gap isn’t 65%. It’s closer to 80%.</p><p>The cascade unfolded in the sequence we modelled too , oil toward $98–132/barrel, war-risk premiums from 0.125% to 2.5% of hull value (10% for some stranded tankers), then consumer prices, then the IMF cutting growth forecasts, East Asia scrambling for supply while the U.S. stayed comparatively insulated.</p><p>The λ switchover happened in hours: every major carrier went to Cape of Good Hope routing the moment Hormuz became genuinely dangerous, crossing the same risk-adjusted threshold our algorithm identifies.</p><p>And the leading signals were there, visible only in hindsight , sentiment deteriorating, AIS data showing unusual vessel clustering, premiums already rising before the strikes. We only saw this by looking backward. It’s exactly what convinced us to build the LSTM into v2.</p><h3>What we didn’t capture: and what we are building into v2 next.</h3><p>Private insurers didn’t just raise prices, they withdrew entirely , P&amp;I cover for Gulf transits was cancelled from March 5, a different category of risk than our cascade model accounts for.</p><p>Governments became insurers of last resort, with the U.S. International Development Finance Corporation offering up to $40B in political risk reinsurance, sovereign capital backstopping commercial shipping risk, a dynamic our model doesn’t have.</p><p>The Saudi East-West pipeline: the bypass we called the most important alternative, got attacked itself in early April, revealing that our static graph assumes edges can’t disappear during the crisis they exist to mitigate.</p><p>And the economic tail was worse than our 95th percentile: we modelled worst-case GDP impact at −2.5% to −4.0%; the Dallas Fed’s Q2 2026 estimate came in at −2.9% annualised, with prolonged-disruption projections reaching −4.38% ($4.81T) at risk.</p><blockquote>The structure generalised further than we expected for a model that had never seen this crisis. The exact numbers we still had to borrow from general data: close enough to be useful, not close enough to trust blindly.</blockquote><h3>The V2 Story</h3><p>On September 14, 2019, two drone strikes hit the Abqaiq oil processing facility in Saudi Arabia. Within hours, 5% of the world’s daily oil supply had vanished. By the time markets opened, Brent crude had jumped 15% , the largest single-day move in history.</p><p>Here is what is less often discussed: <strong>the shipping industry had seven days of warning beforehand</strong>, in news tone, insurance movements, quiet repricing on Gulf routes. Most didn’t act. They waited for the price to move, and by the time it did, the window had closed.</p><p>That is the problem v2 is built to solve.</p><p><strong>v1 </strong>reacted to risk values it was told, with no way to read the sentiment drop, the insurance repricing, the futures volatility that precede a crisis, and turn them into a routing decision before the peak.</p><p><strong>v2</strong> is the attempt to build that. Two upgrades, not independent of each other. One to <strong><em>perception</em></strong> : replacing the hand-coded risk formula with a neural network that learns to predict rising risk from signals, the way a Lloyd’s underwriter reads the same signals before pricing a Gulf transit. One to <strong><em>generalisation</em></strong><em>: </em>replacing the Q-table that knew only what it had seen with a Deep Q-Network that reasons about conditions it has never encountered.</p><p>The goal, in one sentence: route seven steps before the market knows it’s time to.</p><h3>What V2 Looks Like in Practice</h3><p>Like v1, the whole thing runs in a Streamlit browser app. The additions are in three tabs.</p><p><strong>The Training tab-</strong> is where the LSTM learns: generate a synthetic dataset, train over 120 epochs, watch the loss converge, then see a per-edge RMSE table (Cape of Good Hope: easy, barely moves; Hormuz: hard, sharp crisis spikes).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_J70Iq92t3JotAE8AVAVqA.png" /></figure><p><strong>The DQN Agent tab-</strong> is where both routing agents live, in sequence. First, train the Q-learning baseline and watch it fit its 95-state table in a few hundred episodes. Then train the DQN for 600 episodes and watch the reward curve climb: from large-negative values when the agent wanders randomly, to a stable plateau when it has learned to reach the target reliably via low-risk paths. Run the greedy policy for both and compare them against Dijkstra on the current graph, side by side. Under normal conditions, all three tend to agree. Under crisis conditions, the DQN reroutes earlier , and the Q-learning agent’s table-lookup limits become visible.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*z3S6TjrF5ILsGm6bb_ovdg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8mfpYwgukeKDw9qq0k985w.png" /></figure><p><strong>The Model Internals tab </strong>shows you inside the system while it runs: the LSTM’s per-edge risk forecast alongside the current graph risk (the gap between them is the actionable signal), the DQN’s Q-value heatmap (which nodes does the agent currently prefer from each position?), and the exploration rate ε decaying toward zero as training progresses.</p><p>Everything else, network map, route finder, risk simulator, stress test, cascade, is unchanged from v1. Only the risk engine and routing agent are new.</p><p>Now lets breakdown each component in detail</p><h3>Step 1: Learning to Read Signals</h3><p>Before building the LSTM, we had to decide what it would read. And for that, we had to answer a prior question: what does geopolitical risk actually look like before it shows up as a number?</p><p>It doesn’t announce itself. It leaks: through four types of signals, each moving at a different speed.</p><p><strong>Sentiment moves first-</strong> Language in news headlines and diplomatic statements tightens before a crisis materialises. A trained classifier reading Reuters and shipping advisories can detect escalatory language 3 to 5 timesteps before market prices fully reflect it. Sentiment is a <em>leading indicator</em>: it doesn’t tell you how bad things will get, but it points in the right direction before anyone has finished pricing it in.</p><p><strong>Oil volatility moves concurrently- </strong>When the risk of a Hormuz disruption rises, crude futures volatility co-moves almost immediately. Options markets are fast. Volatility is a <em>concurrent indicator</em>: it confirms the event but doesn’t anticipate it.</p><p><strong>Insurance premiums lag- </strong>Lloyd’s and the P&amp;I clubs reprice off a rolling window of incident data, 7 to 10 timesteps <em>behind</em> the actual peak: accurate eventually, useless for timing</p><p><strong>Risk itself is latent: you can’t observe it directly- </strong>You back it out from these signals, the way a doctor estimates cardiovascular risk from blood pressure, cholesterol, and lifestyle data rather than from a number stamped on the patient. There is no public feed that says “Hormuz risk: 0.73.”</p><blockquote>The insight this gives you: a model using sentiment as input can begin predicting rising risk before insurance has repriced, and a routing agent acting on predicted risk, not current risk, reroutes before the market tells it to. That’s seven steps of advance warning, in practice.</blockquote><h3>Step 2: Building a Memory</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B-gYP3VTg6nU_nLFFkilPg.png" /><figcaption>LSTM Architecture</figcaption></figure><p>The right model here holds information across time. It remembers what sentiment looked like 5 steps ago and what that usually means for premiums 7 steps out. That’s what an LSTM (Long Short-Term Memory network) is for. A standard network processes each input independently; feed it tomorrow’s values and it has no memory of today. Wrong for lag structure.</p><p>An LSTM reads a sequence one step at a time and carries a <em>memory cell</em> across timesteps, governed by three gates: forget (what fraction of old memory to erase), input (what new information to store), output (what to expose as the prediction). The result learns to hold sentiment for 5 timesteps, weight it appropriately, and discount insurance as a lagging confirmatory signal rather than a predictive one, none of it hand-coded, all of it learned from data.</p><p>Two choices worth naming.</p><ul><li><strong>Sigmoid output: </strong>risk lives in [0,1] by construction, and a saturating model gives a qualitatively different signal than a calibrated one.</li><li><strong>Two LSTM layers: t</strong>he first extracts local patterns while the second captures the multi-step relationship between a sentiment drop and an eventual reprice; single-layer LSTMs underfit this in testing.</li></ul><p>The model trains on 1,989 sequences from a 2,000-step synthetic dataset, converging from a validation MSE of 0.045 to 0.005 over 120 epochs with no overfitting. The real test isn’t the loss, though. It’s whether the lag structure was actually learned. <strong>Diagnostic inspection confirms it was: when sentiment drops in the input window, the LSTM predicts elevated Hormuz risk before the insurance premium in that same window has moved.</strong></p><blockquote>The conclusion: the LSTM turns four observable signals into a calibrated forecast of next-step risk across all 24 edges. It doesn’t know what will happen. It knows what the signals have historically meant, and acts on that.</blockquote><h3>Step 3: Teaching the Agent to Generalise</h3><p>At each node, the agent chooses which neighbour to move to next, balancing cost, time, and risk. We first developed a tabular Q-learning agent for this, and then replaced with Deep Q-Network. Lets dive deep!</p><h4>How Q-Learning Actually Works</h4><p>Think of it like learning to drive in a city you’ve never seen: you turn randomly at first, and over time build an intuition for every intersection, not a memorised path. In driving terms, the state is your corner and how bad the traffic looks; the action is which street you take; the reward is how that turn worked out (cheap and safe feels good, arriving is worth a bonus); the goal is to feel good across the whole trip, not win any one turn.</p><p>Formally, that’s a <strong>Markov Decision Process</strong>: <strong>state, action, reward `-(cost + 40·risk + 2·time)` plus 100 for reaching the target,</strong> and the goal of maximising total reward.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fJgnV8hds8pHA0wGH1KDwg.png" /></figure><p>The agent learns a <strong>Q-function Q(s,a),</strong> your gut-feel rating for “turning this way, given today’s traffic.” Every actual turn nudges that rating, rather than replacing it outright. That nudge <strong>is the Bellman update:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Y2_d4CrYRNuYux8vkBBjHw.png" /></figure><p>where, α (learning rate, 0.15) is how much one trip can move your opinion: low α is a stubborn driver, high α overreacts to every fluke. γ (discount factor, 0.9) is how much weight you give the rest of the journey beyond this turn. The bracketed term is the TD (Temporal Difference) error, the surprise, the gap between what you expected the turn to be worth and what it actually was, which drives the correction.</p><p><strong>Notice Q appears on both sides of its own update. </strong>Today’s rating for a turn depends on tomorrow’s rating for the turns after it. There’s no clean formula to solve for Q directly; you just apply the update, turn after turn, until the numbers stop moving. That’s what “training” means here, mechanically.</p><blockquote><em>The equation is named for Richard Bellman, who formalised this recursive structure for dynamic programming in the 1950s, long before anyone used it to route oil tankers.</em></blockquote><p>Training itself balances explore versus exploit: with probability ε you take a random turn just to see where it leads, otherwise you take the turn you already trust. ε starts at 0.5 and decays to 0.05, so the agent wanders early and commits later. What it ends up with is a policy table, a lookup mapping (node, risk level) to best next node, instantly recalled rather than recalculated.</p><h4>Why the Q-table Broke</h4><p>The learner-driver above never learned the whole city’s traffic, only one road’s report (how bad is Hormuz right now?), used as a stand-in for everywhere. That’s why the notebook stayed thin: 19 intersections times 5 traffic levels equals 95 pages, memorisable in an afternoon.</p><p>Now imagine the city hands you a live report for 24 different roads at once, and asks for a hunch covering every combination. That’s not a notebook anymore. It’s 19 × ⁵²⁴ ≈ 60 trillion pages, and no driver fills that in a lifetime of trips, let alone a few hundred training episodes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*68GSxRZkamXmdCid9Qc-Tg.png" /></figure><p>For every unvisited state, the Q-table returns 0, and argmax picks the first neighbour in dictionary order: deterministic, but meaningless, like a driver hitting a blank notebook page and turning left every time simply because “left” is listed first. In a crisis, when novel risk combinations are most likely, this is exactly when it matters.</p><p>At test time, a tabular agent run against the full 24-edge state produced random-equivalent paths for roughly 40% of novel configurations.</p><h4>How the DQN Fixes It</h4><p>The DQN replaces the table with a neural network that approximates Q(s,a) as a continuous mapping instead of storing it:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pLmF03mJBk5HqWkYTjgUig.png" /></figure><p>A state it’s never seen isn’t a cold miss. It interpolates from similar states in the space where it trained. Severity 0.91 benefits from what the network learned at 0.88 and 0.94, degrading gracefully instead of collapsing to zero. At test time, the DQN produced the correct bypass route in 100% of tested crisis scenarios, including risk combinations never seen during training.</p><h4>Making Training Stable</h4><p>Training naively, updating on each transition as it happens, fails for two reasons, each with a standard fix.</p><ul><li><strong>Correlation: </strong>consecutive transitions share context (same graph, same episode), biasing the gradient toward recent trajectories. Fixed with an <strong><em>experience replay buffer</em></strong>, a 10,000-transition circular deque, sampling 64 at random per step, decorrelated and drawn from around 700 different episodes.</li><li><strong>Moving targets:</strong> the Bellman target uses the same parameters being updated, so the target shifts with every gradient step and Q-values can oscillate or diverge. Fixed with a <strong>frozen target network</strong>, a second copy, hard-synced from the policy net every 100 steps, giving the network something stationary to converge toward.</li></ul><p>One more choice:</p><ul><li><strong>Huber loss instead of MSE,</strong> since early TD errors are large and noisy. MSE would amplify them into gradient spikes, while Huber caps the gradient during that chaotic early phase, reducing TD error variance by about 60% in the first 100 episodes.</li></ul><blockquote><strong>The conclusion: </strong>the DQN solves the scaling problem the table couldn’t, generalising by interpolation instead of enumeration, and trains stably because replay and the target network eliminate the two root causes of naive deep RL instability.</blockquote><h3>Step 4: Connecting the Pieces</h3><p>The LSTM and DQN are coupled, not independent. On every tick: the LSTM reads the last 10 timesteps of risk, volatility, insurance, and sentiment across all 24 edges, and produces a predicted risk vector for the next step. That vector gets written directly into the graph,</p><blockquote><strong>G[u][v][“risk”] = LSTM_prediction</strong></blockquote><p>so the graph reflects forecast risk, not current risk. The DQN builds its state vector from the updated graph and picks the highest-Q reachable action. Dijkstra, running in parallel, reads the same updated weights and finds the minimum-weight path, but only the DQN was trained to route on what the forecast implies, across 600 episodes. Dijkstra just minimises current cost.</p><p>Eg if you interact with the- <strong><em>One Click Divergence Demo </em></strong>under the DQN Tab<strong><em>:</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lt6nbWUHfaVPKyelVtOCVA.png" /></figure><p>All three algorithms are looking at the exact same graph, same current risk numbers (Hormuz baseline, calm: Max Risk 0.28, Avg Risk 0.165), except DQN, which is instead routing on the LSTM’s forecast (built from the crafted window where sentiment is already falling, even though nothing else has moved yet).</p><p>The result is the divergence the whole blog is built around:<br>- Dijkstra and Q-Learning both walk straight through Hormuz (Hormuz Exposed: YES), because as far as today’s numbers are concerned, it’s still the cheapest, calmest-looking route. Cost 15.<br>- DQN takes a completely different route via Yanbu → Red Sea → Bab-el-Mandeb, avoiding Hormuz entirely (Hormuz Exposed: NO), for one extra cost unit (16 vs 15).</p><blockquote>One extra cost unit, paid today, for a route that isn’t the one stuck in the strait tomorrow. The market, represented by the insurance premium, doesn’t finish catching up until after the peak. The DQN rerouted three steps before it finished deciding.</blockquote><blockquote><strong>The conclusion: the LSTM gives the DQN an information advantage, predicted risk instead of current risk, and the DQN has learned to exploit it.</strong></blockquote><h3>Step 5: What the Disruption Actually Costs- Enhanced Cascade Model</h3><p>V1 modelled the cascade as five broad stages: oil spikes, freight reprices within weeks, consumer and food prices follow over the next month or two, central banks tighten into a supply shock they can’t fix, all of it unevenly distributed by region. V2 doesn’t re-derive that model. It quantifies the tail.</p><p>That unevenness is the headline first. The regional breakdown, now sourced to an IMF working paper as pass-through coefficients rather than ranges:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*daMHM4p9vjSl5TSETgG6Jw.png" /></figure><p>East Asia absorbs roughly four times the GDP shock the USA does, from the identical oil price move.</p><p><strong>What’s actually new</strong>: running that cascade through 500 Monte Carlo scenarios, across the full range of severities and durations, and looking at <strong>the distribution of economic outcomes rather than just routing cost. The 95th-percentile tail: oil +90 to 120%, global CPI +9 to 12%, food +45 to 65%, GDP -2.5% to -4.0%. </strong>Not a worst case; the top five percent of a realistic distribution, and the number a planner would actually need to size a reserve or hedge against.</p><blockquote>The conclusion: <strong>unchanged from v1 but now quantified at the tail</strong>: The cost of a Hormuz closure isn’t the rerouting surcharge. It’s oil volatility compounding into freight, inflation, food prices, and central bank tightening, unequally by geography. The routing model tells you what to do. The cascade model tells you what’s at stake if you don’t.</blockquote><h3>The Conclusion:</h3><p>The Numbers, Plainly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*npQ5ydiNBESIQJe0tZFWtw.png" /></figure><p>Strip away the implementation and the question is simple: can you see a disruption coming before you’re already inside it? Yes, under one condition: if leading signals (sentiment, AIS anomalies, diplomatic tension) are available and correlated with actual risk, a trained LSTM can anticipate the trajectory 7 steps before lagging indicators finish repricing. The DQN answers the harder question, not what do I see but what do I do with it, a policy that generalises across an effectively infinite state space instead of memorising a slice of it.</p><p>&gt; <strong>Try V2 live:</strong> <a href="https://the-worlds-most-expensive-bottleneck-v2.streamlit.app/">the-worlds-most-expensive-bottleneck-v2.streamlit.app</a></p><p>&gt; <strong>Source code: </strong><a href="https://github.com/akathedatascienceguy/the-worlds-most-expensive-bottleneck/tree/main">github.com/akathedatascienceguy/the-worlds-most-expensive-bottleneck</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2f9b9bb309df" width="1" height="1" alt=""><hr><p><a href="https://medium.com/culture-data-science/the-worlds-most-expensive-bottleneck-second-edition-2f9b9bb309df">The World’s Most Expensive Bottleneck: Second Edition</a> was originally published in <a href="https://medium.com/culture-data-science">Culture × Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Anatomy of a Reliable A/B Test: From Sampling to Significance]]></title>
            <link>https://medium.com/culture-data-science/the-anatomy-of-a-reliable-a-b-test-from-sampling-to-significance-406bf416a45d?source=rss-ece3510a58c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/406bf416a45d</guid>
            <dc:creator><![CDATA[Nikita Gupta]]></dc:creator>
            <pubDate>Sat, 03 Jan 2026 13:45:07 GMT</pubDate>
            <atom:updated>2026-01-03T13:45:07.600Z</atom:updated>
            <content:encoded><![CDATA[<h4>✍️ Written By <a href="https://medium.com/u/ece3510a58c9">Nikita Gupta</a> &amp; <a href="https://medium.com/u/84cf33fd99b9">Yash Vardhan Gupta</a></h4><p>In the previous blog, we explored one of the foundations of trustworthy experimentation: the <strong>control set</strong>. We discussed what a control set is, why it matters across BNPL use cases (underwriting, anti-fraud, collections, and churn), and the key properties it must uphold-<strong>deterministic, stable, and independent</strong>.</p><p>In this article, we move one level deeper and look at how to design reliable A/B experiments on top of those control sets. A good A/B test is not just a split between users: it is an engineered process that ensures fairness, removes bias, and gives you enough statistical confidence to make real product or policy decisions.</p><p>We’ll cover five pillars of reliable experimentation:</p><ol><li><strong>Sampling strategy</strong> : When randomness is enough, and when stratification becomes essential</li><li><strong>Statistical equivalence (AA testing)</strong> : Are control and treatment truly comparable?</li><li><strong>Power analysis</strong> : How big your experiment needs to be</li><li><strong>Experiment duration</strong> : When to stop (and why early stopping misleads)</li><li><strong>Post-experiment significance</strong> : Did the treatment <em>actually</em> cause the change?</li></ol><p>Let’s walk through each step, in the order a well-designed experiment naturally unfolds.</p><h3>1. Random or Stratified Sampling : The First Invisible Decision</h3><p>Every experiment begins long before you observe any metric movement.<br>It begins with <strong>how you split users</strong> into control and treatment.</p><p>Most teams default to random sampling: assign users to groups using a simple 50–50 or 90–10 random split. When your user base is <strong>large and naturally diverse</strong>, this works well. Randomness tends to balance things like device type, geography, and spending patterns.</p><p>But random ≠ representative.</p><p>Imagine our app has 60% Android and 40% iOS users, and by pure chance, the control group ends up with 70% Android. Suddenly, the “lift” we observe in conversion rate might have little to do with our new model, it could just be device bias in disguise.</p><h4>Stratified Sampling: Fairness by Design</h4><p>Stratified sampling addresses this by dividing users into relevant subgroups (strata):</p><ul><li>Android / iOS</li><li>high vs. low spenders</li><li>new vs. returning users</li><li>risk bands</li><li>geographies</li></ul><p>…and sampling <em>within</em> each subgroup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GQG3s5yRYaMTImMRLNbqDg.png" /></figure><p>It’s like planning a wedding seating chart: we don’t want a “Ross at the kids’ table” situation. We carefully balance the mix so every table works well together, instead of leaving it to chance.</p><p>So if 60% of our total users are Android and 40% are iOS, both control and treatment will maintain that ratio. Our test becomes fair by construction.</p><p>This ensures both control and treatment groups maintain the same structure as the overall population.</p><p>Stratification is especially powerful when:</p><ul><li>the sample size is small</li><li>certain attributes strongly influence user behavior</li><li>the population is naturally skewed</li></ul><p>It reduces variance, improves comparability, and protects against accidental bias.</p><h4>A Practical Middle Path</h4><p>In real-world BNPL/ FinTech systems, a hybrid approach works best:</p><ol><li>Start with randomness</li><li>Add stratification on a few high-impact features (e.g., device type, geography, user tenure)</li></ol><p>Randomness gives fairness. Stratification guarantees it.</p><h3>2. Are Control and Treatment Statistically Equivalent? (AA Testing)</h3><p>Before launching <em>any</em> experiment, we must be sure that the two groups behave similarly <em>when nothing has changed</em>.<br>This is the purpose of an <strong>AA test</strong>: a placebo experiment where both groups receive the same experience.</p><p>If they behave similarly, we can trust future A/B results.<br>If not, our sampling strategy is flawed: and everything downstream becomes unreliable.</p><p>We validate AA balance in three stages:</p><h4>Step 0: Visual Inspection (Histograms and KDE Plots)</h4><p>Before we run any statistical tests, it helps to simply <em>look</em> at how the control and treatment groups differ: or ideally, don’t differ.<br>Visual inspection builds intuition and quickly flags sampling issues that could otherwise slip through.</p><p><strong>Histograms: Comparing Frequency Distributions</strong></p><p>Histograms show <strong>how often values occur</strong> across ranges. When comparing features like spend, tenure, or transaction count, they help you check whether:</p><ul><li>both groups cover similar ranges,</li><li>the shapes look alike (e.g., both slightly right-skewed),</li><li>one group contains noticeably more users in certain buckets.</li></ul><p>Below is an example where control and treatment are well balanced. The two histograms largely overlap, indicating that the groups start from comparable baselines:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ux_MdDVcaeLPr3yFqIQ3YA.png" /></figure><p><strong>KDE (Kernel Density Estimate) Plots: Comparing Distribution Shape Smoothly<br></strong>KDE plots serve as a smoother alternative to histograms. Instead of counting bins, they show a continuous estimate of the distribution, making it easier to spot subtle differences in:</p><ul><li>peak position</li><li>spread</li><li>skewness</li><li>tails</li></ul><p>In the example below, the KDE curves overlap almost perfectly. This is exactly what you want: well-matched groups before launching an experiment or deploying a model:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*c_9OD4bB5sJ_aHZtyDbxLQ.png" /></figure><p><strong>When Things Look Off<br></strong>Visual checks also help detect imbalance early. Below is a second example: here the distributions clearly diverge. The treatment group is shifted to the right, meaning it contains users with systematically higher values (in this case, longer tenure):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*p8dWPaDziC93f71rHWWVYw.png" /></figure><p>The KDE plot reinforces this imbalance. One curve noticeably dominates the other across most of the range:</p><h4>Step 1: Two-Sample T-Test (Numerical Features)</h4><p>Once visual inspection suggests the groups look similar, we validate it numerically.<br>The <strong>two-sample t-test</strong> checks whether the <strong>means</strong> of a numerical feature (e.g., <em>tenure</em>, <em>spend</em>, <em>AOV</em>) differ significantly between control and treatment.</p><p><strong>Why it matters<br></strong>Even if the histograms overlap, the <em>averages</em> could still differ in a meaningful way.<br>A skewed distribution or a few outliers might also distort intuition: so a statistical test provides objective grounding.</p><h4>How it works (conceptually)</h4><p>The t-test computes a ratio:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_hmfgN9CR2NzyDpcIXy_MQ.png" /></figure><p>A larger t-value → more likely the difference is real, not random noise.</p><p>We then compute a <strong>p-value</strong>, which represents:</p><p><em>If the two groups were truly identical, what is the probability we would see a difference this large just by chance?</em></p><ul><li><strong>p &gt; 0.05</strong> → No statistically significant difference</li><li><strong>p ≤ 0.05</strong> → Groups differ more than expected by chance → revisit sampling</li></ul><h4>Example: Two-Sample T-Test on User Tenure (Worked End-to-End)</h4><p>To make this concrete, let’s walk through a simple, end-to-end example using <strong>user tenure</strong> as our numerical feature.</p><p>Before measuring downstream outcomes like activation or spend, we first need to confirm that control and treatment users start from comparable experience levels.</p><p><strong>Step 0: The Data<br></strong>Suppose we randomly sample a small set of users from each group:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Pi8TBgizlP28tBTzx5qrA.png" /></figure><p>At a glance, these groups <em>look</em> similar, but intuition alone isn’t enough.</p><p><strong>Step 1: Compute Group Means<br></strong>We start by calculating the average tenure in each group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wpztX06zf8NZqP3M-tLYpg.png" /></figure><p>At this point, the treatment group appears to have slightly more experienced users, but we haven’t yet accounted for natural variability.</p><p><strong>Step 2: Compute Variance (How Spread Out Are Users?)<br></strong>Using the sample variance formula:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V630asWDyAYZAZYq1rdldw.png" /></figure><p>This tells us that treatment users are not only more tenured on average, but also more spread out.</p><p><strong>Step 3: Compute the t-Statistic (Welch’s t-test)<br></strong>Because variances differ, we use <strong>Welch’s t-test</strong>, which does not assume equal variance.</p><p>Conceptually, the t-statistic measures:</p><blockquote><strong><em>Observed difference in means ÷ expected random variability</em></strong></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TSHAygtvy_9OjZhAE32I5g.png" /></figure><p>The negative sign simply indicates direction (treatment &gt; control).</p><p><strong>Step 4: Degrees of Freedom<br></strong>Welch’s test uses an adjusted degree-of-freedom calculation:<br>df≈7<br>This value determines which t-distribution we reference when computing the p-value.</p><p><strong>Step 5: Compute the p-Value<br></strong>Since we’re testing for <em>any</em> difference (not a directional hypothesis), this is a <strong>two-tailed test</strong>.</p><p>For: t≈−1.61 &amp; df≈7<br>We obtain: p≈0.096</p><p><strong>Interpretation<br></strong>Because <strong>p &gt; 0.05</strong>, we <strong>fail to reject the null hypothesis</strong>.<br>In plain English:<br><em>The observed difference in tenure is well within what we’d expect from random sampling noise.</em></p><p>Even though the averages differ slightly, the difference is <strong>not statistically significant</strong>.<br>This means the two groups are <strong>sufficiently comparable</strong> in tenure, and we can safely proceed with the experiment.</p><h4>Step 2: Kolmogorov-Smirnov (KS) Test</h4><p>Means alone can be misleading, especially for non-normal or skewed variables (spend, AOV, delinquency probability).<br>The <strong>KS test</strong> compares <strong>entire distributions</strong>, not just averages.</p><p><strong>What it measures<br></strong>The test calculates the <strong>maximum vertical distance</strong> between the cumulative distribution functions (CDFs):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/962/1*5jYBNz_Ue7HLchKGC5lI1A.png" /></figure><ul><li>Small D → curves lie close → distributions are similar</li><li>Large D → curves diverge → imbalance detected</li></ul><h4>Why it’s powerful</h4><p>It detects differences in:</p><ul><li>shape (e.g., more peaked)</li><li>spread (wider/tighter)</li><li>skew (left/right)</li><li>tail behavior (longer/shorter tails)</li></ul><p>In your Step 0 visuals, the “perfect overlap” KDE plot would produce a <strong>very small D</strong>.<br>In the “noticeable difference” case, where treatment tenure is shifted right, the CDF curves would diverge sharply, giving a <strong>large D</strong> and a <strong>small p-value</strong>.</p><h4>Worked Example: KS Test on User Tenure</h4><p>We reuse the same tenure data from the t-test example.</p><p><strong>Control tenure (months):</strong> 3, 4, 5, 5, 6<br><strong>Treatment tenure (months):</strong> 4, 5, 6, 7, 8</p><p><strong>Step 1: Build Empirical CDFs<br></strong>For each unique tenure value, we compute the fraction of users with tenure ≤ that value in each group.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DSiwFUvbpRP4PxwplVbW_w.png" /></figure><p><strong>Step 2: Compute the Maximum Distance (KS Statistic)<br></strong>Once we have the empirical CDFs for control and treatment, the KS statistic is simply the <strong>largest absolute vertical gap</strong> between them at any point x.</p><p>From the CDF table above, we compute:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aTmkbDgpShEpJPY0pHK9yg.png" /></figure><p>The KS statistic is defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/836/1*bKtqWvCoiiCqKYrflTxruA.png" /></figure><p>Evaluating this across all observed tenure values:</p><p>D=max⁡(0.20, 0.20, 0.40, 0.40, 0.20, 0.00) = 0.40</p><p>This tells us that, at its point of greatest separation, the treatment CDF is <strong>40 percentage points ahead</strong> of the control CDF.</p><p><strong>Step 3: Assess Statistical Significance<br></strong>The next question is whether a distance of D=0.40 could plausibly arise <strong>by random sampling alone</strong>.</p><p>For the two-sample KS test, the p-value depends on:</p><ul><li>the KS statistic D</li><li>the sample sizes of the two groups (n1=n2=5)</li></ul><p>Using the standard KS distribution for small samples, a statistic of this magnitude yields:</p><p>D=0.40 ⇒ p≈0.87 (n1​=n2​=5)</p><p><strong>Interpretation:<br></strong>At this sample size, a KS distance of 0.40 is <strong>not statistically unusual</strong> and can plausibly arise from random sampling alone.</p><h4>Step 3: Chi-Square Test (Categorical Features)</h4><p>For categorical variables (e.g., <strong>device type</strong>, <strong>region</strong>, <strong>payment method</strong>), we check whether control and treatment contain similar proportions of each category.</p><p><strong>Why it matters<br></strong>Even if tenure or spend looks balanced, an uneven distribution of device types or regions can bias downstream outcomes.</p><h4>Worked Example: Chi-Square Test on Device Type (Categorical Balance)</h4><p>We continue with the same experiment setup and user cohort used in the <strong>t-test</strong> and <strong>KS test</strong> examples.<br> So far, we’ve seen how numerical imbalance (tenure) can creep in.<br> Now we check whether <strong>categorical attributes</strong> are also evenly distributed.</p><p><strong>Feature under test:<br>Device Type</strong> (categorical):</p><ul><li>Android</li><li>iOS</li></ul><p><strong>Why this matters:</strong><br>If device type affects conversion, retention, or latency, an uneven split can bias results even when numerical features appear balanced.</p><p><strong>Step 0: The Observed Data<br></strong>Suppose device usage among our sampled users looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wZExc6TVCF44ul4pm5Ed1Q.png" /></figure><p>At a glance:</p><ul><li>Control is Android-heavy</li><li>Treatment is iOS-heavy</li></ul><p>But is this difference <strong>statistically meaningful</strong>, or just sampling noise?</p><p><strong>Step 1: Compute Expected Counts<br></strong>Under the <strong>null hypothesis</strong>, device type is independent of group assignment.</p><p>So each group should follow the <strong>overall proportions</strong>:</p><ul><li>Android: 4 / 10 = 40%</li><li>iOS: 6 / 10 = 60%</li></ul><p>Expected counts for each group (size = 5):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8qGZ-1266U7DSUFRzuCh_Q.png" /></figure><p><strong>Step 2: Compute the Chi-Square Statistic<br></strong>The Chi-Square statistic sums the squared deviations between observed and expected counts, normalised by expectation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*czuqszquF9LtpdJBbIzQ4w.png" /></figure><p><strong>Step 3: Degrees of Freedom</strong></p><p>For a contingency table: df = (rows−1) × (columns−1)</p><p>Here:</p><ul><li>rows = 2 (control, treatment)</li><li>columns = 2 (Android, iOS)</li></ul><p>df=1</p><p><strong>Step 4: Compute the p-Value</strong></p><p>With:</p><ul><li>χ2=1.66</li><li>df=1</li></ul><p>From the Chi-Square distribution:</p><p>p≈0.20p</p><p><strong>Interpretation</strong></p><p>Because <strong>p &gt; 0.05</strong>, we fail to reject the null hypothesis.</p><p>In plain English:</p><ul><li>The observed device imbalance could reasonably arise from random sampling</li><li>There is <strong>no statistically significant categorical imbalance</strong> in device type</li></ul><p>This tells us something subtle but important:</p><ul><li><strong>Tenure does not show statistically significant distributional imbalance</strong> (as indicated by the KS test).</li><li><strong>Device type is also balanced</strong></li></ul><p>In other words, the experiment does <strong>not</strong> suffer from a broad or systemic sampling issue. Both numerical and categorical features examined here are consistent with having been drawn from the same underlying populations.</p><p>This gives us confidence that any downstream differences are more likely driven by the treatment itself, not by artifacts of the split.</p><h3>3. Power Analysis: How Big Should Your Experiment Be?</h3><p>Even with perfectly balanced groups, an A/B test can still fail if it is statistically underpowered or unnecessarily overpowered.</p><ul><li><strong>Underpowered</strong> → The experiment cannot reliably detect the effect even if it truly exists.</li><li><strong>Overpowered</strong> → You detect trivial differences and waste traffic, time, and engineering bandwidth.</li></ul><p>Power analysis ensures that the experiment is sized for the <strong>smallest effect that actually matters</strong>, not just the effect that is easiest to detect.</p><h4>What Power Analysis Tries to Answer</h4><ol><li>How many users do we need in each group?</li><li>What is the smallest effect (MDE) that is worth detecting?</li><li>How confident do we want to be in the results?</li></ol><p>These questions depend on the following parameters:</p><h4>Key Parameters</h4><ul><li><strong>α (alpha) - Type l Error<br></strong>Probability of a false positive (Type I error)<br><em>α=P(Reject H0​∣H0​ is true)</em><br>Typically 0.05, meaning we accept a 5% chance of concluding a difference that isn’t real.</li><li><strong>β (beta) and Power<br></strong>Probability of a false negative (Type II error). <br><em>β=P(Fail to reject H0​∣H1​ is true) <br></em>Power is defined as<em> <br>Power = 1 − β</em> → the probability that we detect a real effect.<br>Industry standard: Power = 0.8.</li><li><strong>Baseline rate - </strong>Current performance metric.<br>Example: delinquency rate = 10%.<br>This baseline directly determines the <strong>variance</strong> of the metric: <em>Var(p)=p(1−p)<br></em>Lower baselines → lower signal-to-noise → larger required samples.</li><li><strong>MDE (Minimum Detectable Effect) - </strong>Smallest change worth acting on. MDE=∣p1​−p0​∣<br>A 0.2% improvement in delinquency may be statistically detectable,<br>but not meaningful.</li><li><strong>Sample Size Formula (Proportion Metrics)<br></strong>For binary metrics (conversion, delinquency, churn), the required <strong>per-group</strong> sample size is approximately:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I6If4QqMIGfKDamAumcx7g.png" /></figure><p>This equation makes the tradeoffs painfully clear:</p><ul><li>Smaller MDE → denominator shrinks → n explodes</li><li>Lower baseline → variance dominates → n increases</li><li>Higher confidence or power → larger z-scores → n increases</li></ul><h4>Example</h4><p>Suppose the delinquency rate for both control and treatment groups is about <strong>10%</strong> (as validated in Step 0’s KDE/histograms).</p><p>Now your team wants to detect a 1% absolute reduction (from 10% → 9%).</p><p>You want:</p><ul><li>95% confidence (α = 0.05)</li><li>80% power (β = 0.2)</li><li>Binomial metric (success/fail)</li></ul><p>Using standard sample size formulas for proportions, you’ll find:</p><p>Detecting a 1% drop in a 10% baseline typically requires<br> ~<strong>13,000–15,000 users per group</strong>.</p><p><strong>Takeaway:<br></strong> If a business wants to reliably detect tiny improvements, they must pay for it with much larger sample requirements.</p><h3>4. How Long Should the Experiment Run?</h3><p>Even if you have the right sample size, the experiment can still fail if you stop too early.</p><p>Two scientific conditions must be met before declaring results.</p><h4>(1) You Must Reach the Required Sample Size</h4><p>If the power analysis says you need 20,000 users per group, and your platform receives 10,000 eligible users/day, then:</p><ul><li>Minimum experiment duration = 2 days</li><li>Not 1.5 days</li><li>Not “it looks stable so let’s stop”</li></ul><h4>(2) The Metric’s Observation Window Must Be Complete</h4><p>Even after collecting the sample, you cannot close the experiment until the metric has had time to <strong>mature</strong>.</p><p>Metrics differ dramatically in how quickly they stabilize:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hISsc2OfJ2Uwzi-Jw00wRQ.png" /></figure><p>In your AA test examples, tenure or delinquency cannot be evaluated the same day.<br>The KDE/histogram alignment only tells us they’re balanced at baseline.<br>But to see if treatment changes delinquency, you must wait at least one full cycle.</p><p>Stopping earlier can cause:</p><ul><li>Noise masquerading as signal : random ups and downs can look like real effects when the sample is small</li><li>False confidence : making decisions too early and being wrong with high confidence</li></ul><p>Duration is a statistical requirement, not a PM preference.</p><h3>5. After the Experiment: Significance Testing</h3><p>When the experiment ends, the core question becomes:</p><p><strong>“Is the observed difference real, or just random variation?”</strong></p><p>Before the experiment, Visual checks, T-tests, KS-tests, and Chi-Square tests ensured <strong>baseline comparability</strong>. That phase is about <em>fairness</em> — proving both groups started from the same distribution (e.g., matching tenure/spend histograms &amp; KDE curves).</p><p>Now, after the experiment, we use the <strong>same tools</strong>, but with a deeper purpose:</p><p><strong>To quantify whether the treatment <em>caused</em> the observed change.</strong></p><h4>Example (Aligned With Tenure/Spend Examples From Step 0)</h4><h4>1. Revenue per User (Mean-Based Metric)</h4><p>Earlier, our tenure/spend KDEs overlapped perfectly → balanced groups.<br> Now, after treatment:</p><ul><li>Control = ₹500</li><li>Treatment = ₹515</li><li>Lift = <strong>3%</strong></li><li><strong>T-test p = 0.04</strong></li></ul><p><strong>Interpretation:<br></strong> Statistically significant and visually consistent. Treatment likely increased revenue.</p><h4>2. Churn Rate (Proportion-Based, Noisy Metric)</h4><ul><li>Control = 8.0%</li><li>Treatment = 7.8%</li><li>Lift = <strong>2.5% reduction</strong></li><li><strong>Chi-Square p = 0.21</strong></li></ul><p><strong>Interpretation:<br></strong> Not statistically significant, not practically meaningful.</p><h3>Conclusion</h3><p>A reliable A/B test is not an act of chance - it is a controlled scientific process.<br>We begin by ensuring balanced cohorts, validated using statistical checks such as t-tests, KS-tests, and chi-square tests, so that control and treatment differ only in the intended intervention.</p><p>We design experiments with the right statistical power, choosing an MDE that reflects real business value and computing the required sample size using parameters like α, β, and baseline rates. We run the experiment long enough to satisfy both the sample-size requirement and the metric’s natural observation window, ensuring outcomes are stable and fully observed.</p><p>After the experiment concludes, we verify causality by examining effect direction, variance stability, segment consistency, placebo checks, and pre-period equivalence, ensuring the observed lift truly results from the treatment and not confounders or noise.</p><p>Ultimately, A/B testing is applied scientific reasoning: structured, reproducible, and grounded in statistical evidence.</p><blockquote>“Experiment is the sole judge of scientific truth.” — Richard Feynman</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=406bf416a45d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/culture-data-science/the-anatomy-of-a-reliable-a-b-test-from-sampling-to-significance-406bf416a45d">The Anatomy of a Reliable A/B Test: From Sampling to Significance</a> was originally published in <a href="https://medium.com/culture-data-science">Culture × Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Unsung Hero of Experimentation: The Control Set]]></title>
            <link>https://medium.com/culture-data-science/the-unsung-hero-of-experimentation-the-control-set-e37679d7788d?source=rss-ece3510a58c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/e37679d7788d</guid>
            <category><![CDATA[fintech]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[a-b-testing]]></category>
            <category><![CDATA[model-evaluation]]></category>
            <category><![CDATA[bnpl]]></category>
            <dc:creator><![CDATA[Nikita Gupta]]></dc:creator>
            <pubDate>Thu, 27 Nov 2025 03:50:44 GMT</pubDate>
            <atom:updated>2025-11-27T03:50:44.193Z</atom:updated>
            <content:encoded><![CDATA[<p>✍️ Written By <a href="https://medium.com/@gupta.nikita0801">Nikita Gupta</a> &amp; <a href="https://medium.com/u/84cf33fd99b9">Yash Vardhan Gupta</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HCBCSoSfrhgSB2U4.png" /></figure><p>In this article, We’ll explain the significance of control sets and the impact they generate when working with intelligence systems in a company. We will use examples from <strong>Simpl</strong>, a BNPL (Buy Now Pay Later) service, to illustrate their role in real-world applications.</p><p>Control sets are often overlooked, but they are crucial to measuring the true performance of data science models in production. Without them, organizations risk confusing correlation with causation, misjudging system impact, or making decisions based on incomplete information.</p><h3>What is a Control Set?</h3><p>A control set is a portion of users or data that is kept <strong>free from any treatment</strong> while all other parameters remain identical to the test set. This allows teams to measure the actual effect of a treatment and understand whether observed changes are due to causation or merely correlation.</p><p><strong>Control sets help to:</strong></p><ul><li>Evaluate models in an unbiased environment.</li><li>Understand system behavior deeply.</li><li>Measure the long-term impact of interventions.</li></ul><p>Formally, if ftreatment represents the outcome under intervention and fcontrol represents the baseline outcome, then the difference ftreatment — fcontrol isolates the causal lift:</p><p><strong>Impact = <em>f</em>(treatment) — <em>f</em>(control)</strong></p><p>By keeping a portion of the population untouched, control sets provide a <strong>baseline</strong>, enabling teams to measure the true causal effect of any model, intervention, or strategy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*3BcId55ZiPGnMwZK.png" /></figure><h3>🧠 Why Control Sets Matter in FinTech (The Simpl Story)</h3><p>Let’s take the example of <strong>Simpl</strong>, a BNPL (Buy Now Pay Later) service that thrives on AI-driven decisions. Control sets here aren’t just a statistical curiosity- they’re a sanity check for every model we ship.</p><h3>Understanding the User Lifecycle at Simpl</h3><p>In order to understand the importance of control sets, first let’s look at the user’s lifecycle at Simpl. This context will help illustrate how control sets are put to use and why they are critical for measuring the true impact of intelligence systems.</p><ol><li><strong>Underwriting: </strong>Users can use Simpl only if they are successfully underwritten. So, the first step is to evaluate users for credit worthiness using limited merchant-provided data, without requiring eKYC or mandates. A low credit limit is assigned via ML models.</li><li><strong>Credit Upgrade / Re-underwriting: </strong>As users transact, more behavioral and transactional data is collected. Re-underwriting then takes place : essentially providing the user with a higher credit limit while keeping risk in check using ML/DL models.</li><li><strong>Fraud Detection: </strong>The Anti-Fraud System (AFS) operates in parallel with the underwriting models. This vertical identifies suspicious transactions or users and takes the required steps to mitigate fraud losses. For instance, if the AFS system flags a user as fraudulent, the user may be immediately blocked from further transactions.</li><li><strong>Churn Prevention: </strong>The churn prevention models identify users at risk of leaving and trigger interventions to retain them. These interventions could include targeted cashbacks, personalized notifications, or even resolving underlying issues that might cause user dissatisfaction.</li><li><strong>Collections: </strong>If a user fails to repay the amount within the due date, the system automatically initiates reminders through messages, IVR calls, or manual follow-ups. Reinforcement Learning algorithms recommend optimal collection actions: choosing the best communication channel and timing, to maximize recovery while minimizing operational cost.</li></ol><p>At every stage, <strong>control sets allow us to understand the real-world impact of these interventions</strong>, answer “what-if” questions, and quantify ROI accurately.</p><h3>Role of Control Sets Across Verticals</h3><h3>1️⃣ Underwriting</h3><p>In this vertical, we decide which users should receive a Simpl credit line. Only underwritten users can transact using Simpl. The underwriting process is driven by ML/DL models trained on users who have already been approved and transacted before. The objective of the underwriting process is to provide credit lines to as many people as possible while keeping delinquency rates small.</p><p>However, this setup leaves some key questions unanswered:</p><ul><li>What is the true delinquency rate of the overall user universe if approvals were random and not model-driven?</li><li>What would retention and Average Order Value (AOV) be without underwriting intelligence?</li><li>When a new model is introduced, trained on previously approved users, how will it perform on the broader, unseen universe?</li></ul><p>Since each model learns only from already-approved users, it carries selection bias, limiting our ability to measure real-world impact.</p><p><strong>Control Set Approach</strong></p><p>To answer these questions, we maintain a small, statistically significant control set of users who are approved randomly, independent of any model’s decision. By tracking their delinquency, retention, and AOV, we capture the true behavior of the user universe.</p><p>This provides a reliable baseline:</p><ul><li>The delinquency rate in this set represents the natural default rate without intelligence.</li><li>Comparing model-approved users against this group quantifies how much delinquency, AOV, and retention have improved due to data science interventions.</li><li>When a new model is launched, its performance on this control set shows true causal improvement, not just incremental gains on a filtered population.</li></ul><p>Comparing model-approved users against this baseline allows us to measure <em>real lift</em>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*yLdGg-mph7jfx6Lb.png" /></figure><p><strong>Why It Matters</strong></p><p>Approving users randomly is indeed risky and costly, but this controlled risk is essential to deeply understand both the model’s effectiveness and the universe’s behavior. Without it, we risk evaluating models in a biased loop.</p><p>The control set helps break selection bias and ensures we measure causation, not correlation, giving a deterministic view of underwriting performance in production.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*TJScBv5ViY5G--cG.png" /></figure><h3>2️⃣ Anti-Fraud System (AFS)</h3><p>Trust us: We’ve answered countless <em>“why”</em> and <em>“how”</em> questions from our leadership only because the control set existed. It’s what gives us clarity amid the uncertainty of fraud detection.</p><p>At Simpl, the fraud detection system is a complex blend of LSTM models for sequential transaction behavior, GraphSAGE for network-based risk, user embeddings that capture latent behavioral patterns, and a LightGBM ensemble that integrates these signals to flag suspicious users and transactions.</p><p>Once flagged, a user is either blocked or has their credit limit downgraded. Like any other data science model, this system operates at a certain precision, which means false positives (FPs) are inevitable. Unfortunately, FPs directly impact user experience: a genuine user might get blocked or see their limit reduced without reason.</p><p>And in India, users talk far more about bad experiences than good ones , especially on social media. So naturally, leadership often wants to know:</p><ul><li>Are we blocking too many genuine users?</li><li>What’s the trade-off between fraud prevention and user experience?</li><li>What would our losses look like if we didn’t take any of these actions?</li></ul><p>Answering these questions is difficult because once a user is blocked, their natural behavior changes. They can not transact anymore, and some even settle early out of fear, thinking Simpl might have found something serious. This biases the observed precision and makes real-world measurement unreliable.</p><p><strong>Control Set Approach</strong></p><p>This is where the control set becomes invaluable. In the control set, we flag users as suspicious but don’t take any action, no blocking or limit downgrade. This allows us to:</p><ul><li>Measure the true default rate among flagged users.</li><li>Estimate how much money would be lost if no fraud intelligence existed.</li><li>Quantify the revenue trade-off between aggressive fraud prevention and customer experience.</li></ul><p>In short, the control set acts as a “parallel universe” where we can see what would have happened without interference. We can quantify the impact with simple metrics:</p><p><strong>Revenue Impact = Revenue(control) — Revenue(intervention)</strong></p><p><strong>Fraud Prevented = Default(control) — Default(intervention)</strong></p><p><strong>Examples and Practical Use</strong></p><ul><li>When a Growth PM asks, <em>“Can we NOT block users based on this new heuristic?”</em>, instead of running a risky live experiment, we first do a dry run on the control set. This tells us directionally whether the heuristic makes sense before spending months testing it.</li><li>If someone proposes replacing blocking with credit downgrades for all flagged users, we can simulate this on the control set across six months of data: projecting the expected revenue uplift versus fraud loss without impacting real users.</li></ul><p>These insights save months of experimentation, reduce uncertainty, and ensure our decisions are data-driven and explainable, rather than based on gut feel that could trigger angry tweets.</p><p>Ultimately, the control set transforms how we justify actions to leadership. Instead of debating based on intuition, we can say with confidence:</p><p>“Here’s the quantified trade-off between risk, revenue, and user experience.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vuhSrf36s1oq7C8m.png" /></figure><h3>3️⃣ Churn Prevention</h3><p>Retention is a pressing challenge in highly competitive BNPL markets. Companies often deploy interventions: cashbacks, discounts, or notifications, targeted at users flagged by intelligence models. However, measuring impact without a control set can be misleading:</p><ul><li>Is the model truly identifying at-risk users, or are incentives like cashbacks temporarily keeping users around?</li><li>How does retention in one month affect behavior in subsequent months?</li></ul><p><strong>Control Set Approach</strong></p><p>To answer these questions, a small portion of users flagged for churn prevention is deliberately left untreated. These users form the control set, allowing us to observe their natural churn patterns over several months. This approach captures both immediate and delayed effects, as well as ripple effects across the system.</p><p><strong>Example:</strong> A user may stay for one month due to a cashback incentive but churn in the following month. In businesses operating at thin margins, such short-term retention could result in negative ROI despite apparent gains in the test set. Comparing the control set with treated users isolates the true causal effect of interventions, helping quantify long-term value.</p><p>Formally, if we denote retention at month <em>t</em> as Rt, the control set allows us to calculate the net lift of an intervention:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/0*u2Xsy47NxuQ7moRZ.png" /></figure><p>This measure captures the incremental retention directly attributable to our interventions, stripping away the noise of natural user behavior. Importantly, it also reveals the ripple effects: users who appear “retained” in the short term might churn later, or incentives might shift behavior in unexpected ways. Understanding these dynamics helps leadership make data-backed decisions that balance short-term retention with long-term profitability, rather than relying on surface-level improvements in monthly metrics.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*dWQNASRnqRn4HsKT.png" /></figure><h3>4️⃣ Collections</h3><p>At Simpl, customers are expected to settle their payments within the due date. If they don’t, the collections process kicks in: starting with reminders via messages, push notifications, and WhatsApp, and later moving to calls. The goal is clear: recover as much money as possible, as quickly as possible, and at minimal cost.</p><p><strong>Before Data Science interventions:</strong></p><ul><li>Uniform reminders were sent to all users across channels.</li><li>Calls were initiated on a fixed schedule starting on D7 (seven days after bill generation).</li><li>Collections followed a one-size-fits-all approach.</li></ul><p><strong>After implementing the Collection Intelligence Framework (CIF):</strong></p><ul><li>Messaging and call sequences are personalized for each user.</li><li>Channels and timings are optimized to maximize effectiveness.</li><li>Risk-based prioritization is applied using Reinforcement Learning algorithms, ensuring high-risk users are targeted efficiently.</li></ul><p><strong>Control Set Approach</strong></p><p>To measure the true impact of CIF, we maintain a control set of users under the old rule-based system, effectively untreated. This allows us to understand:</p><ul><li>How much money would have been collected without any intervention (baseline).</li><li>The improvements in recovery rate and efficiency introduced by CIF.</li><li>Cost savings from optimized collection strategies.</li></ul><p><strong>Measuring Impact</strong></p><p>The control set allows us to quantify key metrics clearly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/0*Z6VOTzni-CsAfGXI.png" /></figure><p>We also compute <strong>cost efficiency</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/0*FQGq2bAVEaQGDORc.png" /></figure><p>By comparing treated users with the control set, we can quantify not only revenue uplift but also operational efficiency gains. For example, analyzing six months of data reveals:</p><ul><li>The incremental recovery achieved through personalized interventions.</li><li>Reduction in cost per recovered user thanks to optimized messaging and call schedules.</li><li>Long-term efficiency improvements without compromising portfolio health.</li></ul><p>Control sets make it possible to evaluate collections strategies rigorously, providing clarity on the real value of ML-driven decisions and ensuring management can make data-backed choices rather than relying on assumptions or intuition.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*z3atvM4z03otpVDP.png" /></figure><h3>Creating an Effective Control Set</h3><p><strong>Key Principles for Creating Control Sets</strong></p><ul><li><strong>Deterministic Assignment: </strong>A control set must be deterministic: once a user is assigned to the control set, they should remain there consistently throughout the experiment. This ensures that long-term or delayed effects can be accurately measured.</li></ul><p><strong>Example: </strong>In the Anti-Fraud System (AFS), if a user is flagged and falls into the control set in March, we need to observe their behavior over subsequent months. If the same user moves in and out of control and test sets, we cannot accurately measure delayed defaults or the true impact of interventions. Similarly, in Churn Prevention, users assigned to a control set should remain there for at least 4–6 months to capture ripple effects on retention.</p><ul><li><strong>Separation Across Systems: </strong>Control sets in one vertical must remain independent of other verticals to avoid bias.</li></ul><p><strong>Example: </strong>Users in the AFS Control set may overlap with Churn Control or Collections Control cohorts; but this overlap should not be selectively enforced or avoided, as doing so could distort results and compromise the validity of vertical-specific insights.</p><p><strong>Implementation Tip: </strong>One practical approach is using a deterministic hashing function (e.g., SHA-256) to assign users consistently:</p><p><strong>Deterministic SHA hashing approach:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uqaMU7UVwaxMcBHy.png" /></figure><p>This ensures consistent control set assignment while keeping verticals independent.</p><h3>Conclusion</h3><p>Control sets are indispensable for understanding the <strong>real impact of data science interventions</strong>. They allow teams to:</p><ul><li>Measure causation versus correlation</li><li>Evaluate model performance in unbiased environments</li><li>Optimize interventions across underwriting, fraud, churn, and collections</li></ul><p>By thoughtfully maintaining control sets, organizations like Simpl can:</p><ul><li>Validate the effectiveness of intelligence systems</li><li>Develop deep operational understanding</li><li>Make smarter, data-driven decisions with controlled risk</li></ul><p>A well-designed control set is more than a too -it is the <strong>backbone of scientific decision-making in AI-driven businesses</strong>.</p><blockquote><em>“Every great data story deserves a skeptic, and that skeptic is your control set.”</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e37679d7788d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/culture-data-science/the-unsung-hero-of-experimentation-the-control-set-e37679d7788d">The Unsung Hero of Experimentation: The Control Set</a> was originally published in <a href="https://medium.com/culture-data-science">Culture × Data Science</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Unsung Hero of Experimentation: The Control Set]]></title>
            <link>https://medium.com/@gupta.nikita0801/the-unsung-hero-of-experimentation-the-control-set-7c43803240ad?source=rss-ece3510a58c9------2</link>
            <guid isPermaLink="false">https://medium.com/p/7c43803240ad</guid>
            <dc:creator><![CDATA[Nikita Gupta]]></dc:creator>
            <pubDate>Mon, 24 Nov 2025 15:31:30 GMT</pubDate>
            <atom:updated>2025-11-24T15:31:30.382Z</atom:updated>
            <content:encoded><![CDATA[<p>✍️ Written By <a href="https://medium.com/@gupta.nikita0801">Nikita Gupta</a> &amp; <a href="https://medium.com/u/84cf33fd99b9?source=post_page---user_mention--7d7b7bb777ce---------------------------------------">Yash Vardhan Gupta</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*NIQgZsuWMM3wg7f5.png" /></figure><p>In this article, We’ll explain the significance of control sets and the impact they generate when working with intelligence systems in a company. We will use examples from <strong>Simpl</strong>, a BNPL (Buy Now Pay Later) service, to illustrate their role in real-world applications.</p><p>Control sets are often overlooked, but they are crucial to measuring the true performance of data science models in production. Without them, organizations risk confusing correlation with causation, misjudging system impact, or making decisions based on incomplete information.</p><h3>What is a Control Set?</h3><p>A control set is a portion of users or data that is kept <strong>free from any treatment</strong> while all other parameters remain identical to the test set. This allows teams to measure the actual effect of a treatment and understand whether observed changes are due to causation or merely correlation.</p><p><strong>Control sets help to:</strong></p><ul><li>Evaluate models in an unbiased environment.</li><li>Understand system behavior deeply.</li><li>Measure the long-term impact of interventions.</li></ul><p>Formally, if ftreatment represents the outcome under intervention and fcontrol represents the baseline outcome, then the difference ftreatment — fcontrol isolates the causal lift:</p><p><strong>Impact = <em>f</em>(treatment) — <em>f</em>(control)</strong></p><p>By keeping a portion of the population untouched, control sets provide a <strong>baseline</strong>, enabling teams to measure the true causal effect of any model, intervention, or strategy.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SAABMBly8B3AO9Um.png" /></figure><h3>🧠 Why Control Sets Matter in FinTech (The Simpl Story)</h3><p>Let’s take the example of <strong>Simpl</strong>, a BNPL (Buy Now Pay Later) service that thrives on AI-driven decisions. Control sets here aren’t just a statistical curiosity- they’re a sanity check for every model we ship.</p><h3>Understanding the User Lifecycle at Simpl</h3><p>In order to understand the importance of control sets, first let’s look at the user’s lifecycle at Simpl. This context will help illustrate how control sets are put to use and why they are critical for measuring the true impact of intelligence systems.</p><ol><li><strong>Underwriting: </strong>Users can use Simpl only if they are successfully underwritten. So, the first step is to evaluate users for credit worthiness using limited merchant-provided data, without requiring eKYC or mandates. A low credit limit is assigned via ML models.</li><li><strong>Credit Upgrade / Re-underwriting: </strong>As users transact, more behavioral and transactional data is collected. Re-underwriting then takes place : essentially providing the user with a higher credit limit while keeping risk in check using ML/DL models.</li><li><strong>Fraud Detection: </strong>The Anti-Fraud System (AFS) operates in parallel with the underwriting models. This vertical identifies suspicious transactions or users and takes the required steps to mitigate fraud losses. For instance, if the AFS system flags a user as fraudulent, the user may be immediately blocked from further transactions.</li><li><strong>Churn Prevention: </strong>The churn prevention models identify users at risk of leaving and trigger interventions to retain them. These interventions could include targeted cashbacks, personalized notifications, or even resolving underlying issues that might cause user dissatisfaction.</li><li><strong>Collections: </strong>If a user fails to repay the amount within the due date, the system automatically initiates reminders through messages, IVR calls, or manual follow-ups. Reinforcement Learning algorithms recommend optimal collection actions: choosing the best communication channel and timing, to maximize recovery while minimizing operational cost.</li></ol><p>At every stage, <strong>control sets allow us to understand the real-world impact of these interventions</strong>, answer “what-if” questions, and quantify ROI accurately.</p><h3>Role of Control Sets Across Verticals</h3><h3>1️⃣ Underwriting</h3><p>In this vertical, we decide which users should receive a Simpl credit line. Only underwritten users can transact using Simpl. The underwriting process is driven by ML/DL models trained on users who have already been approved and transacted before. The objective of the underwriting process is to provide credit lines to as many people as possible while keeping delinquency rates small.</p><p>However, this setup leaves some key questions unanswered:</p><ul><li>What is the true delinquency rate of the overall user universe if approvals were random and not model-driven?</li><li>What would retention and Average Order Value (AOV) be without underwriting intelligence?</li><li>When a new model is introduced, trained on previously approved users, how will it perform on the broader, unseen universe?</li></ul><p>Since each model learns only from already-approved users, it carries selection bias, limiting our ability to measure real-world impact.</p><p><strong>Control Set Approach</strong></p><p>To answer these questions, we maintain a small, statistically significant control set of users who are approved randomly, independent of any model’s decision. By tracking their delinquency, retention, and AOV, we capture the true behavior of the user universe.</p><p>This provides a reliable baseline:</p><ul><li>The delinquency rate in this set represents the natural default rate without intelligence.</li><li>Comparing model-approved users against this group quantifies how much delinquency, AOV, and retention have improved due to data science interventions.</li><li>When a new model is launched, its performance on this control set shows true causal improvement, not just incremental gains on a filtered population.</li></ul><p>Comparing model-approved users against this baseline allows us to measure <em>real lift</em>:</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*IDGVBnNgbT6IdPs4.png" /></figure><p><strong>Why It Matters</strong></p><p>Approving users randomly is indeed risky and costly, but this controlled risk is essential to deeply understand both the model’s effectiveness and the universe’s behavior. Without it, we risk evaluating models in a biased loop.</p><p>The control set helps break selection bias and ensures we measure causation, not correlation, giving a deterministic view of underwriting performance in production.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kF_JXzxiDXPUSnWn.png" /></figure><h3>2️⃣ Anti-Fraud System (AFS)</h3><p>Trust us: We’ve answered countless <em>“why”</em> and <em>“how”</em> questions from our leadership only because the control set existed. It’s what gives us clarity amid the uncertainty of fraud detection.</p><p>At Simpl, the fraud detection system is a complex blend of LSTM models for sequential transaction behavior, GraphSAGE for network-based risk, user embeddings that capture latent behavioral patterns, and a LightGBM ensemble that integrates these signals to flag suspicious users and transactions.</p><p>Once flagged, a user is either blocked or has their credit limit downgraded. Like any other data science model, this system operates at a certain precision, which means false positives (FPs) are inevitable. Unfortunately, FPs directly impact user experience: a genuine user might get blocked or see their limit reduced without reason.</p><p>And in India, users talk far more about bad experiences than good ones , especially on social media. So naturally, leadership often wants to know:</p><ul><li>Are we blocking too many genuine users?</li><li>What’s the trade-off between fraud prevention and user experience?</li><li>What would our losses look like if we didn’t take any of these actions?</li></ul><p>Answering these questions is difficult because once a user is blocked, their natural behavior changes. They can not transact anymore, and some even settle early out of fear, thinking Simpl might have found something serious. This biases the observed precision and makes real-world measurement unreliable.</p><p><strong>Control Set Approach</strong></p><p>This is where the control set becomes invaluable. In the control set, we flag users as suspicious but don’t take any action, no blocking or limit downgrade. This allows us to:</p><ul><li>Measure the true default rate among flagged users.</li><li>Estimate how much money would be lost if no fraud intelligence existed.</li><li>Quantify the revenue trade-off between aggressive fraud prevention and customer experience.</li></ul><p>In short, the control set acts as a “parallel universe” where we can see what would have happened without interference. We can quantify the impact with simple metrics:</p><p><strong>Revenue Impact = Revenue(control) — Revenue(intervention)</strong></p><p><strong>Fraud Prevented = Default(control) — Default(intervention)</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KGtwtc64AMBtZS4K" /></figure><p><strong>Examples and Practical Use</strong></p><ul><li>When a Growth PM asks, <em>“Can we NOT block users based on this new heuristic?”</em>, instead of running a risky live experiment, we first do a dry run on the control set. This tells us directionally whether the heuristic makes sense before spending months testing it.</li><li>If someone proposes replacing blocking with credit downgrades for all flagged users, we can simulate this on the control set across six months of data: projecting the expected revenue uplift versus fraud loss without impacting real users.</li></ul><p>These insights save months of experimentation, reduce uncertainty, and ensure our decisions are data-driven and explainable, rather than based on gut feel that could trigger angry tweets.</p><p>Ultimately, the control set transforms how we justify actions to leadership. Instead of debating based on intuition, we can say with confidence:</p><p>“Here’s the quantified trade-off between risk, revenue, and user experience.”</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9hZpz2sWP5UtwviT.png" /></figure><h3>3️⃣ Churn Prevention</h3><p>Retention is a pressing challenge in highly competitive BNPL markets. Companies often deploy interventions: cashbacks, discounts, or notifications, targeted at users flagged by intelligence models. However, measuring impact without a control set can be misleading:</p><ul><li>Is the model truly identifying at-risk users, or are incentives like cashbacks temporarily keeping users around?</li><li>How does retention in one month affect behavior in subsequent months?</li></ul><p><strong>Control Set Approach</strong></p><p>To answer these questions, a small portion of users flagged for churn prevention is deliberately left untreated. These users form the control set, allowing us to observe their natural churn patterns over several months. This approach captures both immediate and delayed effects, as well as ripple effects across the system.</p><p><strong>Example:</strong> A user may stay for one month due to a cashback incentive but churn in the following month. In businesses operating at thin margins, such short-term retention could result in negative ROI despite apparent gains in the test set. Comparing the control set with treated users isolates the true causal effect of interventions, helping quantify long-term value.</p><p>Formally, if we denote retention at month <em>t</em> as Rt, the control set allows us to calculate the net lift of an intervention:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/0*BJVdmuL4NG0XcqF6.png" /></figure><p>This measure captures the incremental retention directly attributable to our interventions, stripping away the noise of natural user behavior. Importantly, it also reveals the ripple effects: users who appear “retained” in the short term might churn later, or incentives might shift behavior in unexpected ways. Understanding these dynamics helps leadership make data-backed decisions that balance short-term retention with long-term profitability, rather than relying on surface-level improvements in monthly metrics.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*g0Ox1-GCU2netj2V.png" /></figure><h3>4️⃣ Collections</h3><p>At Simpl, customers are expected to settle their payments within the due date. If they don’t, the collections process kicks in: starting with reminders via messages, push notifications, and WhatsApp, and later moving to calls. The goal is clear: recover as much money as possible, as quickly as possible, and at minimal cost.</p><p><strong>Before Data Science interventions:</strong></p><ul><li>Uniform reminders were sent to all users across channels.</li><li>Calls were initiated on a fixed schedule starting on D7 (seven days after bill generation).</li><li>Collections followed a one-size-fits-all approach.</li></ul><p><strong>After implementing the Collection Intelligence Framework (CIF):</strong></p><ul><li>Messaging and call sequences are personalized for each user.</li><li>Channels and timings are optimized to maximize effectiveness.</li><li>Risk-based prioritization is applied using Reinforcement Learning algorithms, ensuring high-risk users are targeted efficiently.</li></ul><p><strong>Control Set Approach</strong></p><p>To measure the true impact of CIF, we maintain a control set of users under the old rule-based system, effectively untreated. This allows us to understand:</p><ul><li>How much money would have been collected without any intervention (baseline).</li><li>The improvements in recovery rate and efficiency introduced by CIF.</li><li>Cost savings from optimized collection strategies.</li></ul><p><strong>Measuring Impact</strong></p><p>The control set allows us to quantify key metrics clearly:</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1018/0*Lf1w5j2ExcBlKcfL.png" /></figure><p>We also compute <strong>cost efficiency</strong>:</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/0*5syNV43tsYCwM1hs.png" /></figure><p>By comparing treated users with the control set, we can quantify not only revenue uplift but also operational efficiency gains. For example, analyzing six months of data reveals:</p><ul><li>The incremental recovery achieved through personalized interventions.</li><li>Reduction in cost per recovered user thanks to optimized messaging and call schedules.</li><li>Long-term efficiency improvements without compromising portfolio health.</li></ul><p>Control sets make it possible to evaluate collections strategies rigorously, providing clarity on the real value of ML-driven decisions and ensuring management can make data-backed choices rather than relying on assumptions or intuition.</p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*I1L9UCZUH3YfUcyO.png" /></figure><h3>Creating an Effective Control Set</h3><p><strong>Key Principles for Creating Control Sets</strong></p><ul><li><strong>Deterministic Assignment: </strong>A control set must be deterministic: once a user is assigned to the control set, they should remain there consistently throughout the experiment. This ensures that long-term or delayed effects can be accurately measured.</li></ul><p><strong>Example: </strong>In the Anti-Fraud System (AFS), if a user is flagged and falls into the control set in March, we need to observe their behavior over subsequent months. If the same user moves in and out of control and test sets, we cannot accurately measure delayed defaults or the true impact of interventions. Similarly, in Churn Prevention, users assigned to a control set should remain there for at least 4–6 months to capture ripple effects on retention.</p><ul><li><strong>Separation Across Systems: </strong>Control sets in one vertical must remain independent of other verticals to avoid bias.</li></ul><p><strong>Example: </strong>Users in the AFS Control set may overlap with Churn Control or Collections Control cohorts; but this overlap should not be selectively enforced or avoided, as doing so could distort results and compromise the validity of vertical-specific insights.</p><p><strong>Implementation Tip: </strong>One practical approach is using a deterministic hashing function (e.g., SHA-256) to assign users consistently:</p><p><strong>Deterministic SHA hashing approach:</strong></p><p>Press enter or click to view image in full size</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*l352QEqvwYOfG35e.png" /></figure><p>This ensures consistent control set assignment while keeping verticals independent.</p><h3>Conclusion</h3><p>Control sets are indispensable for understanding the <strong>real impact of data science interventions</strong>. They allow teams to:</p><ul><li>Measure causation versus correlation</li><li>Evaluate model performance in unbiased environments</li><li>Optimize interventions across underwriting, fraud, churn, and collections</li></ul><p>By thoughtfully maintaining control sets, organizations like Simpl can:</p><ul><li>Validate the effectiveness of intelligence systems</li><li>Develop deep operational understanding</li><li>Make smarter, data-driven decisions with controlled risk</li></ul><p>A well-designed control set is more than a too -it is the <strong>backbone of scientific decision-making in AI-driven businesses</strong>.</p><blockquote><em>“Every great data story deserves a skeptic, and that skeptic is your control set.”</em></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7c43803240ad" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>