<?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 Samiya Ranawat on Medium]]></title>
        <description><![CDATA[Stories by Samiya Ranawat on Medium]]></description>
        <link>https://medium.com/@ranawatsamiya0?source=rss-beff72d4adcb------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*NA9Vtjypyu7iMGK-</url>
            <title>Stories by Samiya Ranawat on Medium</title>
            <link>https://medium.com/@ranawatsamiya0?source=rss-beff72d4adcb------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 15:56:31 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@ranawatsamiya0/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[Forecasting Diwali Pollution Spikes: Does Event Information Help?]]></title>
            <link>https://medium.com/@ranawatsamiya0/forecasting-diwali-pollution-spikes-does-event-information-help-6dde9a33b2e1?source=rss-beff72d4adcb------2</link>
            <guid isPermaLink="false">https://medium.com/p/6dde9a33b2e1</guid>
            <category><![CDATA[forecasting]]></category>
            <category><![CDATA[air-pollution]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[time-series-forecasting]]></category>
            <dc:creator><![CDATA[Samiya Ranawat]]></dc:creator>
            <pubDate>Sun, 27 Sep 2026 19:13:13 GMT</pubDate>
            <atom:updated>2026-09-29T10:17:48.977Z</atom:updated>
            <content:encoded><![CDATA[<p>“Pollution spikes on Diwali” is not an interesting claim, everyone already knows that. What actually is interesting is that although we see it coming every year, we are still not able to predict how severe the spike will be or how we can contain it. To understand this a bit more, I wanted to test if telling a forecasting model “Diwali is happening on this date” actually helps it predict how bad the spike will be or if simply the date is not enough.It is like knowing a friend’s birthday is next week. You know the exact date but you have no idea how they’re going to celebrate. Predicting Diwali’s pollution spike works the same way. Knowing the date tells a model nothing about how bad the air will actually get that year. The severity of it depends on factors such as the laws enforced, bans on firecrackers and how many people actually follow the rules.</p><h3><strong>Before We Get to the Models :</strong></h3><p>To understand how the models work, here are a few terms that we need to know .</p><p><strong>Time series </strong>is just a set of numbers attached to points in time, here, PM2.5 (fine particulate pollution) is measured once a day, day after day, for years.</p><p><strong>Forecasting </strong>is the act of guessing the next number in a time series from the numbers that came before it. Forecasting is the same instinct that tells you tomorrow is probably hot because the whole week has been hot. Forecasting models do that guessing with actual math .</p><p><strong>A model </strong>is simply a more careful, structured version of that guess. Some models are very simple such as one that just repeats yesterday’s number while others try to break a time series apart into pieces and analyze each piece separately.</p><p><strong>Trend </strong>is the slow, underlying direction in which the pollution numbers are drifting in, independent of any single event. Delhi’s air doesn’t suddenly get bad only on Diwali, pollution rises in October and November as temperatures drop. A phenomenon called a “temperature inversion” traps cold, dirty air close to the ground instead of letting the air rise and disperse. That gradual rise present with or without Diwali, is the trend.</p><p><strong>Seasonality: </strong>Think of this as the part of a pattern that repeats on a predictable calendar cycle, like a daily loop, a weekly routine, or a yearly event. Diwali is a great example. The festival happens every single year in the same general window and always brings a predictable mix of firecrackers and crop-residue burning. To forecast accurately, a model can’t just track the overall winter rise (trend), it must anticipate the sharp and temporary spike caused by the festival itself (seasonality). Diwali is the intersection of both trend and seasonality, a seasonal spike riding on top of a climbing trend.</p><p>Now that the basic terms are settled, let’s look into the models. Each one gets a bit more data than the one before it, showing us exactly how much that extra information helps.</p><p>For evaluating and comparing the models, we’re using Mean Absolute Error (MAE), which is just the average of how far off each prediction was from the actual value, ignoring whether it was too high or too low. A lower MAE means the model’s guesses were closer to reality, on average.</p><p>MAE = (1/n) × Σ|actual − predicted</p><h3><strong>Four Models, Four Levels of Knowing</strong></h3><p><strong>Model A: The Clueless One (Naive Baseline)</strong></p><p>This model has the least significance. It takes last week’s data on PM2.5 concentration as a forecast for today’s pollution. There is zero mathematical computation involved in the model except for shifting, and there is no concept of dates or seasons or Diwali, and it doesn’t even know about calendars.</p><p>This model may look like a naive approach but it is intentionally designed that way. This model might seem too dumb to work but actually this is exactly what it should be doing. The role of the naive baseline model is to provide the point of comparison for more complex models. If a model like Prophet or a pre-trained one cannot perform better than “copy the last week’s data,” then their added complexity is not justified at all.</p><p><strong><em>Model A code: prediction is simply last week’s value, shifted forward 7 days</em></strong></p><pre>import pandas as pd<br># Load the PM2.5 data and make sure it&#39;s sorted in date order<br>df = pd.read_csv(&quot;delhi_pm25.csv&quot;, parse_dates=[&quot;date&quot;])<br>df = df.sort_values(&quot;date&quot;).reset_index(drop=True)<br># The &quot;prediction&quot; is just last week&#39;s value, copied forward<br>df[&quot;naive_pred&quot;] = df[&quot;pm25&quot;].shift(7)<br># Look only at the window around Diwali 2019 to check how it did<br>window = df[df[&quot;date&quot;].between(&quot;2019–10–20&quot;, &quot;2019–11–03&quot;)]<br>print(window[[&quot;date&quot;, &quot;pm25&quot;, &quot;naive_pred&quot;]])</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CmH0FRIENpLrmp57S9Y4sw.png" /></figure><p><em>Model A: Naive baseline vs actual PM2.5</em></p><p><strong>Mean Absolute Error: 123.7. </strong>This means that the prediction errors for the model on a daily basis have been off the actual PM2.5 levels by an average of 123.7 micrograms per cubic meter (µg/m³). This is significant because anything over 250 µg/m³ means that it is extremely polluted air.The shocking thing about this error was the fact that the error was not experienced on the day of Diwali but after a week, which happened to be on 3rd November. At this point, the naive forecast was 198.8 which was nearly off by three times.</p><p><strong>Model B: Prophet, Default Settings</strong></p><p><strong>Prophet </strong>is a forecasting tool built by Meta that is designed specifically to pull trend and seasonality apart from a time series. It models each piece separately and then adds the pieces back together. Turning on yearly_seasonality and weekly_seasonality tells Prophet to look for a repeating yearly pattern and a repeating weekly pattern and to learn their shapes from the data. That setting is why Prophet was the second step after the naive model. It is built to notice exactly the kind of recurring pattern Diwali represents, without needing to be told anything about Diwali specifically.</p><p>In default form, though, Prophet only knows that “this time of year tends to be worse” as a smooth, generic curve. Prophet has no idea Diwali specifically is the reason why the model can’t distinguish an ordinary late-October day from the one day fireworks are set off across an entire city.</p><p><strong><em>Model B code: Prophet trained with yearly and weekly seasonality only</em></strong></p><pre>from prophet import Prophet<br># Prophet expects columns named exactly &quot;ds&quot; (date) and &quot;y&quot; (value)<br>prophet_df = df.rename(columns={&quot;date&quot;: &quot;ds&quot;, &quot;pm25&quot;: &quot;y&quot;})<br># Only train on data before mid-October so the model never &quot;sees&quot; this Diwali<br>train = prophet_df[prophet_df[&quot;ds&quot;] &lt; &quot;2019–10–15&quot;]<br># Turn on yearly and weekly seasonality, but tell it nothing about Diwali<br>model_b = Prophet(yearly_seasonality=True, weekly_seasonality=True) model_b.fit(train)<br># Ask Prophet to forecast 40 days into the future, covering Diwali<br>future = model_b.make_future_dataframe(periods=40)<br>forecast_b = model_b.predict(future)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xrsodlGz88Es5ZeOUhMKtQ.png" /></figure><p><em>Model B: Prophet default vs actual PM2.5</em></p><p>This setup brought the error down to 75.7, with a prediction of 250.8 on the true peak day. That’s better than Model A by a wide margin, but still a significant miss. The model senses something seasonal is happening (its learned yearly curve nudges upward around this time of year) without understanding why, so the model can’t anticipate a spike sharper than the smooth curve it learned.</p><p><strong>Model C: Prophet, Told About Diwali</strong></p><p>This is the same tool, but with one addition that is an explicit flag marking Diwali as a special date. The date has been learned from five real historical Diwalis (2015 through 2019), each with a short window before and after the holiday, so that the model can also account for the pre-Diwali shopping and burning that ramps up in the days leading into the festival.</p><p><strong><em>Model C code: Diwali passed to Prophet as a named holiday with a lead and trail window</em></strong></p><pre># List every real historical Diwali date, with a window before and after each<br>diwali_holidays = pd.DataFrame({<br>&quot;holiday&quot;: &quot;diwali&quot;,<br>&quot;ds&quot;: pd.to_datetime([&quot;2015–11–11&quot;, &quot;2016–10–30&quot;, &quot;2017–10–19&quot;, &quot;2018–11–07&quot;, &quot;2019–10–27&quot;]), &quot;lower_window&quot;: -1,<br>&quot;upper_window&quot;: 7,<br>})<br># Same setup as Model B, but now Prophet is explicitly told about Diwali<br>model_c = Prophet(yearly_seasonality=True, weekly_seasonality=True, holidays=diwali_holidays) model_c.fit(train)<br>future = model_c.make_future_dataframe(periods=40)<br>forecast_c = model_c.predict(future)</pre><p>This is where the difference comes in. The error rate goes down to 57.1, which is better than any of the four models, with the model predicting 289.8 while the actual value is 582.3. Mentioning Diwali in terms made the error rate of the model more than half of what it originally was. However, even with five actual years of Diwali data and a clear indicator stating that “the date is significant,” Model C still came out to be less than half of the actual maximum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9Ijl69g1LTS01ZacmIux4A.png" /></figure><p><em>Model C: Prophet + Diwali flag vs actual PM2.5</em></p><p><strong>Model D: A Pretrained Model (Chronos), Zero Shot</strong></p><p>What “zero-shot” means is that this model has never been trained on any air quality information in Delhi. Chronos is a pre-trained general purpose forecasting model that comes with prior exposure to vast amounts of time series data from different domains like sales statistics, weather, finance, energy consumption, etc. Chronos is provided with this data without any information about holidays, without any special flags and without any particular information about Diwali or pollution and is expected to make forecasts based on its general pattern recognition capabilities.</p><p>Adding Chronos allows us to ask a completely different question than our first few models. While other models were testing whether any information about Diwali helps, Chronos helps to answer whether knowledge of vast amounts of time series data can replace the knowledge of the local pattern.</p><p><strong><em>Model D code: Chronos forecasting directly from raw PM2.5 values, with zero fine-tuning</em></strong></p><pre>import torch<br>from chronos import ChronosPipeline<br># Same training cutoff as before, but Chronos only gets raw numbers, no dates<br>train_values = df[df[&quot;date&quot;] &lt; &quot;2019–10–15&quot;][&quot;pm25&quot;].values<br># Load the pretrained model - it already &quot;knows&quot; patterns from other domains<br>pipeline = ChronosPipeline.from_pretrained(&quot;amazon/chronos-t5-small&quot;, device_map=&quot;cpu&quot;, torch_dtype=torch.bfloat16)<br>context = torch.tensor(train_values)<br># Ask it to forecast the next 20 days with zero fine-tuning on this data<br>forecast = pipeline.predict(context, prediction_length=20)<br>median_forecast = forecast[0].numpy().mean(axis=0)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xn370qMFTL6XKgqJjY4dmA.png" /></figure><p><em>Model D: Chronos zero-shot vs actual PM2.5</em></p><p>This is the model that caught me by surprise. The error rate was 131.0 which is worse than all the other models, even the naive model. While the actual values were increasing from 198 to 582, the predictions of Chronos fluctuated only between 100 and 117. Chronos defaulted that the value would be “probably average,” and it failed miserably.</p><h3><strong>What This Actually Showed</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/715/1*SimtSZSY8x4FrMqq9D9C1Q.png" /></figure><p><em>A note on the data: these models run on real, publicly available Delhi air quality data from 2015 to 2020. That dataset ends before Diwali 2020, so 2019 (the most recent Diwali in the dataset, and the one with the most prior years to learn from) is what I tested on. The “488 µg/m³” figure sometimes quoted elsewhere is from 2025 reporting, included only to set up why this problem matters in the first place. The finding below isn’t specific to any single year.</em></p><h3><strong>The Bigger Point</strong></h3><p>Concluding that “the holiday-aware model won, case closed” would be easy, but what matters is not the error of each model compared to zero, it is the difference of the error from zero.</p><p><strong>Knowledge is good, but only as far as it can go. </strong>Model C reduced the naive model’s error more than twice but was still missed the real peak value by nearly 300 units since the problem is influenced by factors not reflected in the calendar such as effectiveness of the firecracker ban, conditions during a particular week (windiness, temperature) and the amount of burning crop residue. This is the same difference that is hidden behind the failure of the green-cracker mandate and fireworks ban every single year. The policy aims to target the specific date, but all other factors decide its success.</p><p><strong>Having more information is not the same as having the right information. </strong>Chronos, the model with the greatest amount of domain knowledge failed to predict the peak pollution value. It is a striking result because it means that the generalized prior knowledge about a lot of topics does not automatically make an accurate prediction on a particular issue. A model that has some information on many issues may not have enough information on the issue it is supposed to predict. Even something as crude as “this date is different” was enough to perform better than Chronos.</p><p><strong>The exposure period is longer than just “the date.” </strong>The 2019 peak happened a week after the day of Diwali, probably due to the temperature inversion making it impossible to get rid of the pollution for such a long time after the actual holidays were over. Public health advisories and school closures are typically timed around the festival date itself but the data shows the worst air quality often arrives days later, meaning the precaution is over before risk even starts .</p><h3><strong>The Calendar Knows When, Not How Much</strong></h3><p>This project was never really a story about Diwali, or even about air quality. The real finding here is a mistake that’s easy to make with anything driven by human behavior such as a protest, an election, a market panic, a product launch or a viral release. The calendar can always tell you when but it almost never tells you how much, or how long the damage lingers afterward.</p><p>Creating a model that knows the date is only 20 percent. Any model can be given a list of holidays and told to expect something unusual and Model C proved that. The other 80 percent is where all models, even the best, failed. This majority percentage depends on enforcement, weather, compliance, and anything else that is not on the calendar. No matter how effective a ban on firecrackers is, it will be useless without enforcement and the level of enforcement is unpredictable and unrecorded. Hundreds of personal decisions, from lighting the firecracker to burning the fields to driving instead of walking all accumulate into a severity level that a date information does not include.</p><p>That’s less a limitation of these four models specifically and more an honest description of what forecasting human-driven events will always be up against. The same gap shows up anywhere a known date collides with unknown behavior. Analysts can say an election is happening in November, but not how close the race will actually be. A retailer can say Black Friday is coming, but not whether this year’s crowds show up early or stay home entirely. A public health team can say flu season starts in winter, but not whether this year’s strain spreads twice as fast as last year’s. In every one of these cases, the date is the scaffolding, not the forecast.The takeaway isn’t that forecasting is broken, it’s that forecasting a date is a fundamentally easier problem than forecasting a magnitude, and conflating the two is where good policy and good models both quietly fail.</p><p>Github:https://github.com/samiyaranawat0/Diwali-pollution-forecasting</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6dde9a33b2e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>