<?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 Suvo Ganguli on Medium]]></title>
        <description><![CDATA[Stories by Suvo Ganguli on Medium]]></description>
        <link>https://medium.com/@subhabrata.ganguli?source=rss-493fda7dd5ac------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*4AxeAvEz_8lw73QT</url>
            <title>Stories by Suvo Ganguli on Medium</title>
            <link>https://medium.com/@subhabrata.ganguli?source=rss-493fda7dd5ac------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 17:16:47 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@subhabrata.ganguli/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[Discovering Hemodynamic Instability Patterns from ICU Trajectories]]></title>
            <link>https://medium.com/@subhabrata.ganguli/discovering-hemodynamic-instability-patterns-from-icu-trajectories-1a703aab54bf?source=rss-493fda7dd5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a703aab54bf</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[healthcare]]></category>
            <dc:creator><![CDATA[Suvo Ganguli]]></dc:creator>
            <pubDate>Sat, 09 May 2026 13:19:11 GMT</pubDate>
            <atom:updated>2026-05-09T13:19:11.027Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Using simple MAP-derived features to identify latent hemodynamic phenotypes in ICU patients</em></strong></p><h3>Introduction</h3><p>Mean Arterial Pressure (MAP) is one of the most important physiological variables monitored in Intensive Care Units (ICUs). Because MAP reflects the pressure driving blood flow to vital organs, sustained reductions in MAP can indicate inadequate organ perfusion, circulatory instability, and increased clinical risk. In critical care settings, clinicians often monitor MAP continuously to identify signs of hemodynamic deterioration before severe organ dysfunction develops.</p><p>At first glance, instability may appear straightforward to define. A common clinical threshold considers MAP values below approximately 65 mmHg as potentially concerning. However, real ICU physiology is far more complex than a simple binary distinction between “stable” and “unstable.” Some patients experience brief transient drops in MAP before rapidly recovering. Others remain chronically near hypotensive thresholds for extended periods. Some trajectories oscillate dramatically, while others show relatively smooth but sustained deterioration.</p><p>The challenge becomes even more difficult because ICU physiological data is inherently noisy, sparse, and heterogeneous. Two patients may have similar average MAP values while exhibiting completely different temporal behaviors. A patient with highly oscillatory blood pressure dynamics may represent a fundamentally different physiological state from a patient with prolonged low-pressure episodes, even if their average measurements appear similar.</p><p>To illustrate this heterogeneity, Figure 1 shows several representative ICU MAP trajectories from the PhysioNet 2019 Challenge dataset.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RTR4exQSONGw5Dw91qCD5w.png" /><figcaption><strong><em>Figure 1. Representative ICU MAP trajectories showing heterogeneous instability behavior, including sustained hypotension, oscillatory dynamics, and recovery patterns. The dashed red line indicates the MAP = 65 threshold commonly associated with hypotension risk.</em></strong></figcaption></figure><p>Rather than treating instability purely as a binary prediction problem, this project explores whether distinct hemodynamic instability phenotypes emerge naturally from ICU trajectory dynamics. Using simple MAP-derived statistical features, we investigate whether latent instability patterns can be identified across ICU patients and whether these phenotypes correspond to physiologically interpretable behaviors.</p><h3>Dataset</h3><p>For this exploratory analysis, I used the PhysioNet 2019 Challenge dataset, which contains hourly physiological measurements collected from Intensive Care Unit (ICU) patients. Each patient is represented as an independent time-series trajectory containing measurements recorded throughout the ICU stay.</p><p>The dataset includes several physiological variables commonly monitored in critical care settings, including:</p><ul><li>Mean Arterial Pressure (MAP)</li><li>Heart Rate (HR)</li><li>Systolic Blood Pressure (SBP)</li><li>Respiratory Rate (Resp)</li><li>Oxygen Saturation (O2Sat)</li><li>temperature</li><li>additional laboratory variables</li></ul><p>Rather than focusing on sepsis prediction, which was the original goal of the challenge dataset, this project focuses specifically on the temporal behavior of MAP trajectories and the structure of hemodynamic instability.</p><p>Each patient trajectory contains measurements sampled over time, creating longitudinal physiological sequences of varying duration. As expected for ICU data, the trajectories are heterogeneous and contain substantial missingness in some signals. However, MAP measurements were sufficiently available across most patients to support exploratory instability analysis.</p><p>To better understand the structure of the dataset before defining instability phenotypes, I first visualized multiple patient trajectories as shown above and examined how MAP behavior evolved over time across different ICU stays.</p><h3>Quantifying Hemodynamic Instability</h3><p>A central challenge in this project was determining how to represent hemodynamic instability in a meaningful way.</p><p>A naive approach would define instability using a simple threshold such as: MAP &lt; 65 mmHg.</p><p>However, this alone does not adequately capture the temporal behavior of ICU physiology. A patient who briefly dips below the threshold for a single hour may represent a very different physiological situation from a patient who remains hypotensive for prolonged periods. Similarly, some patients exhibit highly oscillatory trajectories with large excursions, while others remain chronically fragile with relatively smooth but persistently low MAP values.</p><p>Instead of relying solely on binary thresholding, I summarized each patient trajectory using several interpretable MAP-derived instability features:</p><ul><li><strong>Average MAP (</strong><strong>map_mean)</strong><br> Represents the overall circulatory pressure level throughout the ICU stay.</li><li><strong>MAP Variability (</strong><strong>map_std)</strong><br> Captures overall volatility and fluctuation magnitude.</li><li><strong>Low-MAP Burden (</strong><strong>low_map_fraction)</strong><br> Measures the fraction of recorded hours during which MAP remained below 65 mmHg.</li><li><strong>Longest Sustained Low-MAP Episode (</strong><strong>longest_low_map_run)</strong><br> Measures the longest consecutive duration of hypotension-like behavior.</li><li><strong>MAP Excursion Range (</strong><strong>map_range)</strong><br> Captures the total spread between the highest and lowest MAP values observed during the trajectory.</li></ul><p>Together, these features transform each ICU trajectory into a compact multidimensional description of instability behavior. Importantly, the goal was not to predict clinical outcomes directly, but rather to investigate whether latent instability patterns emerge naturally from the trajectory dynamics themselves.</p><p>Before clustering patients into phenotypes, I first explored the overall distribution of instability behavior across the cohort.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*UXkUnLgic6xM3J3t6DROtQ.png" /><figcaption><strong><em>Figure 2. Distribution of the longest sustained low-MAP episodes across ICU patients. Most patients exhibited little or no prolonged hypotension, while a smaller subset showed extended instability periods.</em></strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mazcx40KONquiESLgMjaOQ.png" /><figcaption><strong><em>Figure 3. Distribution of low-MAP burden across patients. While many ICU trajectories remained largely stable, some patients spent substantial fractions of their ICU stay below the MAP = 65 threshold.</em></strong></figcaption></figure><p>These distributions already suggested that ICU hemodynamic instability is highly heterogeneous. Most patients exhibited relatively short or infrequent low-MAP episodes, but a smaller subset showed prolonged hypotension or persistent instability burden.</p><p>Interestingly, the instability patterns did not appear to follow a simple continuum from “healthy” to “unhealthy.” Some patients demonstrated brief but severe excursions, while others hovered chronically near the hypotension threshold without dramatic fluctuations. This observation suggested that instability behavior might be better represented as multiple physiological regimes rather than a single scalar severity measure.</p><p>To further investigate this possibility, I next explored whether patients naturally clustered into distinct instability phenotypes based on their MAP-derived trajectory features.</p><h3>Discovering Hemodynamic Instability Phenotypes</h3><p>Using the instability metrics described above, each patient trajectory was transformed into a compact multidimensional representation of hemodynamic behavior. Although the features were intentionally simple, they captured several distinct aspects of instability, including chronic hypotension burden, oscillatory variability, sustained low-MAP episodes, and extreme excursion dynamics.</p><p>To explore whether latent instability phenotypes emerged naturally from these trajectory statistics, I applied KMeans clustering to the normalized feature space. The resulting patient groups were then visualized using Principal Component Analysis (PCA), which projects the multidimensional feature space into two dimensions while preserving the dominant variance structure.</p><p>Importantly, PCA was used only for visualization. The clustering itself was performed in the original multidimensional instability-feature space.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_B3__TJDBDeqmgI9mAM7_g.png" /><figcaption><strong><em>Figure 4. PCA visualization of ICU patients clustered using MAP-derived instability features. Distinct regions corresponding to stable physiology, chronic hypotensive fragility, oscillatory instability, and extreme excursion dynamics emerged naturally from the trajectory statistics.</em></strong></figcaption></figure><p>Several distinct instability regimes became immediately visible. While one large cluster corresponded to relatively stable physiology, other groups showed markedly different instability behaviors, including chronic sustained hypotension, highly oscillatory trajectories, and extreme excursion-heavy dynamics.</p><p>Most importantly, these phenotypes emerged without using clinical outcome labels or supervised learning targets. The instability structure appeared to arise directly from the temporal behavior of the MAP trajectories themselves.</p><h3>Representative Hemodynamic Phenotypes</h3><p>While the PCA visualization revealed clear clustering structure, the physiological meaning of the phenotypes becomes much more apparent when examining representative patient trajectories directly.</p><p>To better interpret the discovered clusters, I identified representative patients located near the center of each phenotype group and visualized their MAP trajectories over time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*gI66fj4lZ8W8-np-0SDiaA.png" /><figcaption><strong><em>Figure 5. Representative MAP trajectories from the discovered hemodynamic phenotypes. The clusters capture distinct instability behaviors including chronic hypotension, oscillatory instability, stable hemodynamics, and extreme excursion dynamics.</em></strong></figcaption></figure><p>Several distinct physiological behaviors emerged from the representative trajectories:</p><ul><li><strong>Stable Hemodynamics</strong><br> These patients remained largely above the hypotension threshold with relatively modest fluctuations and only occasional transient dips.</li><li><strong>Chronic Hypotensive Fragility</strong><br> These trajectories showed prolonged periods near or below the MAP = 65 threshold, representing persistent circulatory instability rather than isolated transient events.</li><li><strong>Oscillatory Instability</strong><br> These patients exhibited substantial fluctuations and variability but often recovered rapidly after excursions below the instability threshold.</li><li><strong>Extreme Excursion Dynamics</strong><br> These trajectories demonstrated large transient MAP swings and severe excursions without necessarily remaining chronically hypotensive.</li></ul><p>One of the most interesting observations was that instability did not appear to follow a simple progression from “healthy” to “unhealthy.” Instead, different patients expressed fundamentally different instability behaviors. Some trajectories were dominated by sustained low pressure, while others were characterized by large intermittent excursions or oscillatory dynamics.</p><p>This suggests that ICU hemodynamic instability may be better understood as a collection of physiological regimes rather than a single binary condition.</p><h3>Phenotype Feature Profiles</h3><p>To better understand which instability characteristics defined each phenotype, I next visualized the normalized feature profiles across the discovered clusters.</p><p>Because the instability metrics operate on different numerical scales, each feature was normalized independently before visualization. The resulting heatmap highlights the relative strength of each instability characteristic within each phenotype.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M90dETOsCB6xqNtbYIIBiA.png" /><figcaption><strong><em>Figure 6. Normalized feature profile of the discovered hemodynamic phenotypes. Chronic Hypotensive Fragility is characterized by high low-MAP burden and prolonged instability, while Extreme Excursion Dynamics exhibit large variability and excursion range without sustained hypotension.</em></strong></figcaption></figure><p>Several important patterns emerged from this comparison.</p><p>The <strong>Chronic Hypotensive Fragility</strong> phenotype showed the highest low-MAP burden and the longest sustained hypotension episodes, while simultaneously exhibiting relatively low average MAP values. These patients appeared persistently fragile rather than highly oscillatory.</p><p>In contrast, the <strong>Extreme Excursion Dynamics</strong> phenotype demonstrated very large MAP variability and excursion ranges without necessarily spending prolonged periods below the hypotension threshold. This suggests a fundamentally different instability mechanism dominated by severe transient fluctuations rather than chronic low-pressure states.</p><p>The <strong>Oscillatory Instability</strong> phenotype occupied an intermediate regime, characterized by noticeable variability and excursions but comparatively limited sustained hypotension burden.</p><p>Meanwhile, the <strong>Stable Hemodynamics</strong> phenotype showed relatively low instability intensity across nearly all feature dimensions.</p><p>One particularly important observation is that variability alone did not fully explain instability burden. Some patients exhibited large MAP fluctuations while remaining mostly above the hypotension threshold, whereas others remained chronically fragile despite comparatively modest variability. This highlights the multidimensional nature of ICU hemodynamic instability and helps explain why simple threshold-based labeling may fail to capture the full physiological structure of these trajectories.</p><h3>Broader Physiological Signals</h3><p>Up to this point, the phenotyping analysis was based entirely on MAP-derived instability features. An important question, however, was whether the discovered phenotypes also reflected broader physiological deterioration across other ICU signals.</p><p>To explore this, I compared additional physiological measurements across the discovered instability groups, including:</p><ul><li>Heart Rate (HR)</li><li>Respiratory Rate (Resp)</li><li>Oxygen Saturation (O2Sat)</li><li>temperature</li></ul><p>Interestingly, the broader physiological differences between phenotypes were comparatively modest.</p><p>Despite substantial differences in MAP instability behavior, many of the clusters showed relatively similar average heart rate, respiratory rate, oxygen saturation, and temperature values. This suggests that the discovered phenotypes were not simply rediscovering generalized physiological deterioration or illness severity.</p><p>Instead, the clustering appeared to isolate distinct patterns of circulatory instability specifically.</p><p>This distinction is important. A patient exhibiting prolonged hypotensive fragility may represent a fundamentally different physiological state from a patient experiencing extreme oscillatory excursions, even if their broader physiological measurements appear relatively similar on average.</p><p>The analysis also showed only modest enrichment of sepsis prevalence across the instability groups. This further supports the idea that the discovered phenotypes reflect broader hemodynamic behavior patterns rather than simply reproducing existing clinical labels.</p><p>Taken together, these observations suggest that ICU hemodynamic instability contains meaningful latent structure that may not be fully captured by binary thresholding or conventional outcome labels alone.</p><h3>Conclusion</h3><p>Hemodynamic instability in Intensive Care Unit (ICU) patients is often treated as a binary phenomenon defined by simple blood-pressure thresholds. However, the trajectory analysis in this project suggests that instability behavior is considerably more heterogeneous.</p><p>Using a small set of interpretable Mean Arterial Pressure (MAP)-derived features, distinct instability phenotypes emerged naturally from ICU physiological trajectories. These phenotypes included:</p><ul><li>stable hemodynamics,</li><li>chronic hypotensive fragility,</li><li>oscillatory instability,</li><li>and extreme excursion dynamics.</li></ul><p>Importantly, these instability regimes were discovered without using supervised outcome labels or complex deep learning models. Instead, much of the structure emerged directly from the temporal behavior of the physiological trajectories themselves.</p><p>One particularly interesting observation was that broader physiological measurements such as Heart Rate (HR), Respiratory Rate (Resp), Oxygen Saturation (O2Sat), and temperature remained comparatively similar across several phenotypes. This suggests that circulatory instability dynamics may contain latent structure that is not fully captured by generalized illness severity alone.</p><p>While this analysis is exploratory, it highlights the possibility that ICU hemodynamic instability may be better understood as a spectrum of physiological behaviors rather than a single binary condition. Even relatively simple trajectory-derived features were sufficient to reveal meaningful and interpretable instability patterns across ICU patients.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a703aab54bf" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Is Sleep Really Made of Discrete Stages?]]></title>
            <link>https://medium.com/@subhabrata.ganguli/is-sleep-really-made-of-discrete-stages-877e35635ec2?source=rss-493fda7dd5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/877e35635ec2</guid>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Suvo Ganguli]]></dc:creator>
            <pubDate>Thu, 07 May 2026 16:27:54 GMT</pubDate>
            <atom:updated>2026-05-07T16:38:11.272Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Exploring why EEG-based models fail at the boundaries between Wake, N1, N2, N3, and REM</em></strong></p><h3>Introduction</h3><p>Sleep is typically described as a sequence of discrete stages — Wake, N1, N2, N3, and REM — each defined by characteristic patterns in EEG signals.</p><p>This framework is widely used in clinical practice and research. Sleep stages help diagnose disorders, study brain activity, and evaluate overall sleep quality. The assumption is straightforward: each stage represents a distinct physiological state that can be identified from the signal.</p><p>But the brain does not operate in discrete steps. Its activity evolves continuously over time.</p><p>This raises a simple question: is sleep really made of clearly separable stages, or are some of these boundaries inherently ambiguous?</p><p>To explore this, I built a sleep-stage classification pipeline using EEG recordings from the Sleep-EDF dataset. Instead of focusing only on overall accuracy, I examined where the model fails — specifically, whether errors concentrate near transitions between stages.</p><p>Before getting into the results, it helps to briefly understand what these stages represent.</p><p>Wake is characterized by relatively high-frequency, low-amplitude activity, reflecting alert brain function. N1 is the lightest stage of sleep — essentially the transition from wakefulness into sleep — where the signal begins to change but still retains mixed characteristics. N2 represents more stable light sleep, with identifiable patterns such as sleep spindles. N3 is deep sleep, dominated by slow-wave activity, and is generally considered the most physiologically distinct stage. REM sleep, associated with dreaming, shows brain activity that in some ways resembles wakefulness, making it more complex to distinguish.</p><p>These definitions suggest a clean structure — distinct stages with identifiable signatures.</p><p>However, there is an important mismatch: the underlying EEG signal is continuous, while the labels are discrete.</p><p>If this mismatch matters, we would expect classification errors to appear in a structured way — not randomly, but concentrated in regions where the signal does not clearly belong to a single stage.</p><p>That is exactly what this study investigates.</p><p>Across both single-subject and multi-subject settings, and even after accounting for cross-subject variability through normalization, one consistent pattern emerges: sleep-stage transitions are systematically harder to classify than stable regions.</p><p>This suggests that the limitation is not just in the model, but in the signal itself — where the brain may not align cleanly with the discrete categories we impose on it.</p><h3>Dataset and Signals</h3><p>The data used in this study comes from the Sleep-EDF (Expanded) dataset, a publicly available collection of overnight sleep recordings widely used in sleep research.</p><p>Each recording contains polysomnography (PSG) signals along with expert-annotated sleep stages. The annotations divide the recording into 30-second epochs, assigning each segment a label such as Wake, N1, N2, N3, or REM. These labels form the ground truth for the classification task.</p><p>In this project, I focus on a single EEG channel (Fpz–Cz) to keep the setup intentionally simple. While full clinical sleep studies use multiple signals — including eye movements (EOG) and muscle activity (EMG) — restricting the model to one EEG channel makes the problem more challenging and highlights the limits of what can be inferred from the signal alone.</p><p>Each overnight recording spans several hours, resulting in thousands of labeled epochs per subject. These epochs are treated as independent samples: given a 30-second EEG segment, the goal is to predict its corresponding sleep stage.</p><p>Beyond the stage labels, I introduce an additional distinction for analysis. Each epoch is categorized as either <em>stable</em> or <em>transition</em>. An epoch is considered stable if the surrounding stages remain the same, and a transition if the stage changes nearby. This allows us to examine whether classification performance depends on the local structure of the signal, rather than treating all segments equally.</p><p>To better understand how these signals and labels relate in practice, the figure below shows a short segment of the EEG signal alongside the corresponding sleep-stage annotations.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Py0pNysUYgu3jNLP4gtikA.png" /><figcaption><strong>A short segment of EEG signal alongside annotated sleep stages. While the labels change discretely between stages, the underlying signal evolves continuously, making the boundaries between stages difficult to define.</strong></figcaption></figure><h3>A Controlled Setting</h3><p>To begin, I first looked at a simplified setting: training and evaluating the model on data from a single subject.</p><p>This removes cross-subject variability and gives a cleaner view of how well sleep stages can be separated when the signal characteristics remain consistent. For this baseline experiment, I used a Random Forest classifier trained on simple time-domain and frequency-based features extracted from each 30-second EEG segment.</p><p>In addition to predicting the sleep stage for each 30-second EEG segment, I labeled each epoch as either <em>stable</em> or <em>transition</em>, based on whether the surrounding stages remained the same or changed nearby. This allows us to compare model performance in regions where the signal is consistent versus regions where it is evolving.</p><p>The results are shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/840/1*X5fxWJUm0lcl4obbrDU0Ig.png" /><figcaption><strong>Classification accuracy for stable and transition epochs in a single-subject setting. Even under controlled conditions, performance drops near stage transitions.</strong></figcaption></figure><p>Even in this controlled setting, a clear pattern emerges.</p><p>The model performs significantly better on stable epochs than on transition epochs. While overall accuracy remains relatively high, there is a consistent drop in performance near transitions.</p><p>This is an important observation.</p><p>If classification errors were purely due to model limitations or noise, we would expect performance to degrade more uniformly. Instead, the model struggles specifically in regions where the sleep stage is changing.</p><p>This suggests that the difficulty is not evenly distributed across the signal. Certain regions — particularly those near stage boundaries — are inherently harder to classify.</p><p>At this stage, however, the result is still limited to a controlled setting. The model is seeing data from a single individual, with consistent signal characteristics.</p><p>To understand whether this behavior holds more generally, we need to move beyond a single subject and evaluate the model across multiple individuals.</p><h3>Beyond a Single Subject</h3><p>The results so far come from a controlled setting, where the model is trained and evaluated on data from a single individual. While this helps isolate patterns in the signal, it does not reflect how sleep-stage classification is typically used in practice.</p><p>In real-world scenarios, models must generalize across different individuals. This introduces an additional layer of complexity, as EEG signals can vary significantly from one subject to another due to differences in physiology, electrode placement, and recording conditions.</p><p>To test this, I extended the analysis to a multi-subject setting, training the model on data from several individuals and evaluating it on unseen subjects.</p><p>The results change substantially.</p><p>Overall accuracy drops compared to the single-subject case, reflecting the challenge of generalizing across subjects. More importantly, the gap between stable and transition regions remains — and becomes even more pronounced in relative terms.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*0ZsVCr-_8eeiNAiyeq4wgA.png" /><figcaption><strong>Classification accuracy for stable and transition epochs in a multi-subject setting without normalization. Performance drops significantly across subjects, while the gap between stable and transition regions persists.</strong></figcaption></figure><p>At this stage, however, there is an important confounding factor.</p><p>EEG signals differ not only in structure but also in scale. Amplitude and baseline variations across subjects can make the classification task artificially harder, even when the underlying patterns are similar.</p><p>This raises another question:</p><p>Is the observed difficulty due to true ambiguity in the signal, or simply due to differences in how the signal is measured across individuals?</p><p>To answer this, we need to account for cross-subject variability before drawing conclusions about the nature of the signal itself.</p><h3>Accounting for Cross-Subject Variability</h3><p>The drop in performance across multiple subjects suggests that generalization is a significant challenge. However, before attributing this entirely to the nature of the signal, there is an important factor to consider.</p><p>EEG recordings can differ substantially across individuals in terms of amplitude and baseline. These differences arise from a combination of physiological variation, electrode placement, and recording conditions. As a result, two signals with similar underlying patterns may appear quite different in scale.</p><p>This raises a key question:</p><p>Is the observed drop in performance due to true ambiguity in the signal, or simply due to differences in how the signal is measured across subjects?</p><p>To address this, I applied a simple normalization step to each EEG segment, standardizing it to have zero mean and unit variance. This removes differences in scale while preserving the relative structure of the signal.</p><p>The results after normalization are shown below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/830/1*lshHTddlOAijsCCU10eE3Q.png" /><figcaption><strong>Classification accuracy for stable and transition epochs in a multi-subject setting after normalization. While overall performance improves, accuracy remains consistently lower near transitions, indicating that the difficulty is not solely due to cross-subject variability.</strong></figcaption></figure><p>Normalization leads to a clear improvement in overall accuracy compared to the unnormalized case. This indicates that part of the difficulty in the multi-subject setting was indeed due to differences in signal scale across individuals.</p><p>However, one pattern remains unchanged.</p><p>Even after normalization, classification accuracy is consistently lower for transition epochs compared to stable ones. While the absolute performance improves, the gap between stable and transition regions persists.</p><p>This is a crucial observation.</p><p>By accounting for cross-subject variability, we remove a major confounding factor. What remains is not simply a modeling issue or a data scaling problem, but a structured difference in how well different parts of the signal can be classified.</p><p>This suggests that the difficulty near transitions is intrinsic to the signal itself, rather than an artifact of how the data is collected or processed.</p><h3>Where Does It Fail?</h3><p>The results so far show a consistent pattern: classification accuracy drops near transitions, even after accounting for cross-subject variability. But this raises a more precise question.</p><p>Where exactly does the model fail?</p><p>To answer this, I examined the confusion matrices separately for stable and transition epochs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l4K_haX865oqgiFzEFld8Q.png" /><figcaption><strong>Confusion matrices for stable and transition epochs. In stable regions, predictions are concentrated along the diagonal, indicating clear separability between stages. In transition regions, predictions spread across multiple classes, suggesting reduced separability and increased ambiguity near stage boundaries.</strong></figcaption></figure><p>In stable regions, the structure is clear. Most predictions lie along the diagonal, indicating that the model is able to distinguish between stages with relatively high confidence.</p><p>In contrast, the transition regions show a very different pattern. Instead of a clean diagonal, the predictions are spread across multiple classes. The model does not consistently confuse one stage with another; rather, it distributes its predictions across several possible stages.</p><p>This suggests that the issue is not simple misclassification, but a lack of clear separability in the signal itself.</p><p>To understand this further, I broke down accuracy by individual sleep stages.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VB2tn0SVeNcLJmA7NNmnlw.png" /><figcaption><strong>Per-stage classification accuracy for stable and transition epochs. While stages such as Wake and N2 remain relatively robust, others — particularly N1 and N3 — show significant degradation near transitions, indicating uneven separability across sleep stages.</strong></figcaption></figure><p>The results reveal a striking pattern.</p><p>Wake and N2 are relatively stable, maintaining high accuracy even near transitions. N3, while generally well-classified in stable regions, shows a sharp drop in accuracy during transitions.</p><p>But the most notable result is N1.</p><p>N1 exhibits extremely low accuracy in both stable and transition regions. Even when the surrounding labels indicate a stable state, the model struggles to identify it correctly.</p><p>This suggests that N1 may not function as a well-defined, separable state in the EEG signal. Instead, it behaves more like a transitional region — a boundary between other stages rather than a distinct category.</p><p>REM also shows relatively low accuracy compared to other stages, reflecting its complex and often overlapping signal characteristics.</p><p>Taken together, these results point to a deeper conclusion.</p><p>The difficulty in sleep-stage classification is not uniform. Some stages, such as Wake and N2, have strong and consistent signal signatures. Others, particularly N1 and transition regions, appear inherently ambiguous.</p><p>This reinforces the central idea of this study: the mismatch between continuous signals and discrete labels leads to structured, predictable failure — especially at the boundaries between stages.</p><h3>Rethinking Sleep Stages</h3><p>This study began with a simple question: can sleep stages, as defined in practice, be reliably separated from EEG signals?</p><p>Across multiple experiments, a consistent pattern emerged.</p><p>In controlled settings, classification accuracy is high, but drops near transitions between stages. When extended across multiple subjects, overall performance decreases due to variability in signal characteristics. After accounting for these differences through normalization, performance improves — but the gap between stable and transition regions remains.</p><p>Looking deeper reveals that this difficulty is not uniform. Some stages, such as Wake and N2, exhibit strong and consistent signal signatures. Others, particularly N1, show very low separability, even in stable regions. N3, while distinct in stable conditions, becomes significantly harder to identify near transitions.</p><p>Taken together, these results suggest that the challenge is not simply a limitation of the model.</p><p>Instead, it reflects a more fundamental mismatch: the underlying EEG signal is continuous, while the labels we assign to it are discrete.</p><p>Near transitions, the signal may not correspond cleanly to a single stage. Rather than representing distinct states, some stages — especially N1 — may function more like transitional regions between other states.</p><p>This has broader implications.</p><p>Sleep-stage classification is widely used in both research and clinical settings, often treated as a well-defined problem. But these results suggest that part of the difficulty is intrinsic to the data itself. Improving models alone may not fully resolve this issue; understanding the limits of the labeling framework is equally important.</p><p>More generally, this pattern is not unique to sleep signals. Many real-world systems involve continuous processes that are approximated using discrete categories. In such cases, errors are not always random — they may be structured, predictable, and tied to the boundaries between categories.</p><p>Recognizing these limits is as important as improving performance.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=877e35635ec2" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Limits of Image Reconstruction in Low-SNR Settings]]></title>
            <link>https://medium.com/@subhabrata.ganguli/the-limits-of-image-reconstruction-in-low-snr-settings-9b287b548c4c?source=rss-493fda7dd5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/9b287b548c4c</guid>
            <category><![CDATA[image-processing]]></category>
            <category><![CDATA[microscopy]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Suvo Ganguli]]></dc:creator>
            <pubDate>Tue, 28 Apr 2026 14:53:38 GMT</pubDate>
            <atom:updated>2026-04-28T14:53:38.374Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>How ambiguity and noise lead to structured simplification</em></strong></p><h3>The Limits of What We Can See</h3><p>Fluorescence microscopy is one of the primary tools used to visualize structures inside living cells. In datasets such as the Allen Cell images, specific proteins are tagged with fluorescent markers, allowing us to observe their spatial organization across the cell in three dimensions. But what we see is never a direct picture of reality. The imaging process itself — limited by optics, photon counts, and the need to avoid damaging living cells — introduces blur and noise.</p><p>In practice, scientists often operate under low signal-to-noise (low-SNR) conditions. Fewer photons are collected to preserve biological integrity or capture fast dynamics, and the resulting images become increasingly ambiguous. Image reconstruction methods, including modern neural networks, aim to recover the underlying structure from these degraded observations.</p><p>But this raises a deeper question: when the signal is weak and information is fundamentally lost, are we truly recovering structure — or are we beginning to interpret it?</p><h3>When Observations Become Ambiguous</h3><p>To understand what happens under low-SNR conditions, it helps to start with a simplified setting. Consider two closely spaced sources. When they are well separated, their signals are clearly distinguishable. But as the separation decreases, the imaging process — through blur and noise — begins to erase the distinction between them. At some point, two distinct sources produce observations that are nearly indistinguishable from a single source.</p><p>This is not a limitation of the model, but of the data itself. The forward imaging process destroys information, and once that information is lost, it cannot be uniquely recovered. The inverse problem becomes ill-posed: multiple underlying configurations can explain the same observation.</p><p>The figure below illustrates this transition. As the separation between two sources increases gradually, the observed signal changes only slightly. However, the reconstruction produced by the neural network behaves very differently. Below a certain separation, the model consistently interprets the input as a single structure. Above it, the model switches to resolving two distinct structures. The change in the model output is abrupt, even though the input varies continuously.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oAu7sT6g_1VcgUfn5dQUng.png" /><figcaption><strong>Two closely spaced sources (left) produce increasingly similar observations (middle) as their separation decreases. The neural network reconstruction (right) shows a sharp transition: below a critical separation, the model merges the sources into one; above it, it resolves them as two. This reveals an implicit decision boundary in the reconstruction process.</strong></figcaption></figure><p>This reveals a key point: under ambiguity, reconstruction is no longer a smooth recovery of structure. Instead, it becomes a form of decision-making — where the model selects one interpretation from multiple possibilities.</p><h3>Structured Simplification in Real Microscopy</h3><p>The behavior observed in the simplified setting is not limited to synthetic examples. In real microscopy data, the same constraints apply: blur, noise, and limited photon counts reduce the amount of recoverable information. To test this, we train a neural network directly on patches extracted from Allen Cell images, using degraded inputs and their corresponding clean versions.</p><p>At first glance, the model appears to perform well. It removes noise and produces visually coherent reconstructions. But a closer look reveals a consistent pattern. Fine details present in the original image — small variations, irregular textures, and sharp transitions — are systematically suppressed. In their place, the model produces smoother, more continuous structures.</p><p>The figure below shows this effect. The degraded input retains some trace of the original structure, but it is incomplete and ambiguous. The reconstruction fills in this ambiguity, not by recovering the exact underlying detail, but by converging to a simplified version of it. The result is not random or noisy — it is structured and stable — but it does not fully reflect the original signal.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BS0X9TmpTGS_sXzDpC9ZfA.png" /><figcaption><strong>A degraded microscopy patch (left) contains ambiguous and incomplete structure under low SNR. The neural network reconstruction (middle) produces a smooth, coherent image, but suppresses fine details present in the original signal (right). Rather than recovering the exact structure, the model converges to a simplified, low-frequency approximation.</strong></figcaption></figure><p>This is the same mechanism seen earlier, now expressed in a more subtle form. When the signal is insufficient, reconstruction shifts from recovering structure to approximating it. The model favors solutions that are consistent and low-frequency, even when the underlying reality is more complex. In this sense, the limitation is not simply that detail is lost, but that the reconstruction process introduces a bias toward simplified structure.</p><h3>What This Means for Reconstruction</h3><p>The examples in the previous sections point to a consistent pattern. When the signal is strong and the observations are informative, reconstruction behaves as expected. But as the signal weakens and ambiguity increases, the nature of the problem changes. The task is no longer to recover a unique underlying structure, because that structure is no longer uniquely determined by the data.</p><p>In this regime, neural networks do not fail in an obvious way. They do not produce random or unstable outputs. Instead, they produce results that are smooth, coherent, and plausible. The difficulty is that these reconstructions can appear convincing while systematically deviating from the true underlying structure.</p><p>This suggests that the limitation is not primarily in the model, but in the information available to it. Once the forward imaging process has removed critical detail, reconstruction becomes constrained by ambiguity. The model must select from a set of possible explanations, and in doing so, it introduces a bias toward simplified, stable structure.</p><p>Understanding this shift — from recovery to approximation — is important when interpreting reconstructed images. Especially under low-SNR conditions, it is not enough to ask whether a model produces clean outputs. We must also consider what information was lost, and how the reconstruction process fills that gap.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9b287b548c4c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Spacecraft Heat Shields Don’t Tell You: The Hidden Challenge of Reconstructing Heat Flux]]></title>
            <link>https://medium.com/@subhabrata.ganguli/what-spacecraft-heat-shields-dont-tell-you-the-hidden-challenge-of-reconstructing-heat-flux-fee202a96c7c?source=rss-493fda7dd5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/fee202a96c7c</guid>
            <category><![CDATA[space]]></category>
            <category><![CDATA[heat-transfer]]></category>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[heat-shields]]></category>
            <category><![CDATA[deep-learning]]></category>
            <dc:creator><![CDATA[Suvo Ganguli]]></dc:creator>
            <pubDate>Fri, 24 Apr 2026 15:53:19 GMT</pubDate>
            <atom:updated>2026-04-24T15:53:19.604Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Why smooth temperature measurements hide sharp boundary heating — and how the right representation makes the inverse problem tractable</em></strong></p><h3>The Setup: What Are We Trying to Recover?</h3><p>When a spacecraft re-enters Earth’s atmosphere, its heat shield is exposed to intense and rapidly changing thermal loads. The quantity of interest is the <strong>surface heat flux</strong> — how much heat is entering the material over time. However, this quantity cannot be measured directly at the surface during flight.</p><p>Instead, engineers embed <strong>thermocouples beneath the surface</strong> of the heat shield. These sensors record temperature as a function of time at different depths inside the material. What we observe, therefore, is not the input itself, but its <strong>effect after it has propagated through the material</strong>.</p><p>This leads to a natural inverse problem:</p><blockquote>Given temperature measurements at a few internal locations, can we reconstruct the surface heat flux that caused them?</blockquote><p>The forward physics is straightforward. Heat diffuses from the surface into the material according to well-understood equations. If the surface heat flux is known, computing the temperature at any depth is relatively easy.</p><p>The inverse direction is fundamentally different.</p><p>We are trying to infer an <strong>unknown boundary input</strong> from <strong>indirect, delayed, and smoothed observations</strong>. The model never sees the quantity it is asked to predict. It must reconstruct it purely from how the system responds.</p><p>To make this concrete, we consider a simplified setting:</p><ul><li>A one-dimensional slab</li><li>A time-varying heat flux applied at the surface</li><li>Temperature measured at a few fixed depths</li></ul><p>This controlled setup allows us to isolate the core difficulty of the problem before introducing additional real-world complexity.</p><h3>The Physics Problem: Information Gets Smoothed</h3><p>Before introducing any machine learning model, it is important to understand what the physics itself does to the signal we are trying to recover.</p><p>When heat is applied at the surface, it does not propagate instantly. Instead, it <strong>diffuses</strong> into the material. This diffusion process has two important effects:</p><ul><li>it <strong>delays</strong> the response at deeper locations</li><li>it <strong>smooths</strong> the signal over time</li></ul><p>A sharp, well-defined input at the boundary does not remain sharp as it travels inward. By the time it reaches an internal sensor, it has already been transformed into a smoother and more gradual temperature curve.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YFyCjlYMCd7baSNh2t7bXw.png" /><figcaption><strong>A rectangular heat flux applied at the surface is transformed into delayed and smoothed temperature signals at internal sensor locations, with deeper sensors showing greater lag and attenuation.</strong></figcaption></figure><p>In the figure above, the top plot shows a simple heat flux pulse applied at the surface. The bottom plot shows the resulting temperature measured at several depths inside the material.</p><p>Two things are immediately apparent:</p><ul><li>The deeper the sensor, the more <strong>delayed</strong> the response</li><li>The signal becomes progressively more <strong>smoothed and spread out</strong></li></ul><p>This smoothing is not just a visual artifact — it represents a real loss of information. In particular, the sharp transitions in the original signal (such as the sudden start and stop of the pulse) are no longer directly visible in the measurements.</p><p>This has a critical consequence for the inverse problem:</p><blockquote>The measurements do not uniquely determine the original input.</blockquote><p>Different heat flux profiles can produce very similar temperature responses once diffusion has acted on them. In other words, some of the information required to perfectly reconstruct the original signal has already been lost in the forward process.</p><p>This is the core difficulty we will encounter when we try to recover the surface heat flux from internal measurements.</p><h3>First Attempt: Direct Sequence Reconstruction</h3><p>A natural approach to this problem is to directly learn the mapping from sensor measurements to the unknown heat flux over time.</p><p>In this formulation:</p><ul><li><strong>Input</strong>: temperature time series from sensors at multiple depths</li><li><strong>Output</strong>: the full time-varying surface heat flux q(t)q(t)q(t)</li></ul><p>We train a temporal convolutional neural network (CNN) to learn this mapping end-to-end. The model has access to the entire sequence of sensor measurements and is tasked with reconstructing the corresponding heat flux at each time step.</p><p>This setup makes minimal assumptions about the form of the solution. The model is free to predict any waveform that best fits the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3By5UOeYVBH3aPaWYyAxZQ.png" /><figcaption><strong>The CNN-based reconstruction identifies when heating occurs but fails to recover sharp transitions, producing a lagged and smoothed version of the true rectangular pulse along with small oscillations after the pulse ends.</strong></figcaption></figure><p>At first glance, the model appears to perform reasonably well. It correctly identifies:</p><ul><li>when heating begins</li><li>when it ends</li><li>the approximate magnitude of the heat flux</li></ul><p>However, a closer look reveals consistent patterns in the prediction:</p><ul><li>the reconstructed signal is <strong>smoothed</strong>, especially near sharp transitions</li><li>the onset and offset of the pulse are slightly <strong>delayed</strong></li><li>small oscillations appear after the pulse ends</li></ul><p>The model is not reproducing the original rectangular pulse exactly, even in this simplified and noise-free setting.</p><p>This is not simply a matter of model capacity or training time. Instead, it reflects a deeper issue with how the problem is being posed.</p><p>In the next section, we examine why this direct sequence formulation struggles, despite having access to the full sensor data.</p><h3>Why the Sequence Model Struggles</h3><p>The behavior of the CNN is not accidental, nor is it primarily a limitation of model capacity. Instead, it reflects a deeper issue with the inverse problem itself.</p><p>To understand this, we need to look at what information is actually available in the measurements.</p><h3>Loss of High-Frequency Information</h3><p>As seen earlier, heat diffusion acts as a smoothing process. Sharp features in the surface heat flux — such as sudden jumps at the start and end of the pulse — are progressively blurred as they propagate into the material.</p><p>By the time the signal reaches the internal sensors:</p><ul><li>the exact location of sharp edges is no longer clearly defined</li><li>transitions appear gradual rather than abrupt</li></ul><p>This means that the measurements do not contain enough information to uniquely determine the original waveform.</p><h4>Non-Uniqueness of the Inverse Mapping</h4><p>Because of this smoothing, different heat flux profiles can produce very similar temperature responses.</p><p>In other words:</p><blockquote>Multiple input signals are consistent with the same set of measurements.</blockquote><p>When the model is asked to reconstruct the full time series, it is effectively choosing one solution among many plausible ones. There is no single “correct” answer that can be perfectly recovered from the data alone.</p><h4>Bias Toward Smooth Solutions</h4><p>The learning process introduces an additional effect. The model is trained using a mean squared error loss, which penalizes large deviations but does not explicitly favor sharp transitions.</p><p>As a result, the model tends to produce solutions that are:</p><ul><li><strong>smooth</strong> rather than discontinuous</li><li><strong>stable</strong> rather than highly variable</li></ul><p>This is why the reconstructed signal appears rounded and slightly delayed instead of sharply rectangular.</p><h4>Putting It Together</h4><p>The sequence model is solving a high-dimensional inverse problem where:</p><ul><li>information has been partially lost due to diffusion</li><li>the mapping from measurements to input is not unique</li><li>the training objective favors smooth approximations</li></ul><p>Seen in this light, the model is behaving exactly as expected. It produces a reconstruction that is consistent with the data, but not identical to the original signal.</p><p>This naturally raises the question:</p><blockquote>Is there a way to reformulate the problem so that the ambiguity is reduced?</blockquote><p>In the next section, we explore a different approach that does exactly that.</p><h3>A Different Approach: Parameter Estimation</h3><p>The difficulty of the sequence reconstruction approach comes from the fact that we are trying to recover a full time series. In our setup, this means predicting the value of the heat flux at every time step — on the order of <strong>2000 unknowns</strong>.</p><p>Given the ambiguity introduced by diffusion, this is a highly under-constrained problem.</p><p>Instead of attempting to recover the entire waveform directly, we take a different approach:</p><blockquote>We restrict the solution to a simple, physically meaningful form.</blockquote><p>In this case, the surface heat flux is modeled as a single rectangular pulse, defined by just three parameters:</p><ul><li><strong>Start time</strong></li><li><strong>Duration (width)</strong></li><li><strong>Amplitude</strong></li></ul><p>This transforms the problem from predicting a high-dimensional time series into estimating just <strong>three scalar quantities</strong>.</p><h4>From High-Dimensional to Low-Dimensional Inference</h4><p>This change dramatically alters the nature of the problem.</p><ul><li>Sequence reconstruction: ~2000 degrees of freedom</li><li>Parameter estimation: <strong>3 degrees of freedom</strong></li></ul><p>Instead of searching over all possible waveforms, the model now only needs to identify the pulse that best explains the observed temperature response.</p><p>This is a much smaller and more structured space of solutions.</p><h4>Why This Matters</h4><p>Even though diffusion smooths the signal, the key characteristics of the pulse are still present in the measurements:</p><ul><li>the <strong>onset</strong> of heating is reflected in when temperatures begin to rise</li><li>the <strong>duration</strong> influences how long the response continues to increase</li><li>the <strong>amplitude</strong> affects the overall magnitude of the temperature change</li></ul><p>These features are preserved, even when the exact shape of the waveform is not.</p><p>By focusing on these parameters, we are asking the model to recover only what the data can reliably support.</p><h4>Model Setup</h4><p>The model architecture remains similar:</p><ul><li><strong>Input</strong>: temperature time series from multiple depths</li><li><strong>Output</strong>: three values — start time, width, and amplitude</li></ul><p>Once these parameters are predicted, the heat flux waveform can be reconstructed analytically.</p><p>This reformulation shifts the problem from recovering an arbitrary signal to estimating a structured representation of that signal.</p><p>In the next section, we examine how well this approach performs.</p><h3>What Changes When We Add Structure</h3><p>When the problem is reformulated in terms of parameters, the results change significantly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*-hUyCgBgbQ9Vh-CrU1Iufg.png" /><figcaption><strong>Accurate recovery of start time, width, and amplitude demonstrates that while the full waveform is difficult to reconstruct, its essential parameters remain identifiable from internal temperature measurements.</strong></figcaption></figure><p>The predictions align closely with the ground truth across all three parameters:</p><ul><li><strong>Start time</strong> is recovered almost perfectly</li><li><strong>Width</strong> follows a tight linear trend with minimal deviation</li><li><strong>Amplitude</strong> shows slightly more spread, but remains highly accurate</li></ul><p>Unlike the sequence reconstruction case, there is no visible lag, smoothing, or oscillation. The model is able to directly infer the key characteristics of the pulse from the sensor data.</p><h4>A Different Kind of Inference Problem</h4><p>The improvement is not due to a more complex model, but due to a change in how the problem is posed.</p><p>In the sequence formulation, the model must infer a full waveform with thousands of degrees of freedom. Because diffusion removes high-frequency details, many different waveforms are consistent with the same measurements.</p><p>In contrast, the parameter formulation restricts the solution to a small family of possible signals. Within this restricted space:</p><ul><li>the ambiguity is greatly reduced</li><li>the mapping from measurements to parameters becomes more stable</li><li>the model can focus on extracting features that are actually preserved in the data</li></ul><h4>What the Model Is Really Learning</h4><p>The model is no longer trying to reconstruct every point in time. Instead, it is learning to detect:</p><ul><li>when the temperature response begins to change</li><li>how long the change persists</li><li>how large the response becomes</li></ul><p>These are precisely the features that remain visible after diffusion.</p><p>As a result, the inverse problem becomes far more tractable.</p><p>This leads to a natural final step: using the predicted parameters to reconstruct the original heat flux signal.</p><h3>Reconstruction from Parameters</h3><p>Once the parameters of the pulse are estimated, reconstructing the heat flux signal becomes straightforward. The predicted start time, width, and amplitude fully define the waveform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*E0Fppbqlmke1zFRd5wA8wg.png" /><figcaption><strong>Reconstruction of the heat flux from predicted parameters closely matches the true signal, including sharp transitions, demonstrating that the underlying pulse structure can be recovered accurately.</strong></figcaption></figure><p>The reconstructed signals closely match the original heat flux, including the sharp transitions at the beginning and end of the pulse.</p><p>In contrast to the direct sequence reconstruction, the result here is:</p><ul><li><strong>clean and piecewise constant</strong></li><li><strong>free of oscillations</strong></li><li><strong>accurately aligned in time</strong></li></ul><p>The key difference is that the reconstruction is no longer inferred point-by-point. Instead, it is generated from a small set of parameters that have been estimated reliably from the data.</p><h4>Why This Works</h4><p>The model is not recovering details that were lost during diffusion. Instead, it is identifying the underlying structure that remains encoded in the measurements.</p><p>Once the parameters are known, the full waveform can be reconstructed analytically, without introducing smoothing or ambiguity.</p><p>This highlights an important distinction:</p><ul><li>The <strong>exact waveform</strong> is difficult to infer directly</li><li>The <strong>structure of the waveform</strong> is much easier to recover</li></ul><h4>A Simpler Problem, a Better Result</h4><p>By reducing the problem from a high-dimensional signal reconstruction to a low-dimensional parameter estimation task, we avoid the instability inherent in the original formulation.</p><p>The result is not just better numerically, but qualitatively different: the reconstructed signal retains the sharp features that were previously lost.</p><p>This naturally leads to the central insight of this work.</p><h3>The Core Insight</h3><p>The key result of this study is not that one model performs better than another, but that the <strong>formulation of the inverse problem determines how difficult it is to solve</strong>.</p><p>When we attempt to reconstruct the full heat flux waveform, we are solving a high-dimensional problem with thousands of degrees of freedom. Because diffusion smooths the signal, many different inputs can produce similar internal temperature measurements. The inverse mapping is therefore <strong>ill-posed</strong>, and the model settles on a smooth approximation that is consistent with the data but not exact.</p><p>In contrast, when we restrict the solution to a small set of physically meaningful parameters, the problem changes fundamentally.</p><p>Instead of estimating ~2000 values, we estimate just <strong>three</strong>.</p><p>This reduction:</p><ul><li>removes much of the ambiguity</li><li>focuses the model on features that are actually preserved in the data</li><li>converts the problem into a stable and well-conditioned inference task</li></ul><p>The essential information — <strong>when heating begins, how long it lasts, and how strong it is</strong> — remains encoded in the measurements, even though the exact waveform does not.</p><h4>Final Takeaway</h4><blockquote>Inverse problems are not just about learning from data — they are about choosing the right representation of the solution.</blockquote><p>When the representation aligns with the underlying physics, even a difficult problem becomes tractable. When it does not, even powerful models struggle.</p><p>Ultimately, spacecraft heat shields do not “tell” us the heat flux directly — they only reveal its effects after diffusion has acted on it. The challenge is to infer the cause from these effects, and this requires more than data and models. It requires choosing a representation that matches the physics. When that alignment is achieved, even an ill-posed problem becomes solvable.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fee202a96c7c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Hidden Pattern in Galaxy Rotation Curve Deviations]]></title>
            <link>https://medium.com/@subhabrata.ganguli/a-hidden-pattern-in-galaxy-rotation-curve-deviations-d0078cc1d3dc?source=rss-493fda7dd5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/d0078cc1d3dc</guid>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[astrophysics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[pca-analysis]]></category>
            <dc:creator><![CDATA[Suvo Ganguli]]></dc:creator>
            <pubDate>Mon, 20 Apr 2026 13:33:11 GMT</pubDate>
            <atom:updated>2026-04-20T13:33:11.791Z</atom:updated>
            <content:encoded><![CDATA[<p>Using data to uncover a simple structure behind how galaxies differ from baryonic predictions</p><h3>Introduction</h3><p>When we look at galaxies, we can measure how fast stars and gas move as a function of distance from the center. Intuitively, we expect objects farther out to move more slowly — much like planets in the solar system.</p><p>But galaxies don’t behave that way.</p><p>Instead of slowing down, stars in the outer regions often move just as fast as — or even faster than — those closer to the center. This mismatch between expectation and observation is one of the most well-known puzzles in astrophysics.</p><p>To understand this, astronomers estimate how much “visible” matter a galaxy contains. This includes stars, gas, and dust — everything that emits or reflects light. Using this visible matter, we can predict how fast the galaxy <em>should</em> rotate. This prediction is called the <strong>baryonic model</strong>, where “baryonic” simply refers to ordinary matter.</p><p>However, when we compare this prediction to what we actually observe, there is a consistent gap:</p><ul><li>The <strong>observed velocity</strong> is higher than expected</li><li>The <strong>baryonic model underestimates the rotation</strong>, especially in the outer regions</li></ul><p>This difference is often attributed to <strong>dark matter</strong> — an unseen component that does not emit light but contributes to the galaxy’s mass.</p><p>In this work, instead of directly modeling dark matter, we focus on something simpler and more data-driven:</p><blockquote>the difference between what we observe and what baryonic matter predicts.</blockquote><p>This difference, which we call the <strong>residual</strong>, captures how much the galaxy deviates from expectations based on visible matter alone.</p><p>Rather than analyzing each galaxy individually, we ask a broader question:</p><blockquote>Do these residuals follow any pattern across galaxies, or are they arbitrary?</blockquote><h3>From Rotation Curves to Residuals</h3><p>To make this comparison concrete, we look at <strong>rotation curves</strong> — plots of how velocity changes with distance from the center of a galaxy.</p><p>For each galaxy, we have two key quantities:</p><ul><li><strong>Observed velocity</strong> — how fast stars and gas are actually moving</li><li><strong>Baryonic velocity</strong> — how fast we expect them to move based only on visible matter</li></ul><p>The figure below shows an example of both.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*wCx_bQrFRY4-cLc01PA_XQ.png" /><figcaption><strong>Observed rotation curve (blue) compared with the baryonic prediction (black), which is constructed from visible matter components: the stellar disk (orange), gas (green), and bulge (red, if present). While the baryonic model captures the inner region, it underestimates the observed velocity at larger radii.</strong></figcaption></figure><p>Even without going into details, one thing stands out:</p><ul><li>The baryonic prediction rises and then begins to decline</li><li>The observed velocity, however, remains high even at large radii</li></ul><p>This gap between the two curves is the core of the problem.</p><h4>Defining the Residual</h4><p>Rather than modeling this gap directly, we take a simpler approach.</p><p>We define the <strong>residual</strong> as:</p><blockquote>the difference between observed velocity and baryonic prediction</blockquote><p>In other words:</p><ul><li>If the residual is <strong>zero</strong>, the baryonic model works perfectly</li><li>If the residual is <strong>positive</strong>, the observed velocity is higher than expected</li><li>If the residual is <strong>negative</strong>, the baryonic model overestimates the velocity</li></ul><p>This gives us a new way to think about galaxies — not just in terms of velocity, but in terms of <strong>how much they deviate from visible matter predictions</strong>.</p><h4>Looking Across Many Galaxies</h4><p>Instead of focusing on a single galaxy, we now compute this residual for many galaxies.</p><p>The dataset used here is the <strong>SPARC database</strong>, which contains high-quality rotation curves and mass models for 175 disk galaxies.</p><p>When we plot the residuals for a small subset of galaxies, we get the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1002/1*z4P7whKg8Z1PCG2cWR5DEA.png" /><figcaption><strong>Residual velocity curves for a subset of galaxies, defined as the difference between observed velocity and baryonic prediction. Each curve represents how much a galaxy deviates from expectations based on visible matter alone. The variation across galaxies suggests underlying structure rather than random noise.</strong></figcaption></figure><p>At first glance, these curves look messy.</p><p>But two things are immediately clear:</p><ol><li>The residuals are <strong>not random noise</strong></li><li>Different galaxies show <strong>distinct patterns of deviation</strong></li></ol><p>Some galaxies show a gradual increase in the residual with radius.<br> Others remain negative for a long range before turning positive.<br> Some transition quickly, while others do so much later.</p><h4>A Natural Question</h4><p>This leads to a simple but important question:</p><blockquote>Are these residual curves fundamentally different for every galaxy,<br> or do they follow a smaller number of underlying patterns?</blockquote><p>If the residuals are completely arbitrary, then each galaxy must be understood individually.</p><p>But if there is structure — even hidden structure — then we may be able to describe all galaxies using just a few underlying degrees of freedom.</p><p>This is the question we explore next.</p><h4>Finding Structure in the Residuals</h4><p>At this point, we have a collection of residual curves — one for each galaxy.</p><p>Each curve describes how much the observed rotation differs from what visible matter predicts, as a function of radius. While these curves look different at first glance, the question is:</p><blockquote>Are these differences arbitrary, or do they follow a smaller set of underlying patterns?</blockquote><h3>A Simple Idea: Compress the Curves</h3><p>To explore this, we use a method called <strong>principal component analysis (PCA)</strong>.</p><p>Rather than treating each residual curve as completely unique, PCA looks for common patterns across all galaxies. It tries to answer:</p><blockquote>Can we describe every curve as a combination of a few basic shapes?</blockquote><p>If this is possible, it means that the apparent complexity in the data is actually driven by a small number of underlying factors.</p><h4>How Many Patterns Do We Need?</h4><p>We can measure this by looking at how much variation is explained as we add more components.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*QzMgPeHMC9UxbJiHmTAvAQ.png" /><figcaption><strong>Cumulative explained variance from principal component analysis (PCA) applied to residual curves. A small number of components capture most of the variation, indicating that the residuals are low-dimensional and share common underlying patterns.</strong></figcaption></figure><p>The result is striking:</p><ul><li>The first component alone captures most of the variation</li><li>Just two or three components are enough to describe nearly all galaxies</li></ul><p>This tells us something important:</p><blockquote>The residuals are not arbitrary — they are <strong>low-dimensional</strong>.</blockquote><p>Even though each galaxy has its own curve, these curves are all variations of a small number of underlying shapes.</p><h4>Interpreting the First Component</h4><p>Among these components, the first one (PC1) plays a special role.</p><p>It captures the <strong>dominant way in which residual curves differ from each other</strong>.</p><p>Instead of trying to interpret PC1 abstractly, we ask a more concrete question:</p><blockquote>What physical property could explain this variation?</blockquote><p>Looking back at the residual curves, one feature stands out:</p><ul><li>In some galaxies, the residual becomes positive very early</li><li>In others, this transition happens much later</li></ul><p>In other words, galaxies differ in <strong>where the baryonic model starts to fail</strong>.</p><h4>A Candidate: The Transition Radius</h4><p>We define a simple quantity:</p><blockquote>the <strong>transition radius</strong> — the point at which the residual crosses zero</blockquote><p>This marks the boundary between:</p><ul><li>regions where baryonic matter explains the rotation</li><li>regions where it does not</li></ul><h4>A Clear Relationship</h4><p>When we compare PC1 to this transition radius, we find a strong and consistent relationship:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/938/1*7qFXEJlT6RtByFdfQkHOug.png" /><figcaption><strong>Relationship between the first principal component (PC1), which captures the dominant mode of variation in residual shape, and the transition radius — the point where the residual becomes positive. The strong trend indicates that residual shape is closely tied to where baryonic predictions begin to fail.</strong></figcaption></figure><p>Galaxies with:</p><ul><li><strong>large transition radii</strong> tend to have low PC1 values</li><li><strong>small transition radii</strong> tend to have high PC1 values</li></ul><p>This suggests that:</p><blockquote>The dominant variation in residual shape is closely tied to where the deviation from baryonic predictions begins.</blockquote><h4>Seeing the Structure in PCA Space</h4><p>To confirm this, we can look at how galaxies are arranged in PCA space and color them by transition radius:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/892/1*IzzY7j-k5abGWNahiq8YUg.png" /><figcaption><strong>PCA representation of galaxies colored by transition radius. The overlaid trend line traces a clear curved path, indicating that galaxies lie along a continuous manifold governed by where the residual first becomes positive.</strong></figcaption></figure><p>A smooth gradient appears across the distribution.</p><p>This shows that:</p><ul><li>galaxies are not scattered randomly</li><li>the low-dimensional structure identified by PCA is organized by a <strong>single, physically meaningful parameter</strong></li></ul><h4>What This Means</h4><p>Putting this together:</p><ul><li>Residual curves vary across galaxies</li><li>But this variation is not arbitrary</li><li>It can largely be described by a single factor:<br> <strong>the radial onset of deviation from baryonic predictions</strong></li></ul><p>This gives us a much simpler way to think about the problem.</p><p>Instead of analyzing each galaxy independently, we can view them as part of a <strong>continuous family</strong>, where the main difference lies in how early or late the baryonic model begins to break down.</p><h3>What We Learned — and What We Didn’t</h3><p>This exploration started with a simple question:<br> are the deviations from baryonic predictions arbitrary, or do they follow a pattern?</p><p>The results point to a clear answer.</p><p>First, the residuals are not random. Despite the apparent diversity across galaxies, their behavior can be described using just a small number of underlying patterns. This indicates that the system is structured, not chaotic.</p><p>Second, the dominant variation in residual shape is closely tied to a single quantity:<br> the radius at which the baryonic model begins to fail. Galaxies form a continuous family, ranging from those where visible matter explains most of the rotation to those where the deviation appears almost immediately.</p><p>At the same time, this transition scale is not strongly predicted by simple global properties such as total luminosity or size. This suggests that the underlying physics is not fully captured by these bulk quantities alone.</p><p>In other words:</p><ul><li>the structure is simple</li><li>the explanation is not</li></ul><p>This leaves open an important question. If the behavior of galaxies can be summarized so compactly, what deeper parameters are actually controlling it?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d0078cc1d3dc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Limits of Recovering Lattice Disorder from Diffraction]]></title>
            <link>https://medium.com/@subhabrata.ganguli/limits-of-recovering-lattice-disorder-from-diffraction-1285dfb4cf75?source=rss-493fda7dd5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/1285dfb4cf75</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[computer-vision]]></category>
            <category><![CDATA[inverse-problem]]></category>
            <dc:creator><![CDATA[Suvo Ganguli]]></dc:creator>
            <pubDate>Fri, 17 Apr 2026 16:59:31 GMT</pubDate>
            <atom:updated>2026-04-17T16:59:31.823Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>A study of jitter, vacancies, and ambiguity in inverse mapping</em></strong></p><h3>Introduction</h3><p>Reconstructing lattice structure is important because properties such as electrical conductivity, mechanical strength, and thermal behavior are fundamentally determined by how atoms are arranged. In many experimental settings, diffraction measurements provide the only practical way to access this structure.</p><p>Diffraction-based reconstruction is therefore an inverse problem: <em>we observe patterns in Fourier space and attempt to infer the underlying atomic arrangement</em>. However, real materials are rarely perfect. They contain both positional disorder (e.g., thermal motion or strain) and defects such as vacancies, and these different mechanisms can affect material behavior in distinct ways. Ideally, one would like to distinguish between such sources of disorder, but it is not clear whether diffraction data alone contains enough information to do so reliably. As a result, different structural configurations can produce similar diffraction patterns. <strong>Even with perfect measurements, the inverse problem may be fundamentally ambiguous.</strong></p><p>This raises a central question: <strong>what aspects of structural disorder are actually recoverable from diffraction data, and what becomes intrinsically ambiguous?</strong></p><p>In this project, we construct a controlled synthetic setting where both positional jitter and vacancy levels are varied, and use machine learning models to probe the limits of this inverse mapping.</p><h3>Problem Setup</h3><p>To study the limits of recovering disorder from diffraction, we construct a controlled synthetic system based on a 2D lattice. This allows us to vary different types of disorder independently and observe their effect on the resulting diffraction patterns.</p><p>We begin with a regular square lattice of points on a fixed grid. Two forms of disorder are introduced:</p><ul><li><strong>Positional jitter (σ):</strong> each lattice point is randomly displaced from its ideal location. This models effects such as thermal motion or strain, where atoms remain present but are no longer perfectly ordered.</li><li><strong>Vacancy (v):</strong> each lattice point is randomly removed with a given probability. This represents defects such as missing atoms.</li></ul><p>These two mechanisms affect the lattice in fundamentally different ways: jitter perturbs positions while preserving occupancy, whereas vacancy alters the structure by removing points entirely.</p><p>For each generated lattice, we compute the corresponding diffraction pattern by taking the 2D Fourier transform and using its magnitude (intensity). This mirrors the structure of real diffraction measurements, where phase information is not directly observed and only intensity patterns are available.</p><p>By systematically varying σ and v across a range of values, we generate a dataset of diffraction images corresponding to different disorder configurations. This dataset forms the basis for the learning problem.</p><p>We consider two formulations:</p><ul><li><strong>Regression:</strong> predict the exact values of σ and v from the diffraction pattern.</li><li><strong>Classification:</strong> assign each sample to a coarse disorder regime based on discretized levels of σ and v, including a joint formulation where both parameters are classified simultaneously.</li></ul><p>This setup allows us to test not only how well models can recover disorder parameters, but more importantly, whether the underlying mapping from diffraction to structure is sufficiently informative to distinguish different types of disorder.</p><p>Before applying any models, it is useful to understand how different types of disorder affect the diffraction pattern.</p><p>We begin by varying each parameter independently. In the first case, only positional jitter (σ) is increased while keeping vacancy fixed at zero. In the second case, only vacancy (v) is increased while keeping jitter fixed at zero.</p><p>These two forms of disorder produce distinct visual signatures:</p><ul><li><strong>Increasing jitter (σ):</strong><br> The diffraction peaks gradually broaden and lose sharpness. The overall structure of the pattern is preserved, but fine details become smeared as positional uncertainty increases.</li><li><strong>Increasing vacancy (v):</strong><br> The diffraction peaks weaken and become less structured. Rather than broadening, the pattern loses intensity and contrast as lattice points are removed.</li></ul><p>These effects reflect the underlying physics: jitter introduces uncertainty in position, while vacancy reduces the number of coherent contributors to the diffraction signal.</p><p>However, when both σ and v are present simultaneously, their effects begin to overlap. Peak broadening and intensity reduction can combine in ways that make different configurations appear visually similar.</p><p>The following figures illustrate these trends, showing diffraction patterns across increasing levels of jitter and vacancy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*G9IYc-kxlP_ax6sYdgx4Pw.png" /><figcaption><strong>Diffraction patterns under increasing positional jitter (top) and vacancy (bottom). Jitter broadens peaks, while vacancy reduces intensity, but both effects can lead to visually similar patterns at higher disorder levels.</strong></figcaption></figure><h3>Regression Attempts: Random Forest and CNN</h3><p>Having established how different types of disorder affect diffraction patterns, we now attempt to recover the underlying parameters directly using regression models.</p><p>The task is to predict the continuous values of positional jitter (σ) and vacancy (v) from the diffraction images.</p><p>We begin with a <strong>Random Forest (RF)</strong> model applied to flattened diffraction patterns. This provides a simple baseline to test whether the mapping from diffraction to disorder is learnable using standard machine learning methods.</p><p>The results show that:</p><ul><li><strong>σ (jitter) is recovered reasonably well</strong>, with predictions closely tracking the true values across the full range.</li><li><strong>v (vacancy) is harder to estimate</strong>, with noticeable bias:</li><li>lower vacancy levels tend to be <strong>overestimated</strong></li><li>higher vacancy levels tend to be <strong>underestimated</strong></li></ul><p>This suggests that while jitter leaves a consistent and separable signature in the diffraction pattern, vacancy introduces effects that are less uniquely identifiable, especially at higher disorder levels.</p><p>To better capture spatial structure in the diffraction images, we next train a <strong>Convolutional Neural Network (CNN)</strong>. Unlike RF, the CNN operates directly on the 2D image, allowing it to learn spatial features such as peak shapes and distributions.</p><p>The CNN improves overall performance:</p><ul><li>Predictions for both σ and v are more tightly clustered around the true values</li><li>The systematic bias in vacancy estimation is reduced, though not eliminated</li></ul><p>Despite this improvement, a key observation remains:</p><blockquote><strong><em>Even with a more expressive model, the mapping from diffraction to disorder is not perfectly recoverable.</em></strong></blockquote><p>There is still overlap in predicted values, particularly for vacancy, indicating that some configurations of jitter and vacancy produce indistinguishable diffraction patterns.</p><p>The following figures show the regression performance for both models.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IFS4ZkhAaShhjdcFrxvK4w.png" /><figcaption><strong>Random Forest regression performance for predicting positional jitter (σ) and vacancy (v) from diffraction patterns. Jitter is recovered with reasonable accuracy, while vacancy shows systematic bias — lower values are overestimated and higher values are underestimated — indicating weaker identifiability from the diffraction signal.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fGiOgAuCghg3kWESaM2qGQ.png" /><figcaption><strong>CNN regression performance for predicting positional jitter (σ) and vacancy (v). The CNN improves overall accuracy and reduces bias compared to the Random Forest, particularly for vacancy, but noticeable overlap remains, suggesting intrinsic ambiguity in the inverse mapping.</strong></figcaption></figure><h3>Classification Formulation</h3><p>The regression results suggest that while approximate recovery is possible, precise estimation of disorder parameters — particularly vacancy — remains challenging. This raises a natural question: rather than predicting exact values, can we reliably distinguish between broader regimes of disorder?</p><p>To explore this, we reformulate the problem as a <strong>classification task</strong>.</p><p>We discretize both parameters into three levels:</p><p><strong>Positional jitter (σ):</strong></p><ul><li>Low</li><li>Medium</li><li>High</li></ul><p><strong>Vacancy (v):</strong></p><ul><li>Low (no vacancy)</li><li>Medium</li><li>High</li></ul><p>Each sample is assigned a <strong>joint class label </strong>based on the combination of σ and v levels. The resulting classes (0–8) correspond to:</p><ul><li><strong>0–2:</strong> low vacancy, increasing σ (low → high)</li><li><strong>3–5:</strong> medium vacancy, increasing σ</li><li><strong>6–8:</strong> high vacancy, increasing σ</li></ul><p>We train both a Random Forest and a CNN on this classification task. Compared to regression, classification reduces sensitivity to small numerical differences and focuses instead on whether distinct regimes are separable in the diffraction space.</p><p>This formulation provides a clearer test of the underlying question:</p><blockquote><strong><em>Are different disorder mechanisms distinguishable at all, even at a coarse level?</em></strong></blockquote><p>The results, shown in the confusion matrices below, reveal how well each model can separate these joint disorder states and where ambiguity persists.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*88fe7AlA3gBnoFzIXGsruw.png" /><figcaption><strong>Random Forest joint classification confusion matrix for combined jitter (σ) and vacancy (v) levels. While low-disorder states are well identified, increasing disorder leads to confusion between neighboring classes, particularly along the vacancy dimension, indicating limited separability in the diffraction representation.</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9ta6C85tKGIi-_EJAAc9jw.png" /><figcaption><strong>CNN joint classification confusion matrix for combined jitter (σ) and vacancy (v) levels. The CNN improves class separation compared to the Random Forest, with stronger diagonal dominance, but residual confusion remains between adjacent vacancy levels, reflecting inherent ambiguity in the inverse mapping.</strong></figcaption></figure><h3>Results and Interpretation</h3><p>The confusion matrices provide a clearer picture of what aspects of disorder are recoverable from diffraction data.</p><p>A first observation is that <strong>positional jitter (σ) is consistently well separated across all regimes (with only minor confusion between adjacent levels)</strong>. In both the Random Forest and CNN models, predictions for σ tend to remain within the correct group of classes, with only minor confusion between adjacent levels. This suggests that jitter leaves a distinct and robust signature in the diffraction pattern, even as overall disorder increases.</p><p>In contrast, <strong>vacancy (v) is significantly harder to distinguish</strong>. Most of the misclassifications occur between classes that differ primarily in vacancy level while having similar σ. This is visible in the confusion matrices as mixing within blocks of classes corresponding to the same σ but different vacancy levels. In other words, the model often identifies the correct level of positional disorder but struggles to determine how many lattice points are missing.</p><p>Comparing the two models:</p><ul><li>The <strong>Random Forest</strong> shows substantial confusion across neighboring classes, particularly at medium and high vacancy levels.</li><li>The <strong>CNN</strong> improves separation, with stronger concentration along the diagonal, indicating better overall classification performance.</li></ul><p>However, even with the CNN, <strong>confusion between adjacent vacancy levels persists</strong>. This is especially evident at higher disorder, where the diffraction patterns become increasingly similar despite differences in the underlying structure.</p><p>These results point to an important conclusion:</p><blockquote><strong><em>The difficulty is not simply a limitation of the model, but a property of the inverse problem itself.</em></strong></blockquote><p>While positional jitter produces clear and separable changes in peak structure, vacancy alters the diffraction pattern in a way that is less uniquely identifiable. As a result, different combinations of σ and v can produce similar measurements, leading to unavoidable ambiguity.</p><p>In this sense, diffraction provides a strong signal for certain types of disorder, but only a partial and sometimes ambiguous view of others.</p><h3>Discussion and Conclusion</h3><p>This study set out to examine a simple but fundamental question: how much of structural disorder can be recovered from diffraction data?</p><p>By constructing a controlled setting with two distinct forms of disorder — positional jitter and vacancy — we were able to probe the limits of this inverse problem using both regression and classification approaches.</p><p>The results show a clear asymmetry:</p><ul><li><strong>Positional disorder (σ)</strong> is reliably recoverable across all regimes. Its effect on diffraction — primarily peak broadening — produces a strong and separable signal.</li><li><strong>Vacancy (v)</strong> is only partially recoverable. While coarse distinctions are possible, especially at low disorder, the signal becomes increasingly ambiguous as disorder increases.</li></ul><p>Importantly, these limitations persist even when using more expressive models such as CNNs. While CNNs improve performance by leveraging spatial structure in the diffraction patterns, they do not eliminate the underlying ambiguity.</p><p>This suggests that the challenge is not solely algorithmic. Instead, it reflects a more fundamental property of the inverse mapping from diffraction to structure:</p><blockquote><strong><em>Different configurations of disorder can produce similar diffraction patterns, making parts of the reconstruction problem inherently non-unique.</em></strong></blockquote><p>In practical terms, this has implications for how diffraction data is interpreted. While certain aspects of structure can be inferred with confidence, others — particularly those related to defects and missing elements — may require additional information or complementary measurements.</p><p>More broadly, this study highlights an important principle:</p><blockquote><strong><em>In inverse problems, improving the model does not always resolve ambiguity if the information is not present in the data.</em></strong></blockquote><p>Understanding these limits is as important as improving predictive performance, especially in settings where measurements are indirect and information may be fundamentally incomplete.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1285dfb4cf75" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why AI Can’t See: A Physics Perspective on an Inverse Problem]]></title>
            <link>https://medium.com/@subhabrata.ganguli/why-ai-cant-see-a-physics-perspective-on-an-inverse-problem-3aaa4dacb8ba?source=rss-493fda7dd5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/3aaa4dacb8ba</guid>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[physics]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[machine-learning]]></category>
            <dc:creator><![CDATA[Suvo Ganguli]]></dc:creator>
            <pubDate>Thu, 16 Apr 2026 23:00:22 GMT</pubDate>
            <atom:updated>2026-04-16T23:00:22.125Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>How symmetry and sensitivity shape what a model can — and cannot — learn</em></strong></p><h3>The Setup</h3><p>I set out to build a simple inverse model.</p><p>Given electromagnetic measurements from a circular antenna array, could a neural network learn to locate a small tumor inside a 2D domain?</p><p>The setup was intentionally minimal. I used a Maxwell-based simulation to generate multistatic measurements from a ring of antennas surrounding a square region. Inside this region, I placed a small circular inclusion representing a tumor, with a higher permittivity and conductivity than the background medium.</p><p>Each simulation produced a compact measurement tensor capturing how waves scattered from the tumor and were received at the antenna array. Using this data, I trained a neural network to predict the tumor’s position (x,y).</p><p>At this stage, the problem felt straightforward: learn a mapping from measurements back to location.</p><p>And at first, it seemed to work.</p><h3>The First Success (and a Subtle Pattern)</h3><p>With the setup in place, I trained a simple convolutional neural network to predict the tumor location (x,y) from the simulated measurements.</p><p>The training behavior looked encouraging. The loss decreased smoothly, and validation performance tracked training reasonably well. On the surface, the model appeared to be learning the mapping from measurements to location.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/822/1*Spks-eoD5bd-Xk8ZzAnl1g.png" /><figcaption><strong>XY training and validation loss</strong></figcaption></figure><p>From a standard machine learning perspective, everything looked reasonable. The model appeared to have converged, and there were no immediate signs of instability or mismatch between training and validation performance.</p><p>To better understand what it had learned, I plotted the predicted locations against the true ones using a simple vector field: each arrow starts at the true tumor location and points toward the model’s prediction.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/928/1*2wxbP-7OH6aTl9Mh9rdRRg.png" /><figcaption><strong>XY localization — error vectors (true → predicted)</strong></figcaption></figure><p>At first glance, the results looked reasonable. For most points, the predicted locations were close to the true ones, with relatively small errors.</p><p>But there was a pattern.</p><p>The arrows were not entirely random. Many of them showed a slight tendency to point inward, toward the center of the domain.</p><p>It was subtle — easy to dismiss as noise or a minor modeling imperfection. The model was still performing well overall, and the errors were small in magnitude.</p><p>So I moved on.</p><h3>When One More Variable Changes Everything</h3><p>The slight inward bias in the (x,y)(x, y)(x,y) predictions was easy to overlook. The model was performing well overall, and the errors were small.</p><p>So I extended the problem in a natural way.</p><p>Instead of predicting only the tumor location, I asked the model to also estimate its radius. The new target became (x,y,r), while the input measurements remained the same.</p><p>From a modeling perspective, this was a modest change. The data generation process was identical, and the neural network architecture required only a small modification to output an additional parameter.</p><p>The training behavior still looked reasonable. The loss decreased smoothly, and the model appeared to converge without instability.</p><p>But the predictions told a very different story.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*h3ICyi6Z7TOQJWIn1PyqVw.png" /><figcaption><strong>XYR localization — error vectors (true → predicted)</strong></figcaption></figure><p>The inward bias that was barely noticeable in the (x,y)(x, y)(x,y) case became much more pronounced.</p><p>Instead of small deviations, many predictions were now pulled strongly toward the center of the domain. The structure in the errors was no longer subtle — it dominated the behavior of the model.</p><p>This was not a simple degradation in accuracy. It was a qualitative change.</p><p>Adding a single additional parameter had transformed a mildly biased solution into one that consistently collapsed inward.</p><p>At this point, it was no longer clear whether the issue lay in the model, the data, or something more fundamental about the problem itself.</p><h3>Trying to Fix It</h3><p>At this point, the most natural assumption was that the issue lay in the model.</p><p>So I tried a few standard fixes.</p><p>I increased the dataset size, generating more training samples across the domain. I adjusted the network architecture and experimented with different configurations. I also explored variations in the loss function, including placing more weight on the spatial coordinates.</p><p>None of these changes made a meaningful difference.</p><p>The inward collapse persisted.</p><p>The model continued to train smoothly. The loss curves looked well-behaved. But the structure in the predictions remained — especially in the (x,y,r) case.</p><p>This was the moment where the usual debugging approach stopped being helpful.</p><p>The model was not unstable. The data pipeline was consistent. And yet, the behavior did not improve.</p><p>So I stepped back and asked a different question:</p><p>What if the problem wasn’t the model at all?</p><h3>Is the Problem Itself Ambiguous?</h3><p>Up to this point, I had been treating the problem as a standard learning task: given enough data and a reasonable model, the mapping from measurements to tumor parameters should be learnable.</p><p>But the persistent inward bias suggested something deeper.</p><p>Instead of asking whether the model was learning correctly, I started asking a more fundamental question:</p><p>What information do the measurements actually contain?</p><p>Formally, the simulation defines a forward mapping:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/770/1*XHmTEUJdFx5sdlYAcdoASw.png" /></figure><p>where (x,y) is the tumor location and MMM represents the multistatic measurements.</p><p>If this mapping is locally sensitive, then small changes in position should produce noticeable changes in the measurements. In that case, recovering (x,y) from M is, at least in principle, feasible.</p><p>But if the mapping becomes locally flat, then different positions can produce nearly indistinguishable measurements.</p><p>To test this, I computed a simple numerical approximation of the local sensitivity of the measurements with respect to position. For a set of points along horizontal and vertical cross-sections through the domain, I estimated:</p><ul><li>how much the measurements change with small perturbations in x and y</li><li>the smallest singular value of the local Jacobian</li></ul><p>The results were striking.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*k1XB0GjjlNauiaegCj7YNg.png" /><figcaption><strong>Sensitivity along cross-sections through the domain center</strong></figcaption></figure><p>Near the center of the domain, both ∥∂M/∂x∥ and ∥∂M/∂y∥ drop to nearly zero. At the same time, the smallest singular value of the local Jacobian also collapses.</p><p>In practical terms, this means that small movements of the tumor near the center produce almost no change in the measurements.</p><p>The system, in that region, cannot “see” position.</p><p>Away from the center, sensitivity increases smoothly, and the measurements become more informative. But at the center, the mapping is effectively flat.</p><p>This reveals something fundamental:</p><blockquote><strong><em>The inverse problem is not uniformly well-posed across the domain. There is a low-information region near the center where positional changes are intrinsically difficult to distinguish.</em></strong></blockquote><h3>What the Model Was Really Doing</h3><p>The behavior of the model now makes sense.</p><p>In the (x,y) case, the network was learning from a system that is locally insensitive near the center. The slight inward bias was not a failure of training — it was a reflection of the underlying physics. In regions where the measurements carry little positional information, predictions naturally drift toward a stable point.</p><p>When the radius was added as an additional unknown, the problem became more ambiguous. The model could now trade off between location and size, finding multiple parameter combinations that produced similar measurements. In a system that is already insensitive near the center, this added flexibility amplified the bias, leading to a much stronger inward collapse.</p><p>What initially looked like a modeling issue turned out to be a property of the forward problem itself.</p><p>The model was not inventing structure. It was responding to it.</p><p>This small experiment highlights a broader point about inverse problems and machine learning. Performance is not determined solely by model architecture or data volume. It is fundamentally constrained by how much information the measurements contain about the quantities we are trying to recover.</p><p>In this case, symmetry in the sensing geometry creates a region where that information nearly disappears.</p><p>The model did not fail to learn.</p><p>It learned exactly what the system allowed it to learn.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3aaa4dacb8ba" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Feature Engineering vs Model Complexity: How Far Can Linear Regression Go with Better Features?]]></title>
            <link>https://medium.com/@subhabrata.ganguli/feature-engineering-vs-model-complexity-how-far-can-linear-regression-go-with-better-features-811849d5d4e3?source=rss-493fda7dd5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/811849d5d4e3</guid>
            <category><![CDATA[time-series-forecasting]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[feature-engineering]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[linear-regression]]></category>
            <dc:creator><![CDATA[Suvo Ganguli]]></dc:creator>
            <pubDate>Thu, 16 Apr 2026 15:12:39 GMT</pubDate>
            <atom:updated>2026-04-16T15:12:39.657Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>A simple experiment with temperature, quadratic features, and the limits of linear models</strong></p><h3>Problem Setup</h3><p>The objective is to predict next-day electricity demand using a regression model. As a baseline, lagged demand features (previous days’ load) are used, capturing the strong temporal structure present in energy consumption.</p><p>Temperature is then introduced as an additional feature. This is a natural choice: electricity demand tends to increase when temperatures are far from moderate levels, due to heating and cooling requirements.</p><p>Before evaluating model performance, it is useful to examine how demand and temperature relate to each other in the data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KZi2OSRAG9C9y9vuIf63iA.png" /><figcaption><strong>Energy Demand and Temperature Over Time</strong></figcaption></figure><p>The seasonal pattern is evident. Demand increases during both winter and summer periods, when temperatures move away from moderate ranges.</p><p>However, this view shows co-movement over time, not the functional relationship between temperature and demand.</p><p>To understand that relationship, we examine the data in feature space rather than time.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*N9gRV5-O8cAbTXiTMZF_8Q.png" /><figcaption><strong>Next-Day Load vs Temperature</strong></figcaption></figure><p>The relationship is clearly nonlinear. Demand is lower at moderate temperatures and increases toward both colder and hotter extremes, forming a U-shaped pattern.</p><p>Importantly, the two sides of the curve are not symmetric. The rate at which demand increases differs between cold and hot conditions, indicating that a single global functional form may be insufficient to capture the full structure of the relationship.</p><p>To understand the effect of temperature and model choice, three models were evaluated: a <strong>linear regression model</strong>, a <strong>random forest</strong>, and a <strong>gradient boosting</strong> model. Each model was tested both with and without temperature as an input feature.</p><p>This allows us to separate two effects: the value of adding temperature as information, and the ability of different models to utilize that information.</p><p>With this structure in mind, we now turn to model performance.</p><h3>Initial Results</h3><p>With temperature added as a feature, the expectation was that the linear model would show a noticeable improvement in prediction accuracy.</p><p>However, the observed improvement was limited.</p><p>The comparison below summarizes model performance using Mean Absolute Percentage Error (MAPE).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/568/1*06Crt2PTBZHh_c5uRkZrIQ.png" /><figcaption><strong>Model performance comparison using Mean Absolute Percentage Error (MAPE)</strong></figcaption></figure><p>Three observations stand out:</p><p>• Adding temperature to the linear model resulted in almost no improvement. <br>• Nonlinear models showed a clear reduction in error when temperature was included. <br>• This indicates that temperature contains useful signal, but the linear model is unable to fully utilize it.</p><p>At this stage, the issue does not appear to be a lack of information. Instead, it suggests a limitation in how the relationship between temperature and demand is represented within the linear model.</p><h3>Capturing Nonlinearity with a Quadratic Feature</h3><p>The scatter plot suggests a clear U-shaped relationship between temperature and demand. If that structure is real, then using temperature as a simple linear feature is unlikely to be sufficient.</p><p>A natural next step is to modify how temperature is represented. Instead of using temperature alone, an additional feature is created by squaring it. This allows the linear model to approximate a curved relationship while still remaining simple in form.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/1*FzXNQ9pu6U0H0_grnWbWTw.png" /><figcaption><strong>Linear Model Performance with Enhanced Temperature Features (MAPE %)</strong></figcaption></figure><p>With this change, the model improves noticeably. The quadratic term captures the dominant U-shaped behavior observed in the data, leading to a meaningful reduction in prediction error.</p><p>This confirms that the earlier limitation was not due to missing information, but due to how that information was expressed in the model.</p><p>At the same time, the improvement is only partial. Even after introducing the quadratic term, the linear model still does not match the performance of the nonlinear models.</p><p>This points to a deeper issue. The relationship between temperature and demand is not only nonlinear, but also asymmetric and influenced by other factors. A single global transformation — even one that captures curvature — is not enough to fully represent that structure.</p><h3>The Limit of Feature Engineering</h3><p>Adding the quadratic temperature feature significantly improved the linear model, but a gap remained. Even after capturing the dominant curvature in the data, the model still fell short of the performance achieved by the nonlinear models.</p><p>The earlier scatter plot provides a clue as to why. While the overall shape is U-like, the two sides of the curve are not symmetric. The increase in demand under cold conditions does not mirror the increase under hot conditions. In addition, the spread of the data varies across temperature ranges, suggesting that other factors interact with temperature in different ways.</p><p>These characteristics are difficult to capture using a single global transformation. Linear models, even with feature engineering, assume that the relationship can be expressed as a combination of fixed effects applied uniformly across the entire dataset.</p><p>In contrast, tree-based models implicitly adapt to different regions of the feature space. They can represent different behaviors under cold and hot conditions, and capture interactions between temperature, lagged demand, and time-based features without requiring explicit specification.</p><p>The result is a consistent pattern: improving feature representation can significantly reduce error, but only up to a point. Beyond that, the structure of the system itself requires models that can adapt locally rather than rely on a single global form.</p><p>This leads to a broader takeaway. Feature engineering and model complexity are not substitutes, but complements. Better features can push simple models further, but when the underlying relationships are asymmetric and context-dependent, more flexible models become necessary.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=811849d5d4e3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When Simple Physics Beats Complexity: A Minimal Model for Flood Risk]]></title>
            <link>https://medium.com/@subhabrata.ganguli/when-simple-physics-beats-complexity-a-minimal-model-for-flood-risk-c4ea3c6cc36b?source=rss-493fda7dd5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/c4ea3c6cc36b</guid>
            <category><![CDATA[urban-planning]]></category>
            <category><![CDATA[geospatial]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[climate-change]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Suvo Ganguli]]></dc:creator>
            <pubDate>Tue, 14 Apr 2026 16:56:23 GMT</pubDate>
            <atom:updated>2026-04-14T16:56:23.902Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>Even a model built only on elevation and rainfall can meaningfully capture flood risk in real-world data — when framed the right way</em></strong></p><h3>Introduction</h3><p>Flood prediction sounds complex.</p><p>It involves climate models, hydrology, infrastructure, and uncertainty — layers of interacting systems that are difficult to model and even harder to validate.</p><p>But there is a simpler question we can ask.</p><p>What if flood risk, at a regional scale, is largely driven by just two things:</p><ul><li>where water tends to accumulate</li><li>and how much rain has recently fallen</li></ul><p>This raises a natural hypothesis:</p><blockquote><strong><em>Even a minimal model — built only on elevation and rainfall — can meaningfully capture flood risk in real-world data.</em></strong></blockquote><p>In this article, we explore that idea using real data from Houston. Instead of building a complex hydrological model, we take a different approach: we define a simple, physically grounded proxy for flood-prone conditions, validate it against observed events, and test whether it can be predicted.</p><p>The result is not a perfect model — but it is a surprisingly effective one.</p><h3>The Problem with Real Flood Labels</h3><p>At first glance, flood prediction seems like a standard supervised learning problem.</p><p>We have historical flood events, we have environmental data, and we can try to learn a mapping between the two.</p><p>In practice, this breaks down quickly.</p><p>Flood events are recorded as individual points — often with uncertainty in both timing and location. More importantly, they are <strong>extremely sparse</strong> when viewed at a daily resolution.</p><p>In our dataset, after mapping events onto a 5 km grid and constructing a rolling 7-day indicator, the fraction of grid–day combinations containing a flood event is approximately:</p><blockquote><strong><em>0.0007</em></strong></blockquote><p>This means that <strong>less than 0.1% of observations contain a positive label</strong>.</p><h4>Why this is a problem</h4><p>A model trained directly on these labels would face two issues:</p><ol><li><strong>Severe class imbalance</strong><br> Predicting “no flood” everywhere would already achieve near-perfect accuracy.</li><li><strong>Weak learning signal</strong><br> With so few positive examples, it becomes difficult for the model to learn meaningful relationships.</li></ol><h4>A deeper issue: what are we really predicting?</h4><p>There is also a conceptual mismatch.</p><p>A recorded flood event is not just a function of rainfall and terrain. It depends on:</p><ul><li>drainage infrastructure</li><li>local reporting practices</li><li>population density</li><li>and even chance</li></ul><p>In other words:</p><blockquote><em>A flood </em>event<em> is not a clean label for flood </em>risk<em>.</em></blockquote><h4>Reframing the problem</h4><p>Instead of predicting rare and noisy events directly, we shift the focus:</p><blockquote><strong><em>Can we predict the conditions under which flooding is likely to occur?</em></strong></blockquote><p>This leads to a more structured and learnable problem — one that aligns more closely with the underlying physics.</p><h3>A Simple Proxy for Flood-Prone Conditions</h3><p>If direct flood labels are too sparse and noisy, we need a different way to define the problem.</p><p>Instead of predicting flood events, we define a proxy for <strong>flood-prone conditions</strong> — states where flooding is physically likely to occur.</p><p>At a coarse spatial scale, two factors dominate:</p><ul><li><strong>Terrain</strong>: low-lying areas where water accumulates</li><li><strong>Rainfall</strong>: recent precipitation that can trigger flooding</li></ul><h4>Step 1: Identifying susceptible regions</h4><p>We begin by dividing Houston into a 5 km × 5 km grid, as shown below.</p><p>This provides a consistent spatial framework for analysis while smoothing out the noise in point-level event data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l1AtkGsW9nO2csUXuRaM1w.png" /><figcaption><strong>Houston divided into a 5 km grid overlaid on OpenStreetMap data</strong></figcaption></figure><p>Next, we identify <strong>structurally susceptible regions</strong> based on elevation.</p><p>Low-elevation cells are more likely to accumulate water and are therefore more prone to flooding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dPsdfcpt_pen4Y34xF2pGg.png" /><figcaption><strong>Low-elevation regions identified as structurally susceptible to flooding</strong></figcaption></figure><h4>Step 2: Defining the trigger condition</h4><p>Flooding is not just about where — it is also about when.</p><p>We define a <strong>rainfall trigger</strong> using recent precipitation (e.g., 3-day accumulation), capturing short-term weather conditions that can lead to flooding.</p><h4>Step 3: Combining structure and trigger</h4><p>We define the proxy label as:</p><blockquote><em>A grid cell is flood-prone if it is both </em><strong><em>low-lying</em></strong><em> and experiencing </em><strong><em>high recent rainfall</em></strong><em>.</em></blockquote><p>This results in a label that is still relatively rare, but far more informative than raw flood events:</p><ul><li>Susceptible cells: ~19%</li><li>High rainfall conditions: ~10%</li><li>Combined proxy: ~2.1%</li></ul><h4>Why this works</h4><p>This proxy is intentionally simple. It does not attempt to model drainage systems, soil absorption, or infrastructure.</p><p>Instead, it captures the most fundamental drivers of flooding:</p><blockquote><em>where water collects, and when enough rain falls.</em></blockquote><p>By doing so, it transforms a sparse and noisy prediction problem into one that is structured, interpretable, and learnable.</p><h3>Do These Simple Assumptions Match Reality?</h3><p>Before building any model, we need to answer a basic question:</p><blockquote><em>Do these simple assumptions — low elevation and rainfall — actually align with real flood observations?</em></blockquote><h4>What the raw data looks like</h4><p>We begin by plotting recorded flood events across Houston.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kfZ9I3zLQPp2imYMqZMkXQ.png" /><figcaption><strong>Reported flood events across Houston (raw points)</strong></figcaption></figure><p>At first glance, the pattern is not obvious.</p><p>Flood events appear scattered across the city, with no clear structure. Some clusters exist, but overall the distribution looks noisy and irregular.</p><p>This is exactly the challenge we identified earlier:</p><blockquote><em>At the point level, flood data does not reveal a clear spatial signal.</em></blockquote><h4>Looking at the data through a regional lens</h4><p>Instead of focusing on individual points, we aggregate events at the same 5 km grid resolution used for the proxy.</p><p>This allows us to compare two groups:</p><ul><li><strong>Susceptible regions</strong> (low elevation)</li><li><strong>Non-susceptible regions</strong></li></ul><p>We then compute the average number of flood events per grid cell in each group.</p><h4>A simple but important result</h4><p>The difference is clear:</p><ul><li>High-risk (low elevation) cells: <strong>0.5 events per cell</strong></li><li>Low-risk cells: <strong>0.30 events per cell</strong></li></ul><p>This corresponds to a:</p><blockquote><strong><em>1.66× higher event rate in susceptible regions</em></strong></blockquote><h4>Why this matters</h4><p>This result is simple — but important.</p><p>Even though flood events appear scattered at the point level, they are <strong>not random</strong>. When viewed at a regional scale, they show a clear statistical relationship with terrain.</p><blockquote><em>What appears random at the point level becomes structured when aggregated.</em></blockquote><h4>What this does — and does not — prove</h4><p>This validation does not mean that elevation alone explains flooding.</p><p>Flood events are influenced by many factors, including infrastructure, drainage, and reporting bias.</p><p>However, it does show that:</p><blockquote><em>A simple terrain-based proxy captures a meaningful part of the real-world signal.</em></blockquote><h4>Transition to modeling</h4><p>With this validation in place, we can now ask a stronger question:</p><blockquote><em>If these conditions align with observed flood patterns, can we predict them?</em></blockquote><h3>Predicting Flood-Prone Conditions</h3><p>With a structured proxy in place, we can now move from analysis to prediction.</p><p>The goal is not to predict flood events directly, but to predict whether a location will enter a <strong>flood-prone state on the next day</strong>.</p><h3>Modeling setup</h3><p>For each grid cell and day, we use:</p><ul><li>elevation (static)</li><li>daily rainfall</li><li>short-term rainfall accumulation (3-day, 7-day)</li></ul><p>to predict:</p><blockquote><em>whether that cell will be flood-prone on the following day.</em></blockquote><p>This framing avoids a key pitfall:<br> we are no longer predicting a label using the same inputs that define it at the same time. Instead, we are asking:</p><blockquote>Given today’s conditions, can we anticipate tomorrow’s risk?</blockquote><h4>Model choice</h4><p>We use a simple <strong>Random Forest classifier</strong>.</p><p>The goal is not to optimize performance, but to test whether the signal is strong enough to be learned from minimal inputs.</p><h4>Results</h4><p>The model performs well, even under this simple setup:</p><ul><li><strong>Recall (flood-prone class): ~0.96</strong></li><li><strong>Precision: ~0.49</strong></li><li><strong>ROC AUC: ~0.996</strong></li></ul><h4>Interpreting the results</h4><p>The model is highly effective at identifying flood-prone conditions:</p><ul><li>It captures nearly all high-risk cases (high recall)</li><li>It produces some false positives (lower precision)</li></ul><p>This behavior is expected.</p><blockquote><em>Missing a flood-prone condition is more costly than issuing a false alarm.</em></blockquote><h4>What drives the predictions?</h4><p>The feature importance tells a clear story.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8djRBdla5EancdSQVkpcGw.png" /><figcaption><strong>Feature importance for next-day flood-prone prediction</strong></figcaption></figure><p>Elevation is the dominant factor, followed by short-term rainfall accumulation.</p><p>This aligns directly with the original hypothesis:</p><blockquote><em>Flood risk emerges from the interaction between terrain and recent rainfall.</em></blockquote><h4>What the model is actually learning</h4><p>The model is not discovering new physics.</p><p>Instead, it is learning a smooth, probabilistic version of a simple rule:</p><blockquote><em>Low-lying areas combined with sustained rainfall lead to elevated flood risk.</em></blockquote><h4>Why this is still meaningful</h4><p>The simplicity is the point.</p><p>Despite using only a few interpretable features, the model:</p><ul><li>generalizes across space and time</li><li>captures meaningful structure</li><li>aligns with observed flood patterns</li></ul><h3>Conclusion</h3><p>At first glance, the result may seem obvious.</p><p>Flood risk depends on where water collects and how much rain has fallen. Low-lying regions combined with sustained rainfall create the conditions for flooding.</p><p>This is not new.</p><h4>What this work shows</h4><p>The contribution here is not a new physical insight, but a practical one:</p><blockquote><em>Even a minimal, physically grounded model can capture meaningful flood risk patterns in real-world data.</em></blockquote><p>By:</p><ul><li>reframing the problem from rare events to underlying conditions</li><li>aggregating data at an appropriate spatial scale</li><li>and validating against observed outcomes</li></ul><p>we transform a sparse, noisy prediction task into a structured and learnable one.</p><h4>Why this matters</h4><p>In many real-world problems, the limiting factor is not model complexity — it is <strong>problem formulation</strong>.</p><ul><li>Raw labels are often incomplete or unreliable</li><li>Direct prediction may not be feasible</li><li>The signal must be constructed, not just learned</li></ul><p>This is especially true in environmental and geospatial settings, where data is heterogeneous and uncertain.</p><h4>A simple takeaway</h4><blockquote><em>The physics may be simple.<br> The challenge is making it work with real data.</em></blockquote><h4>Limitations and next steps</h4><p>This model operates at a coarse spatial scale and does not account for:</p><ul><li>urban infrastructure and drainage</li><li>land use and impervious surfaces</li><li>localized hydrological effects</li></ul><p>These factors would be necessary for fine-grained flood prediction.</p><p>However, the current approach provides a strong baseline — one that can be extended incrementally while remaining interpretable.</p><h4>Closing thought</h4><p>What appears complex at first often becomes clearer when viewed at the right level of abstraction.</p><p>In this case:</p><blockquote><em>Flood events appear scattered and unpredictable at the point level, but reveal clear structure when viewed through a simple, regional lens.</em></blockquote><p><em>I’m Suvo Ganguli. I spent 20 years building control systems for aerospace and automotive systems, and now focus on applying AI to real-world problems through my nonprofit, AI for Humanity Tech.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c4ea3c6cc36b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What Actually Makes an Outbreak Predictable? A Machine Learning Study of Flu vs Dengue]]></title>
            <link>https://medium.com/@subhabrata.ganguli/what-actually-makes-an-outbreak-predictable-a-machine-learning-study-of-flu-vs-dengue-500fc0cec4f4?source=rss-493fda7dd5ac------2</link>
            <guid isPermaLink="false">https://medium.com/p/500fc0cec4f4</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[time-series-analysis]]></category>
            <category><![CDATA[healthcare]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Suvo Ganguli]]></dc:creator>
            <pubDate>Sun, 12 Apr 2026 16:23:36 GMT</pubDate>
            <atom:updated>2026-04-14T16:59:21.083Z</atom:updated>
            <content:encoded><![CDATA[<p><strong><em>I applied the same forecasting pipeline to influenza in Illinois and dengue in Singapore — and found that predictability depends less on models or features, and more on how outbreaks unfold over time.</em></strong></p><h3>The Question</h3><p>Most work in disease forecasting focuses on improving models — better features, more data, more complex architectures. But there is a more basic question underneath all of that:</p><p><strong>How predictable is the system itself?</strong></p><p>Instead of asking which model performs best, I wanted to understand what controls how far ahead an outbreak can be predicted. If two diseases behave very differently over time, would that difference show up even when the modeling pipeline is kept simple and identical?</p><p>To explore that, I built a deliberately minimal weekly forecasting setup and applied it to two diseases with very different dynamics: <em>influenza in Illinois</em> and <em>dengue in Singapore</em>. The goal was not to maximize accuracy, but to isolate what aspects of the signal make prediction easier or harder as the forecast horizon increases.</p><p>What emerged was not just a difference in performance, but a difference in <em>why</em> that performance behaves this way.</p><h3>Data and Setup</h3><p>To keep the comparison meaningful, I built both datasets in the same way: weekly disease signal + optional weather features, aligned on a common timeline.</p><p>For <strong>flu</strong>, I used Illinois weekly influenza-like illness (WILI) data from the CDC FluView ecosystem (via Delphi Epidata). WILI represents the percentage of patient visits with flu-like symptoms, giving a long, dense weekly time series across many seasons.</p><p>For <strong>dengue</strong>, I used the Singapore government’s open dataset (data.gov.sg), which provides weekly dengue case counts. After filtering to the main dengue signal, this produced a shorter but clean weekly series with clearly defined outbreak periods.</p><p>For both datasets, I pulled historical weather from Open-Meteo and aggregated daily measurements (temperature, precipitation, wind, radiation) to weekly values. This allowed me to test — separately — whether external features add predictive value.</p><p>The result in each case was a simple table with one row per week:</p><ul><li>Flu: week_start, WILI, (optional weather)</li><li>Dengue: week_start, case count, (optional weather)</li></ul><p>At this stage, the two datasets differ in geography, duration, and scale — but they are structurally comparable. That consistency is important, because everything that follows uses the same modeling logic on top of these weekly signals.</p><p>Before getting into modeling, it is helpful to look at what these signals actually look like. This provides context for the results that follow.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZI6h97v-R7UOfoFPUYgt8g.png" /><figcaption><strong>Flu (Illinois, weekly WILI)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oXE59_1QttLA9BEHirgq4w.png" /><figcaption><strong>Dengue (Singapore, weekly cases)</strong></figcaption></figure><p>Even at a glance, the difference is noticeable. Flu follows a relatively smooth seasonal pattern, with repeated annual waves. Dengue, on the other hand, shows fewer but more pronounced outbreaks, separated by longer periods of lower activity.</p><p>At this point, the question becomes: if we apply the same forecasting pipeline to both signals, will this difference in structure translate into a difference in predictability?</p><h3>Modeling Approach</h3><p>To keep the comparison focused, I used a deliberately simple modeling setup for both diseases.</p><p>Each week was treated as a data point, and the goal was to predict whether an <strong>outbreak</strong> would occur at future horizons:<br> 1 week ahead, 2 weeks ahead, up to 4 weeks ahead.</p><p>The only core features used were <strong>lagged versions of the signal itself</strong>:</p><ul><li>Flu: WILI at previous weeks</li><li>Dengue: case counts at previous weeks</li></ul><p>No deep learning, no heavy feature engineering — just a basic <strong>Random Forest classifier</strong> trained on lagged values. The idea was to let the <strong>structure of the signal</strong> do most of the work, rather than the model.</p><h4><em>Defining an “Outbreak”</em></h4><p>One key step was converting a continuous signal into a binary label: outbreak vs not.</p><p>I defined outbreaks using a percentile threshold:</p><ul><li>Flu: <strong>85th percentile of WILI</strong></li><li>Dengue: <strong>90th percentile of cases</strong></li></ul><p>At first glance, using different thresholds may seem inconsistent. But using the same percentile for both produced unstable labels:</p><ul><li>For flu, a 90th percentile threshold made outbreaks too sparse and fragmented</li><li>For dengue, a lower threshold made almost every elevated period count as an outbreak, leading to trivial predictions (recall ≈ 1)</li></ul><p>So instead of enforcing the same percentile, I chose thresholds that produced <strong>coherent, contiguous outbreak periods</strong> for each disease. This ensured that the classification problem remained meaningful.</p><h4><strong>Testing whether more features help</strong></h4><p>Before comparing the diseases, I also tested a simple extension: adding weather variables (temperature, precipitation, etc.) to the flu model.</p><p>The result was unexpected but clear:</p><p><strong><em>Adding weather slightly reduced performance.</em></strong></p><p>This was useful for two reasons:</p><ol><li>It suggested that <strong>external features were not the main driver of predictability</strong> in this setup</li><li>It reinforced the idea that the signal itself — not added data — might be the key factor</li></ol><p>With that, I kept the final comparison intentionally minimal:</p><p><strong><em>same model, same lag structure, signal-only features</em></strong></p><p>This sets up the next question: when everything else is held constant, how do the two diseases behave?</p><h3>Results: Same Model, Very Different Behavior</h3><p>To evaluate predictability, I trained the same model on both datasets and measured performance at increasing forecast horizons — from 1 week ahead to 4 weeks ahead.</p><p>The task was framed as a binary classification problem: predicting whether an outbreak would occur at a future time step. Performance was evaluated using three standard metrics:</p><ul><li><em>Precision</em>: how many predicted outbreaks were actually correct</li><li><em>Recall</em>: how many actual outbreaks were successfully detected</li><li><em>F1 score</em>: a balanced measure combining precision and recall</li></ul><p>The F1 score is particularly useful here because it penalizes models that perform well on only one of the two dimensions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*wOIi7KvJmRWa58mAF6Hy8g.png" /><figcaption><strong>Prediction horizon comparison (Flu vs Dengue) — F1 score curves</strong></figcaption></figure><p>The difference between the two diseases is immediately visible in the F1 curves.</p><p>For flu, prediction performance declines rapidly as the horizon increases. The model performs reasonably well one week ahead, but accuracy drops steadily as the prediction window extends. By four weeks, the F1 score has fallen significantly.</p><p>Dengue behaves very differently. While there is still some degradation with increasing horizon, the decline is much slower. Even at four weeks ahead, the model retains relatively strong performance.</p><p>This creates a clear contrast:</p><ul><li>Flu shows <strong>fast decay in predictability</strong></li><li>Dengue shows <strong>slow decay in predictability</strong></li></ul><h4>A small but important control</h4><p>Before drawing conclusions, I tested whether adding more information would help.</p><p>For flu, I extended the feature set to include weather variables such as temperature, precipitation, and wind speed. If predictability were limited by missing external signals, this should improve performance.</p><p>Instead, the opposite happened.</p><p>Adding weather features slightly <strong>reduced</strong> the model’s performance across horizons. The additional variables introduced noise rather than useful signal.</p><p>This suggests that the limitation is not due to missing features or model complexity. The model is already capturing what is available in the signal.</p><h4>What does this mean?</h4><p>At this point, a natural conclusion would be that dengue is simply more predictable than flu.</p><p>But that explanation is incomplete.</p><p>Both models used the same structure. Both relied on past values of the signal. Additional features did not help. Yet the behavior is fundamentally different.</p><p>This points to a deeper cause:</p><p><strong><em>The difference in predictability is not coming from the model — it is coming from the structure of the signal itself.</em></strong></p><p>Understanding that structure requires looking beyond model outputs and into how outbreaks actually unfold over time.</p><p>That is what we explore next.</p><h3>Going Deeper: Signal Shape vs Event Structure</h3><p>The results so far raise a natural question: if the model is the same and additional features do not help, what is fundamentally different between these two signals?</p><p>A first instinct is to look at standard statistical properties — variance, skewness, kurtosis, or autocorrelation. These are commonly used to describe time series and might seem like natural candidates to explain why one signal is easier to forecast than another.</p><p>However, when I computed these metrics for both flu and dengue, they turned out to be surprisingly similar. Both signals were right-skewed, both showed strong persistence (high lag-1 autocorrelation), and both had heavy tails. In other words, their <em>global statistical profiles</em> were not dramatically different.</p><p>Yet their predictability behavior was very different.</p><p>This suggests that global statistics are not capturing what matters.</p><h4>Looking at events instead of distributions</h4><p>Instead of summarizing the signals as distributions of values, I shifted the perspective to <strong>events over time</strong>.</p><p>Using the same outbreak definitions as in the modeling step (85th percentile for flu, 90th percentile for dengue), I extracted contiguous outbreak periods and computed a few simple structural metrics:</p><ul><li>number of outbreak peaks</li><li>average duration of each peak (in weeks)</li><li>average distance between peaks</li></ul><p>These metrics describe not just <em>how large</em> values are, but <em>how they are organized in time</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1iAp3v4AFsod5JzOX6ywCw.png" /><figcaption><strong>Event structure comparison</strong></figcaption></figure><p>The difference is striking.</p><p>Flu shows a large number of peaks spread across the timeline, with relatively shorter durations. The signal is frequently crossing into and out of outbreak territory, creating many transitions.</p><p>Dengue, in contrast, has far fewer peaks. When outbreaks occur, they tend to last longer, and they are separated by extended periods of lower activity.</p><p>This provides a much clearer explanation for the earlier results.</p><ul><li>Flu has <strong>frequent, shorter events</strong></li><li>Dengue has <strong>rare, longer events</strong></li></ul><h4>Why this matters for prediction</h4><p>The model is not predicting exact values — it is predicting whether the system will cross a threshold into an outbreak state.</p><p>For flu, the system is often near that threshold. Small changes can flip the label from non-outbreak to outbreak or vice versa. This makes the classification boundary unstable, especially as the prediction horizon increases.</p><p>For dengue, the situation is different. Outbreaks are more distinct and persist for longer periods. Once the system enters an outbreak phase, it tends to stay there. This creates a more stable classification problem, even at longer horizons.</p><p>This distinction — how often events occur and how long they persist — turns out to be more important than traditional statistical measures.</p><p>The key insight is that predictability is not just about how “noisy” or “spiky” a signal is. It is about how events are distributed and sustained over time.</p><p>The final section pulls this together into a broader interpretation.</p><h3>What This Means</h3><p>This small experiment started as a comparison between two diseases, but it points to a more general idea about forecasting.</p><p>When using simple, threshold-based models, predictability is not primarily controlled by model complexity or the addition of external features. Instead, it is strongly influenced by how events are organized in time.</p><p>Flu and dengue illustrate this clearly. Even though their overall statistical profiles are similar, their event structures are very different. Flu produces frequent, shorter-lived excursions into higher activity, which leads to many boundary crossings and a rapid loss of predictability as the forecast horizon increases. Dengue, on the other hand, produces fewer but more persistent outbreaks, which makes the classification problem more stable over time.</p><p>This leads to a more precise way of thinking about forecastability:</p><p><em>Predictability depends on event frequency and persistence.</em></p><ul><li>Systems with <strong>frequent, short-duration events</strong> tend to be harder to predict at longer horizons</li><li>Systems with <strong>rare, sustained events</strong> tend to retain predictability over time</li></ul><p>This perspective also explains why adding weather features did not help the flu model. If the main limitation is the instability of the underlying signal near the outbreak threshold, then additional variables are unlikely to resolve that instability. The bottleneck is not missing information — it is the nature of the signal itself.</p><h4>Limitations and next steps</h4><p>There are, of course, limitations to this analysis.</p><p>Only two diseases were considered, and they come from different geographic and reporting contexts. The choice of outbreak thresholds affects how events are defined, and while care was taken to ensure coherent labeling, different thresholds could change the details of the results. The modeling approach was intentionally simple, and more complex methods might extract additional structure.</p><p>At the same time, these limitations point directly to future work. The same analysis could be extended to other diseases, or even to non-health domains such as energy demand or traffic patterns. Synthetic signals with controlled event structures could also be used to isolate the effect more precisely.</p><h4>Closing thought</h4><p>The most interesting outcome of this project is not that one disease is easier to predict than another. It is that the difference can be traced back to something simple and intuitive:</p><p><strong><em>how often events occur, and how long they last.</em></strong></p><p>Once that lens is applied, predictability becomes less mysterious. It is not just a property of models. It is a property of the system itself.</p><p><em>I’m Suvo Ganguli. I spent 20 years building control systems for aerospace and automotive systems, and now focus on applying AI to real-world problems through my nonprofit, AI for Humanity Tech.</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=500fc0cec4f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>