<?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 Abhishekh on Medium]]></title>
        <description><![CDATA[Stories by Abhishekh on Medium]]></description>
        <link>https://medium.com/@abhishekh_15857?source=rss-d6ea47d11a8c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*aUjA8ZZdimZkcqCt</url>
            <title>Stories by Abhishekh on Medium</title>
            <link>https://medium.com/@abhishekh_15857?source=rss-d6ea47d11a8c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 30 Nov 2026 11:28:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@abhishekh_15857/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[What Does p < 0.05 Really Mean? The Statistical Myth We Keep Believing]]></title>
            <link>https://medium.com/@abhishekh_15857/what-does-p-0-05-really-mean-the-statistical-myth-we-keep-believing-564d663b86dd?source=rss-d6ea47d11a8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/564d663b86dd</guid>
            <category><![CDATA[p-value]]></category>
            <category><![CDATA[statistical-significance]]></category>
            <category><![CDATA[hypothesis-testing]]></category>
            <category><![CDATA[bonferroni-correction]]></category>
            <category><![CDATA[effect-size]]></category>
            <dc:creator><![CDATA[Abhishekh]]></dc:creator>
            <pubDate>Sat, 24 Oct 2026 17:57:48 GMT</pubDate>
            <atom:updated>2026-10-24T18:01:31.523Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*57S6jxYg9VJC-bSJ0SEbrw.png" /></figure><p>One number appears in thousands of scientific headlines. But does it tell us something is true, important, or merely surprising?</p><p>You have probably seen a headline that sounds like this:</p><h4><strong><em>Scientists find a significant result: p &lt; 0.05.</em></strong></h4><p>Perhaps a new teaching method appears to improve grades. Perhaps a phone app claims it increases concentration. The research paper reports a tiny p-value, and the headline quickly becomes:</p><h4><strong><em>Science proves it works.</em></strong></h4><p>But what exactly was proved?</p><blockquote><strong>Does p = 0.03 mean there is a 97% chance the claim is true?</strong></blockquote><blockquote><strong>Does p = 0.06 mean there is no effect?</strong></blockquote><p>Why do researchers use 0.05 instead of 0.01 or 0.10?</p><h4><strong>And if a researcher tests a hundred different ideas, can some look successful just by luck?</strong></h4><p>These questions are not complicated because the mathematics is complex. They are complicated because we often ask a p-value to answer questions it was never designed to answer.</p><p>In this article, we will start with one ordinary experiment, understand what a p-value actually tells us, explore what it cannot tell us, and then see why testing many ideas creates an entirely new problem.</p><h4>Along the way, we will learn three ways scientists deal with that problem: Bonferroni, Benjamini–Hochberg, and Benjamini–Yekutieli correction.</h4><p>You won’t need advanced mathematics. A basic understanding of percentages, averages, and probability is enough.</p><h3>1. An ordinary observation becomes a scientific claim</h3><p>A school wants to know whether listening to music playlist changes student’s exam performance.</p><p>It randomly assigns 100 students to two groups. Fifty students complete the same exam while listening to music, while the other fifty take it in silence. Both groups have the same amount of time, and the testing conditions are kept as similar as possible.</p><p>The results are interesting.</p><h4><strong>The music group’s average score is 78 out of 100 . The silence group’s average score is 74 out of 100 .</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/733/1*-1wO6BZicOOWtpiR9oICmg.jpeg" /></figure><blockquote><strong>Figure 1. Average scores of students listening to music versus silence.</strong></blockquote><p>Someone might say,</p><blockquote>Students listening to music scored four marks higher.</blockquote><p>That statement is correct. It describes what happened in the experiment.</p><p>But suppose someone makes a stronger claim:</p><blockquote>Music made students score four marks higher.</blockquote><p>Are these statements equivalent?</p><p>Not necessarily.</p><h4>Even if music has no effect, two randomly selected groups of students will not always perform identically.</h4><p><strong><em>One group might happen to include more well-prepared students. Some students might have a particularly good or bad day.</em></strong></p><p><strong>Random assignment helps make the comparison fair, but it cannot guarantee identical groups.</strong></p><p>So the real scientific question becomes:</p><h4><strong>If music actually makes no difference, how surprising would a four-mark difference be?</strong></h4><p>That is exactly the kind of question a p-value is designed to answer.</p><h3>2. A p-value is about a “what-if” world</h3><p>Imagine a world where music has absolutely no real effect on students’ average examination scores.</p><p>Statisticians call this starting assumption the <strong><em>null hypothesis</em></strong> .</p><p>For our example, it simply means:</p><h4><strong>Suppose listening to music does not change average exam performance.</strong></h4><p>Now imagine repeating the experiment thousands of times using new groups of students.</p><p>Even in this imaginary world where music does nothing, the difference between the two groups would not always be zero.</p><h4><strong>Sometimes the music group would score slightly higher.</strong></h4><h4><strong>Sometimes the silence group would score slightly higher.</strong></h4><p><strong>A few experiments might produce unusually large differences.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qXhcyyB-x2hP3BH4tfq_aA.png" /></figure><blockquote><strong>Figure 2. How outcomes vary even if there is no effect.</strong></blockquote><p>For illustration, suppose an appropriate two-sided statistical test gives our experiment a p-value of 0.03. This value depends not only on the difference between the group averages but also on how much individual students’ scores vary.</p><p>What does that mean?</p><p>It means:</p><h4><strong>If music truly has no effect, and the assumptions of our statistical test are correct, a result at least this statistically extreme would occur about 3 times in 100 repetitions.</strong></h4><h4><strong>Because we are looking for a change in either direction, an extreme result might mean an unusually large advantage for music or an unusually large advantage for silence.</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5e8ixMmMqhZcWRGngti27Q.png" /></figure><blockquote><strong>Figure 3. Visual meaning of the p-value under the no-effect assumption.</strong></blockquote><p>Imagine tossing a fair coin ten times.</p><h4>You might obtain nine heads. That is unusual, but it is possible even when the coin is completely fair.</h4><p>Similarly, a surprising exam-score difference is possible even when music has no real effect.</p><p>A p-value helps us measure just how surprising the result would be under our starting assumption.</p><p>Notice what we are asking:</p><h4><strong>If there is no effect, how unusual are these observations?</strong></h4><p>We are not asking:</p><h4><strong>Given these observations, what is the probability that there is no effect?</strong></h4><p>The difference between those questions is fundamental.</p><h3>3. What a p-value does NOT tell us</h3><p>Consider our result again.</p><pre>p = 0.03</pre><p>There are three especially common mistakes.</p><h4><em>Myth 1: p = 0.03 means there is only a 3% chance that the null hypothesis is true</em></h4><p>No. A p-value does not calculate the probability that a hypothesis is true or false. It begins by assuming a particular explanation and evaluates how unusual the observations would be under that assumption.</p><h4>Myth 2: <em>p </em>= 0.03 means the probability of a false discovery is 3%</h4><p>Again, no. The probability that a reported discovery is false depends on other information, including which hypotheses were tested, how the study was conducted, and how results were selected. The p-value alone cannot answer that question.</p><h4>Myth 3: p = 0.03 means the effect is large</h4><p>This is another misconception. A p-value is not a measure of how large or important an effect is.</p><p>To understand that distinction, we need to examine something called effect size .</p><h3>4. Effect size: how big is the difference?</h3><p>Remember our school experiment.</p><p>Students listening to music averaged 78 marks, while students studying in silence averaged 74.</p><p>The observed difference is:</p><pre>78 − 74 = 4 marks</pre><p>That four-mark difference is an example of an observed effect-size estimate. It measures the difference between the two groups’ average scores, without yet establishing whether music caused that difference. Effect size tells us how large a difference or relationship is.</p><p>Let’s imagine three different teaching methods being compared with a traditional method that gives students an average score of 70.</p><pre>Traditional method - Average score: 70; <br><br>Difference:<br><br>Method A - Average score: 70.5; Difference: +0.5 marks<br>Method B - Average score: 74; Difference: +4 marks<br>Method C - Average score: 82; Difference: +12 marks</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rRv9xCs_NTl63iP5mRnIww.png" /></figure><blockquote><strong>Figure 4. Small versus larger differences in marks.</strong></blockquote><p>The differences are clearly not equal.</p><blockquote><strong>A half-mark improvement may be too small to matter in many situations.</strong></blockquote><blockquote><strong>Four extra marks might make an important difference if a student is close to a passing mark.</strong></blockquote><blockquote><strong>Twelve extra marks could represent a substantial improvement.</strong></blockquote><p>But there is no universal rule stating that a particular number of marks is always important .</p><p>The meaning depends on the situation.</p><blockquote><strong>Now imagine that one very large experiment finds an average improvement of only 0.2 marks, but its p-value is extremely small.</strong></blockquote><blockquote><strong>Another experiment finds an average improvement of six marks, but its p-value is above 0.05.</strong></blockquote><p><strong><em>How is that possible?</em></strong></p><p>Because a p-value depends not only on the observed difference but also on how many people were studied and how much their individual results varied.</p><p><strong>When a difference is measured very precisely, even a tiny effect can produce a small p-value.</strong></p><p><strong>When a study is small or its results vary substantially, a relatively large observed difference can remain uncertain.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*kklMwEb5YqtX1oYKcrrnUQ.png" /></figure><blockquote><strong>Figure 5. Different effect sizes can correspond to different statistical evidence.</strong></blockquote><p>This gives us two different questions:</p><pre>Effect size: How big is the observed difference?<br><br>p-value: How surprising is the result if there really is no effect?</pre><p>A small p-value does not automatically mean a large or meaningful improvement.</p><h3>5. Why is everyone obsessed with 0.05?</h3><p>Scientists frequently describe results with p &lt; 0.05 as statistically significant.</p><h4>But why 0.05?</h4><p>Why not 0.04, 0.01, or 0.10?</p><p>The answer is partly historical.</p><p>In the early twentieth century, statistician Ronald Fisher helped popularize 0.05 as a convenient threshold for identifying unusual statistical results. Before computers, researchers often relied on printed statistical tables, so common reference thresholds were practically useful.</p><p>Over time, 0.05 became widely adopted across scientific fields.</p><p>But it was never intended to be a universal boundary separating scientific truth from falsehood.</p><p>For example, with sample standard deviations of approximately 9.1 marks in both groups, a conventional two-sided, independent-samples t-test would produce approximately p = 0.0303.</p><pre>Under a 0.05 rule, the result passes.<br>Under a stricter 0.01 rule, the same result does not pass.</pre><p><strong>Has anything changed about the students?</strong></p><pre>No.</pre><p><strong>Have their scores changed?</strong></p><pre>No.</pre><p><strong>Has the estimated difference changed?</strong></p><pre>No.</pre><h4>Only the decision rule has changed.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EMynXKZeeGldLBNmzqsoZw.png" /></figure><blockquote><strong>Figure 6. Comparing the 0.05 and 0.01 significance thresholds.</strong></blockquote><p>A stricter threshold makes it harder for random fluctuations to produce a statistically significant result.</p><p>However, it can also make genuine effects harder to detect.</p><p>This is why selecting a threshold involves balancing two kinds of mistakes.</p><p>A false positive occurs when we declare an effect even though there is no real effect.</p><p>A false negative occurs when we fail to detect an effect that actually exists.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQuPtBTgXTEbWw3240j-Tw.png" /></figure><blockquote><strong>Figure 7. Family-wise error rate (FWER) versus false discovery rate (FDR): two approaches to controlling false discoveries.</strong></blockquote><p>Think of a fire alarm.</p><pre>If it is too sensitive, it may ring because someone burned toast.</pre><pre>If it is not sensitive enough, it might fail to detect a real fire.</pre><h4>Statistical decisions involve a similar trade-off.</h4><pre>And consider p = 0.049 versus p = 0.051.</pre><p>These values are almost identical, yet one passes the familiar threshold and the other does not. <strong>That does not mean scientific reality changes abruptly at 0.05.</strong></p><h3>6. The real trap: what if we test 100 playlists?</h3><p>Now our school becomes more ambitious.</p><p>Instead of testing one playlist, it decides to test 100 different playlists.</p><p>Some contain classical music. Others contain piano music, instrumental tracks, lo-fi beats, or nature sounds.</p><p>Imagine that, in reality, none of those playlists affects average examination scores .</p><pre>Every no-effect hypothesis is true.</pre><h4>For a valid statistical test using the 0.05 threshold, an ineffective playlist can appear statistically significant purely because of random variation.</h4><p>If each test has exactly a 5% probability of such a false positive, then across 100 tests the expected number of false positives is:</p><pre>100 × 0.05 = 5</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Mty3_xj_o-_zaDttegPlug.png" /></figure><blockquote><strong>Figure 8. One hundred tests and five illustrated false positives.</strong></blockquote><p>Why five?</p><p>Each test gives random chance another opportunity to produce a misleading result.</p><h4><strong>With 100 tests, each having a 5-in-100 false-positive probability, we expect five false positives on average.</strong></h4><p>That does not mean exactly five must appear in every experiment.</p><p>One collection of tests might produce two false positives, another seven, and another none.</p><p>Five is the long-run average across repeated collections of 100 tests.</p><p>The problem becomes obvious.</p><p>The school might announce:</p><h4>We discovered five playlists that significantly change examination performance!</h4><p><strong>Yet in our imaginary world, none of those playlists actually works.</strong></p><p><strong>This is the problem of multiple hypothesis testing .</strong></p><p><strong>When researchers test many different ideas, they create many opportunities for apparently significant findings to arise by chance.</strong></p><h3><strong>7. What is multiple-testing correction?</strong></h3><p>Multiple-testing correction accounts for the fact that we have tested many hypotheses rather than just one.</p><p>But different correction methods try to prevent different kinds of mistakes.</p><p>One approach attempts to keep the probability of even one false discovery low.</p><p>This is called controlling the family-wise error rate , or FWER.</p><p>Another approach attempts to control the expected proportion of false discoveries among results declared significant .</p><h4><strong>This is called controlling the false discovery rate , or FDR.</strong></h4><p>For example, imagine a study announces 20 discoveries, but two of them are actually false.</p><p>In that particular study:</p><pre>2 / 20 = 10% of the reported discoveries are false in this particular study.<br><br>This is the false-discovery proportion observed in that study. <br><br>The false discovery rate (FDR) is different:<br><br>it describes the expected false-discovery proportion across repeated <br>applications of a statistical procedure.</pre><p>A procedure controlling FDR at 5% does not guarantee that every study will have fewer than 5% false findings.</p><p>Let’s look at three common correction methods using exactly the same five hypothetical tests.</p><h3>8. Bonferroni correction: divide the allowance</h3><p>Suppose the school conducts a separate study designed from the beginning to test exactly five playlists.</p><p>The p-values are:</p><pre>Classical - Original p-value: 0.001<br>Lo-fi - Original p-value: 0.018<br>Piano - Original p-value: 0.021<br>Nature sounds - Original p-value: 0.049<br>Instrumental - Original p-value: 0.200</pre><p>Without correction, four p-values fall below 0.05.</p><p>Bonferroni aims to keep the probability of at least one false discovery across the five tests at or below 5%.</p><p>It does this by dividing the significance threshold by the number of tests.</p><pre>0.05 / 5 = 0.01</pre><p>Now an individual p-value must be 0.01 or smaller to pass.</p><p>Only Classical passes.</p><p>We can also express the same decision by multiplying each original p-value by five, capping the result at 1.</p><pre>Classical - Original p: 0.001; Bonferroni-adjusted p: 0.005<br>Lo-fi - Original p: 0.018; Bonferroni-adjusted p: 0.090<br>Piano - Original p: 0.021; Bonferroni-adjusted p: 0.105<br>Nature sounds - Original p: 0.049; Bonferroni-adjusted p: 0.245<br>Instrumental - Original p: 0.200; Bonferroni-adjusted p: 1.000</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*j7_XCryQxH5u3er4e7zACw.png" /></figure><blockquote><strong>Figure 9. Bonferroni correction of all five tests.</strong></blockquote><p>Only Classical has an adjusted p-value below 0.05.</p><p>Bonferroni is simple and offers strong protection against false positives, but it can be conservative when many tests are conducted.</p><h3>9. Benjamini–Hochberg correction: rank the evidence</h3><p>Benjamini–Hochberg, commonly called BH, takes a different approach.</p><p>Rather than controlling the probability of at least one false positive, BH aims to control the false discovery rate: the expected proportion of false positives among reported discoveries. Its guarantee holds when the statistical tests produce valid p-values and are independent or satisfy certain forms of positive dependence.</p><p>The idea begins with ordering the evidence.</p><p>First, sort all five p-values from smallest to largest.</p><p>They are already sorted in our example.</p><p>Next, give each p-value a rank.</p><pre>1 - Playlist: Classical; Original p: 0.001<br>2 - Playlist: Lo-fi; Original p: 0.018<br>3 - Playlist: Piano; Original p: 0.021<br>4 - Playlist: Nature sounds; Original p: 0.049<br>5 - Playlist: Instrumental; Original p: 0.200</pre><p>Now calculate a starting adjusted number:</p><p>Starting BH value = Original p × Number of tests / Rank</p><p>For Classical:</p><pre>0.001 × 5 / 1 = 0.005</pre><p>For Lo-fi:</p><pre>0.018 × 5 / 2 = 0.045</pre><p>For Piano:</p><pre>0.021 × 5 / 3 = 0.035</pre><p>For Nature sounds:</p><pre>0.049 × 5 / 4 = 0.06125</pre><p>For Instrumental:</p><pre>0.200 × 5 / 5 = 0.200</pre><p>These give us:</p><pre>Classical - Starting BH value: 0.005<br>Lo-fi - Starting BH value: 0.045<br>Piano - Starting BH value: 0.035<br>Nature sounds - Starting BH value: 0.06125<br>Instrumental - Starting BH value: 0.200</pre><p>Notice something strange.</p><p>Lo-fi has a smaller original p-value than Piano, but its starting adjusted value is larger.</p><p>That is why BH has one more step.</p><p>We start with the largest original p-value and work upward.</p><p>At each row, we keep the smaller of the starting adjusted value and the final adjusted value directly below it.</p><pre>For Instrumental, the value remains 0.200.<br>For Nature sounds, we compare 0.06125 with 0.200 and keep 0.06125.<br>For Piano, we compare 0.035 with 0.06125 and keep 0.035.<br>For Lo-fi, we compare 0.045 with 0.035 and keep 0.035 .<br>Finally, for Classical, we compare 0.005 with 0.035 and keep 0.005.</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XpcfG4bai-9mJNizvkVI2A.png" /></figure><blockquote><strong>Figure 10. Step-by-step BH correction working from bottom to top.</strong></blockquote><h3>Our finished BH-adjusted values are:</h3><pre>Classical - Original p: 0.001; BH-adjusted p: 0.005<br>Lo-fi - Original p: 0.018; BH-adjusted p: 0.035<br>Piano - Original p: 0.021; BH-adjusted p: 0.035<br>Nature sounds - Original p: 0.049; BH-adjusted p: 0.06125<br>Instrumental - Original p: 0.200; BH-adjusted p: 0.200</pre><p>At the 0.05 threshold, three playlists pass: Classical, Lo-fi, and Piano.</p><p>This does not prove those playlists are effective.</p><p>It means they meet the selected FDR rule, under the assumptions of the method.</p><h3>10. Benjamini–Yekutieli correction: adding caution for related tests</h3><p>Sometimes the tests being performed are related.</p><p>For example, multiple playlists might be compared against the same group of students studying in silence.</p><p>Those tests may share information, so their results may not be independent.</p><p>Benjamini–Yekutieli, or BY, provides FDR control under arbitrary dependence between valid tests.</p><p>The calculation is similar to BH but adds an extra factor.</p><p>For five tests, that factor is:</p><pre>1 + 1/2 + 1/3 + 1/4 + 1/5 = 2.2833</pre><p>Now the starting calculation becomes:</p><pre>Starting BY value = Original p × 5 × 2.2833 / Rank</pre><p>This gives approximately:</p><pre>Classical - Starting BY value: 0.01142<br>Lo-fi - Starting BY value: 0.10275<br>Piano - Starting BY value: 0.07992<br>Nature sounds - Starting BY value: 0.13985<br>Instrumental - Starting BY value: 0.45667</pre><h4>As with BH, we work upward from the largest p-value, keeping the smaller number at each step.</h4><p>For example, Lo-fi’s starting 0.10275 becomes 0.07992 because Piano’s finished value directly below it is smaller.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*in2ykG5i-vKnuCvKfzOuUQ.png" /></figure><blockquote><strong>Figure 11. Step-by-step BY adjustment with extra dependence factor.</strong></blockquote><p>The final values are:</p><pre>Classical - BY-adjusted p: 0.01142<br>Lo-fi - BY-adjusted p: 0.07992<br>Piano - BY-adjusted p: 0.07992<br>Nature sounds - BY-adjusted p: 0.13985<br>Instrumental - BY-adjusted p: 0.45667</pre><p>Only Classical passes the 0.05 threshold.</p><p>BY is more conservative because it provides protection under a wider range of dependence patterns.</p><p>However, correlated tests do not automatically require BY. BH is already valid under certain forms of positive dependence.</p><h3>11. Same evidence, different statistical decisions</h3><p>Let’s compare the results.</p><pre>Classical - Original p: 0.001; Bonferroni: 0.005; BH: 0.005; BY: 0.01142<br>Lo-fi - Original p: 0.018; Bonferroni: 0.090; BH: 0.035; BY: 0.07992<br>Piano - Original p: 0.021; Bonferroni: 0.105; BH: 0.035; BY: 0.07992<br>Nature sounds - Original p: 0.049; Bonferroni: 0.245; BH: 0.06125; BY: 0.13985<br>Instrumental - Original p: 0.200; Bonferroni: 1.000; BH: 0.200; BY: 0.45667</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zasi9PqvUXk72lqjtycXrg.png" /></figure><blockquote><strong>Figure 12. Comparison of all correction methods.</strong></blockquote><p>Under the conventional 0.05 threshold:</p><p>Four playlists pass without correction.</p><p>One passes Bonferroni.</p><p>Three pass BH.</p><p>One passes BY.</p><p>Have the experimental observations changed?</p><p>No.</p><p>The correction methods offer different protections against statistical errors.</p><p>Researchers should choose a method based on their scientific objectives and the nature of their tests, rather than simply selecting whichever method produces the most significant findings.</p><h3>12. What if a result fails multiple-testing correction?</h3><p>Suppose Lo-fi has an original p-value of 0.018.</p><p>It passes BH correction at 0.05 but fails Bonferroni correction.</p><h4>Does that mean Lo-fi works according to BH and doesn’t work according to Bonferroni?</h4><p>No. The evidence is the same.</p><p>Only the statistical decision rules differ.</p><p>Failing a correction does not prove that an effect is absent.</p><p>It means the available evidence does not satisfy that particular correction procedure.</p><p>This is where effect size, sample size, experimental design, and uncertainty become important.</p><p>Imagine a huge experiment detecting an improvement of only 0.2 marks with great precision.</p><p>Now imagine a much smaller experiment suggesting an improvement of six marks, but with substantial uncertainty.</p><p>The first might produce a small p-value even though the effect is not practically important.</p><p>The second might fail the significance threshold despite suggesting an effect worth investigating.</p><p>A p-value alone cannot tell us which finding deserves attention.</p><p>And there is no universal minimum number of students required before BH correction can be applied. The number of tests determines the correction, while the sample size and study design determine how reliable and informative the individual tests can be.</p><h3>13. How should we read the next scientific headline?</h3><p>The next time you encounter the phrase “statistically significant, p &lt; 0.05” , consider what it actually tells you.</p><p>Ask what was compared, how large the observed difference was, how much uncertainty surrounds it, how many other hypotheses were tested, and whether independent experiments have reproduced the finding.</p><p>For our original music experiment, an honest conclusion would be:</p><h4>The music group scored four marks higher on average. If music truly had no effect, a difference at least this statistically extreme would be relatively unusual under our statistical model. Because the students were randomly assigned, the experiment provides some evidence about a possible causal effect of music. However, one experiment cannot conclusively establish the effect’s size or practical importance, nor guarantee that another experiment would produce the same result.</h4><p>This is what statistical reasoning is about.</p><p>Not collecting small p-values.</p><p>Not treating 0.05 as a universal boundary between truth and falsehood.</p><p>And not dismissing every finding that fails a correction procedure.</p><p><strong>An effect size asks: How big is the observed difference?</strong></p><p><strong>A p-value asks: How surprising would the data be if there were no effect?</strong></p><p>A multiple-testing correction asks: How do we avoid being fooled when we test many ideas?</p><p>These are three different questions.</p><p>Understanding their differences is much more valuable than memorizing any particular formula.</p><p>The goal of research is not to obtain p &lt; 0.05. The goal is to make claims that survive careful examination.</p><h3>References and further reading</h3><p>American Statistical Association: The ASA Statement on p-Values (2016)</p><p>Kennedy-Shaffer: Before p &lt; 0.05 to Beyond p &lt; 0.05 (2019)</p><p>Benjamini and Hochberg: Controlling the False Discovery Rate (1995)</p><p>Benjamini and Yekutieli: The Control of the False Discovery Rate in Multiple Testing Under Dependency (2001)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=564d663b86dd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Non-Negative Matrix Factorization: A Complete Derivation from First Principles]]></title>
            <link>https://medium.com/@abhishekh_15857/non-negative-matrix-factorization-a-complete-derivation-from-first-principles-33f15716cd7a?source=rss-d6ea47d11a8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/33f15716cd7a</guid>
            <category><![CDATA[mathematics]]></category>
            <category><![CDATA[nmf]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[low-rank-approximation]]></category>
            <dc:creator><![CDATA[Abhishekh]]></dc:creator>
            <pubDate>Tue, 14 Apr 2026 18:52:04 GMT</pubDate>
            <atom:updated>2026-04-15T06:09:57.948Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lJ00MmpN-SLwAjoP55WIAA.png" /></figure><p><strong>Every formula proved. No gaps. No “it can be shown that…”</strong></p><h3>If you search for NMF derivations online, you will find one of two things: hand-wavy intuitions that skip the math, or dense papers that assume you already know everything. This article is neither. We go from the definition of a matrix norm all the way to the final update rules, proving every single intermediate step.</h3><p>By the end you will know exactly why the update rule is what it is — not because someone told you, but because you derived it yourself.</p><p><strong>-</strong></p><h3>What You Need to Know Before Starting</h3><p>You need: basic matrix multiplication, partial derivatives, and the idea of minimisation. That’s it. Everything else — trace identities, Lagrange multipliers, the Kronecker delta — is derived here from scratch.</p><p><strong>— -</strong></p><h3>Section 0 — Prerequisites and Notation</h3><h4>0.1 The Kronecker Delta</h4><p>The Kronecker delta is a two-index function defined as:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_gLXKeA-PYa7jTVjwIFqUQ.png" /></figure><p>Its most important use: it acts as a <strong>selector</strong> inside a sum.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Vn50XWxwv3RUUghiTUCn9A.png" /></figure><p>When you sum over j, the delta forces j = k, killing all other terms. Only the j = k term survives.</p><ul><li><strong>Why we care:</strong> When we differentiate element Xᵢⱼ with respect to element Xₘₙ, the answer is 1 only when both indices match:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O6PzQEcwwG0_L2FVZPcO2A.png" /></figure><p>This single identity is the engine of all matrix differentiation done here.</p><p><strong>— -</strong></p><h4>0.2 The Four Trace Identities</h4><p>The <strong>trace</strong> of a square matrix A is the sum of its diagonal elements: Tr(A) = Σᵢ Aᵢᵢ.</p><p>We will use four identities. Here they are — all proved below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KaCOzRJTNFd9J7RMKFvZ4g.png" /></figure><p><strong>Proof of T1</strong> (Tr(A) = Tr(Aᵀ)):</p><p>The (i,i) diagonal entry of Aᵀ is (Aᵀ)ᵢᵢ = Aᵢᵢ by definition of transpose. So both traces sum the same diagonal entries. ∎</p><p><strong>Proof of T2</strong> (linearity):</p><p>Tr(A+B) = Σᵢ(A+B)ᵢᵢ = Σᵢ(Aᵢᵢ + Bᵢᵢ) = Tr(A) + Tr(B). ∎</p><p><strong>Proof of T3</strong> (cyclic property):</p><p>Write Tr(AB) = Σᵢ Σₖ AᵢₖBₖᵢ. Write Tr(BA) = Σᵢ Σₖ BᵢₖAₖᵢ. Relabelling i↔k in the second sum shows they are identical. Applying this twice gives Tr(ABC) = Tr(BCA). ∎</p><ul><li><strong>Proof of T4</strong> (Frobenius = trace):</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MlN2avhwNMih4TiUbxhkGA.png" /></figure><p>The (j,j) entry of AᵀA is the sum of squares of column j of A. Summing over all j gives the sum of squares of all entries — which is exactly ‖A‖²_F. ∎</p><p><strong>— -</strong></p><p><strong>Section 1 — The Problem Setup</strong></p><p><strong>1.1 What is NMF?</strong></p><p>Given a <strong>non-negative data matrix V</strong> of size m×n, find two <strong>non-negative matrices</strong> W (m×k) and H (k×n) such that:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fiLFflrNluJDQH1ipDchDA.png" /></figure><p>where:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H8Ee7bPVKm8tJiyf84Lr9A.png" /></figure><blockquote><strong>k is small</strong> — it is the number of hidden “features.” Think of V as a dataset of movie ratings. W describes what each latent feature looks like. H describes how strongly each feature activates for each user. Non-negativity means features only <em>add</em> — there is no negative cancellation, giving interpretable, parts-based representations.</blockquote><p><strong>1.2 The Cost Function</strong></p><p>We measure how bad our approximation is using the <strong>squared Frobenius norm</strong> — simply the sum of squared element-wise differences:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4ZCWrdVkZPf_fj4Pw56mOg.png" /></figure><p>J = 0 means perfect reconstruction. We want J as small as possible subject to W ≥ 0 and H ≥ 0:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*W_F3xh_vjuPTys9gFz4_bQ.png" /></figure><p>This is a <strong>constrained optimisation problem</strong>. The constraint W, H ≥ 0 is what makes it hard, and is what prevents us from just running standard gradient descent.</p><p><strong>— -</strong></p><p><strong>Section 2 — Expanding the Frobenius Norm</strong></p><p>Before we can differentiate J, we need to expand ‖V − WH‖² into a form that is easy to differentiate. We convert it into <strong>trace form</strong> using Identity T4.</p><p><strong>Step 1 — Apply T4</strong></p><p>Set A = V − WH in T4 (‖A‖²_F = Tr(AᵀA)):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*sDBIpVfimH-3VIDPjlErzw.png" /></figure><p><strong>Step 2 — Expand the Transpose</strong></p><p>Use (A − B)ᵀ = Aᵀ − Bᵀ and the rule <strong>(WH)ᵀ = HᵀWᵀ</strong> (reverse order on transpose of a product):</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*RHFQvCtiZ_PqXid3-nGyGQ.png" /></figure><p><strong>Step 3 — Multiply Out the Brackets</strong></p><p>Expand exactly like (a − b)(a − b) = a² − ab − ba + b², but for matrices:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y5buCfxu_znlaRhj2sPk5g.png" /></figure><p>Apply T2 (linearity of trace) to split into four separate traces:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Kv2H3h9NQCGjEqfmesLSfA.png" /></figure><p><strong>Step 4 — Combine the Middle Two Terms</strong></p><p><strong>Claim:</strong> Tr(HᵀWᵀV) = Tr(VᵀWH).</p><p><em>Proof:</em> Use T1 — Tr(M) = Tr(Mᵀ). Set M = HᵀWᵀV. Then Mᵀ = (HᵀWᵀV)ᵀ = VᵀWH (reverse order, each transposed). So Tr(HᵀWᵀV) = Tr(VᵀWH). ∎</p><p><strong>Therefore the two middle terms add up:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1v3upFvLwYVy58S2qLP9GA.png" /></figure><p><strong>Step 5 — Simplify the Last Term</strong></p><p>Use the cyclic property T3 to rewrite the last term in a cleaner order:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HdYxEPMybzVysGkGrkSo7w.png" /></figure><p><em>(Move Hᵀ from the front to the back of the trace cycle.)</em></p><p><strong>Final Expanded Form</strong></p><p>Putting it all together:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qjcuFuObnb1heQpesXhwyA.png" /></figure><p>This is J written purely in terms of trace operations — now we can differentiate it.</p><p><strong>— -</strong></p><p><strong>Section 3 — Gradient ∂J/∂H</strong></p><p>We differentiate each of the three terms of J with respect to H, <strong>element by element</strong>. The key tool is: for each (m, n), compute ∂J/∂Hₘₙ, then assemble the matrix ∂J/∂H from all these scalars.</p><p><strong>Term 1 — ∂/∂H ‖V‖² = 0.</strong></p><p>‖V‖² contains no H. Every derivative is zero.</p><p><strong>Term 2 — ∂/∂H [−2 Tr(VᵀWH)]</strong></p><p>We first derive the general rule <strong>∂/∂X Tr(AX) = Aᵀ</strong> from scratch:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*NwwCc5ieIywopiV9yQKp6w.png" /></figure><p>Walk through line by line:- Line 1: Write Tr(AX) as an explicit double sum using the definition of matrix multiplication.</p><p>- Line 2: Differentiate w.r.t. Xₘₙ. The only element of X that appears is Xₖᵢ, and its derivative w.r.t. Xₘₙ is the Kronecker delta δₖₘ · δᵢₙ.</p><p>- Line 3: Apply the two deltas — they force k = m and i = n, killing every other term. Only Aₙₘ survives.</p><p>- Line 4: Aₙₘ = (Aᵀ)ₘₙ, and since this holds for every (m, n), the matrix derivative is Aᵀ.</p><p>Applying with A = VᵀW and X = H:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ollBWcIWk-C-VfCjqB010A.png" /></figure><p><strong>Term 3 — ∂/∂H Tr(WᵀWHHᵀ)</strong></p><p>Let B = WᵀW (constant w.r.t. H, and <strong>symmetric</strong>: Bᵀ = B). We derive the rule ∂/∂H Tr(BHHᵀ) = 2BH from scratch:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VVzl_R4yVEqO_-hSgmBKdA.png" /></figure><p>Walk — Line 1: Write Tr(BHHᵀ) as a triple sum over indices i, j, s.</p><p>- Line 2: Differentiate the product Hⱼₛ · Hᵢₛ using the product rule. Each factor contributes one Kronecker delta pair.</p><p>- Lines 3–4: Apply the deltas to each part separately. Part A (from the first delta pair) gives (BH)ₘₙ. Part B (from the second pair) also gives (BH)ₘₙ. Both use the fact that B is symmetric, so Bᵀ = B.</p><p>- Line 5: Add Part A and Part B → result is 2(BH)ₘₙ for every (m, n), so the matrix derivative is 2BH.</p><p><strong>Substituting B = WᵀW:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fp01800OZ9uk0Rij8T4boA.png" /></figure><p><strong>Assembling ∂J/∂H</strong></p><p>Add all three terms:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Gbxh39tYljHW7lowugXlyw.png" /></figure><p><strong>— -</strong></p><p><strong>Section 4 — Gradient ∂J/∂W</strong></p><p>Same approach, now differentiating with respect to W.</p><p><strong>Term 2 — ∂/∂W [−2 Tr(VᵀWH)]</strong></p><p>We need the rule <strong>∂/∂X Tr(AXB) = AᵀBᵀ</strong>, derived the same way:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ovUcSTfRZp_xb0WD0iwqkw.png" /></figure><p><em>*The logic is identical: write as a triple sum, apply ∂Xⱼₖ/∂Xₘₙ = δⱼₘ δₖₙ, the two deltas collapse the sum to a single term.*</em></p><p>Applying with A = Vᵀ, X = W, B = H:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1NHjYXcmISi4rEpzT0f7rw.png" /></figure><p><strong>Term 3 — ∂/∂W Tr(WᵀWHHᵀ)</strong></p><p>Let C = HHᵀ (symmetric). Same element-wise product-rule argument as before gives:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MFaszkYuDxau2NeLSqHrYQ.png" /></figure><p><strong>Assembling ∂J/∂W</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TY2k7suEcEXdlTA-vzvecw.png" /></figure><p><strong>— -</strong></p><p><strong>Section 5 — Why Plain Gradient Descent Fails</strong></p><p>Standard gradient descent would update H as:</p><p>```</p><p>H ← H − α · 2(WᵀWH − WᵀV)</p><p>```</p><p><strong>The problem:</strong> If Hₘₙ = 0.01 and the gradient at (m, n) is +10, then with α = 0.05:</p><p>```</p><p>H_mn ← 0.01 − 0.05 × 10 = −0.49 ← NEGATIVE. Constraint violated!</p><p>```</p><p>Plain gradient descent destroys non-negativity. We need to handle the constraint H ≥ 0 mathematically. The correct tool is the <strong>KKT conditions</strong>.</p><p><strong>— -</strong></p><p><strong>Section 6 — KKT Conditions</strong></p><p><strong>6.1 Rewrite the Constraint</strong></p><p>KKT handles inequality constraints in the form g(x) ≤ 0. Our constraint Hᵢⱼ ≥ 0 becomes:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XNGxTXSHK-B1xcK8HBGNXw.png" /></figure><p><strong>6.2 The Lagrangian</strong></p><p>Introduce a <strong>Lagrange multiplier</strong> λᵢⱼ ≥ 0 for each constraint. The Lagrangian is the objective plus each constraint multiplied by its multiplier:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bT5_03dxiLafiBkuq2n9aA.png" /></figure><p><strong>6.3 The Four KKT Conditions</strong></p><p>At any local minimum, <strong>all four conditions must hold simultaneously</strong>:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*59at6kGEy249CwdArB2MlA.png" /></figure><p><strong>Unpacking each condition:</strong></p><p><strong>Condition 1 (Stationarity):</strong> The Lagrangian has zero gradient. This connects λᵢⱼ to the gradient of J.</p><p><strong>Condition 2 (Primal Feasibility):</strong> The solution must satisfy H ≥ 0.</p><p><strong>Condition 3 (Dual Feasibility):</strong> The multipliers λᵢⱼ ≥ 0. Substituting Condition 1 means the gradient of J cannot be negative at the optimum — otherwise we could still decrease J by moving further.</p><ul><li><strong>Condition 4 (Complementary Slackness):</strong> This is the most powerful. Substituting λᵢⱼ from Condition 1:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bk3nu6QeEPaoYZe7cYbKDQ.png" /></figure><p>This says: either Hᵢⱼ = 0 (we are on the boundary) <em>*or*</em> the gradient is zero (we are at an interior minimum). Both cannot be nonzero at once.</p><p><strong>The two cases:</strong></p><p>&gt; <strong>Case A: Hᵢⱼ &gt; 0</strong> → gradient must be 0 → (WᵀWH)ᵢⱼ = (WᵀV)ᵢⱼ. Standard unconstrained optimum.</p><p>&gt; <strong>Case B: Hᵢⱼ = 0</strong> → gradient ≥ 0. J would increase if we pushed H below 0, but the constraint prevents it. We stay at the boundary.</p><p><strong>— -</strong></p><p><strong>Section 7 — From KKT to the Multiplicative Update Rule</strong></p><p><strong>7.1 Rearrange the KKT Condition (Pure Algebra)</strong></p><p>Start from complementary slackness and expand the bracket:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*g4EqDiZDpyyZ89gOzwxqPg.png" /></figure><p><em>*Line by line:*</em></p><p>- Line 1: Expand Hᵢⱼ · (WᵀWH − WᵀV)ᵢⱼ = 0 by distributing Hᵢⱼ.</p><p>- Line 2: Move the negative term to the right side.</p><p>- Line 3: Divide both sides by (WᵀWH)ᵢⱼ.</p><p><strong>This is a fixed-point equation.</strong> The optimal H satisfies Hᵢⱼ = Hᵢⱼ · (WᵀV)ᵢⱼ / (WᵀWH)ᵢⱼ. No assumption was made — this is pure algebraic rearrangement of KKT.</p><p><strong>7.2 Fixed-Point Iteration</strong></p><p>A classical technique: if the <em>*solution*</em> satisfies x = f(x), then <em>*iterate*</em> x ← f(x) to find it. Apply this directly:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Zg3gDWuDlZkjuEZHFyBsug.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f_2RbQR-X39VieHlTdypTA.png" /></figure><p>where ⊙ means element-wise multiplication and / means element-wise division.</p><p><strong>These are the NMF multiplicative update rules.</strong> They were not pulled from thin air — they emerged directly from the KKT fixed-point equation.</p><p><strong>7.3 Verify: Fixed Point Satisfies KKT</strong></p><p>At convergence H* = H* · (WᵀV) / (WᵀWH):</p><p>- <strong>If H</strong><em>*ᵢⱼ &gt; 0:</em><strong> Divide both sides by H*ᵢⱼ → ratio equals 1 → (WᵀWH)ᵢⱼ = (WᵀV)ᵢⱼ → gradient = 0. ✓ KKT Case A satisfied.</strong></p><p>- <strong>If H*ᵢⱼ = 0:</strong> Left side = 0, right side = 0 · (ratio) = 0. ✓ KKT Case B satisfied trivially.</p><p><strong>— -</strong></p><p><strong>Section 8 — Non-Negativity Is Preserved</strong></p><p><strong>Claim:</strong> If W ≥ 0, H ≥ 0, V ≥ 0 at step t, then H ≥ 0 at step t+1.</p><p><em>Proof by induction:</em></p><p><strong>Base case (t = 0):</strong> Initialise W and H with small random positive values. ✓</p><p><strong>Inductive step:</strong> Assume H⁽ᵗ⁾ ≥ 0. After the update:</p><p>- <strong>Numerator</strong> (WᵀV)ᵢⱼ = Σₖ Wₖᵢ Vₖⱼ. Each term Wₖᵢ ≥ 0 (by hypothesis) and Vₖⱼ ≥ 0 (given data). Sum of non-negatives ≥ 0. ✓</p><p>- <strong>Denominator</strong> (WᵀWH)ᵢⱼ = Σₖ (WᵀW)ᵢₖ Hₖⱼ⁽ᵗ⁾. Each factor ≥ 0. Sum ≥ 0. ✓</p><p>Therefore H⁽ᵗ⁺¹⁾ = H⁽ᵗ⁾ · [non-negative / non-negative] ≥ 0. ✓</p><p>An identical argument applies to W.</p><p><strong>— -</strong></p><p><strong>Section 9 — Convergence: J Never Increases</strong></p><p><strong>9.1 The Auxiliary Function Method</strong></p><p>Lee and Seung (1999) proved convergence using an <strong>auxiliary function</strong> G(H, H_old):</p><p>- <strong>Property P1:</strong> G(H, H_old) ≥ J(H) for all H, H_old — G is an upper bound on J.</p><p>- <strong>Property P2:</strong> G(H, H) = J(H) for all H — G is tight on the diagonal.</p><ul><li><strong>The key theorem:</strong> If we define each update as H⁽ᵗ⁺¹⁾ = argminₕ G(H, H⁽ᵗ⁾), then:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V4K7kvVl1FqJqlwOJ9VNFw.png" /></figure><p>Reading the chain: 1. J(H⁽ᵗ⁺¹⁾) ≤ G(H⁽ᵗ⁺¹⁾, H⁽ᵗ⁾) by Property P1.</p><p>2. G(H⁽ᵗ⁺¹⁾, H⁽ᵗ⁾) ≤ G(H⁽ᵗ⁾, H⁽ᵗ⁾) because H⁽ᵗ⁺¹⁾ minimises G.</p><p>3. G(H⁽ᵗ⁾, H⁽ᵗ⁾) = J(H⁽ᵗ⁾) by Property P2.</p><p><strong>Therefore J is non-increasing at every step.</strong> Since J ≥ 0, it must converge.</p><p><strong>9.2 The Update Rule Minimises the Auxiliary Function</strong></p><p>The auxiliary function is constructed by replacing the quadratic curvature in a Taylor expansion with a looser (but elementwise-separable) upper bound. For each (i, j) the relevant piece of G is:</p><p>```</p><p>g(H_ij) = constant</p><p>+ H_ij · [gradient of J at H^(t)]</p><p>+ [(WᵀWH^(t))_ij / H^(t)_ij] · (H_ij − H^(t)_ij)²</p><p>```</p><p>Setting dg/dHᵢⱼ = 0 and solving:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qISr6qKx1frulWNDjTUjAA.png" /></figure><p>The minimiser of G is <em>*exactly*</em> the multiplicative update rule. This closes the loop: not only does our update converge, it does so by minimising a tight upper bound on J at every step.</p><p><strong>— -</strong></p><p><strong>Section 10 — The Complete Algorithm</strong></p><p>```</p><p>INPUT: V (m × n, non-negative)</p><p>k (number of latent features, k ≪ min(m,n))</p><p>STEP 1: Initialise W (m×k) and H (k×n) with small random positive values</p><p>STEP 2: Repeat until convergence:</p><p>UPDATE H: H ← H ⊙ (WᵀV) / (WᵀWH)</p><p>UPDATE W: W ← W ⊙ (VHᵀ) / (WHHᵀ)</p><p>COMPUTE: J = ‖V − WH‖²_F</p><p>STOP if J has decreased by less than a tolerance ε</p><p>OUTPUT: W, H such that V ≈ WH, all entries ≥ 0</p><p>```</p><p><strong>Guaranteed properties:</strong></p><p>- ✅ Non-negativity of W and H preserved at every step.</p><p>- ✅ J is monotonically non-increasing.</p><p>- ✅ Fixed points of the update satisfy the KKT optimality conditions.</p><p>- ⚠️ NMF is not jointly convex in (W, H) — only local minima are guaranteed.</p><p>- ⚠️ Different random initialisations may give different solutions.</p><p>- ⚠️ Add a small ε to denominators to avoid division by zero.</p><p><strong>— -</strong></p><p><strong>The Complete Logical Chain</strong></p><p>```</p><p>GIVEN</p><p>Minimise J = ‖V − WH‖² subject to W, H ≥ 0</p><p>STEP 1 — Apply ‖A‖² = Tr(AᵀA)</p><p>J = ‖V‖² − 2 Tr(VᵀWH) + Tr(WᵀWHHᵀ)</p><p>STEP 2 — Differentiate term by term (element-wise + Kronecker delta)</p><p>∂J/∂H = 2(WᵀWH − WᵀV)</p><p>∂J/∂W = 2(WHHᵀ − VHᵀ)</p><p>STEP 3 — Observe plain GD violates H, W ≥ 0 → use KKT</p><p>STEP 4 — Write Lagrangian, apply all 4 KKT conditions</p><p>Complementary slackness: H_ij · (WᵀWH − WᵀV)_ij = 0 ∀ i,j</p><p>STEP 5 — Rearrange KKT algebraically into a fixed-point equation</p><p>H_ij = H_ij · (WᵀV)_ij / (WᵀWH)_ij</p><p>STEP 6 — Apply fixed-point iteration x ← f(x)</p><p>H ← H ⊙ (WᵀV)/(WᵀWH)</p><p>W ← W ⊙ (VHᵀ)/(WHHᵀ)</p><p>STEP 7 — Verify</p><p>Non-negativity preserved ✅</p><p>J decreases every step ✅</p><p>Converges to KKT ✅</p><p>```</p><p><strong>— -</strong></p><p><strong>Summary</strong></p><p>The multiplicative update rules are not a trick. They are the <strong>direct algebraic consequence</strong> of three things:</p><p>1. The gradient of the squared Frobenius cost.</p><p>2. The KKT complementary slackness condition for non-negativity.</p><p>3. Rearranging that condition into a fixed-point iteration.</p><p>Every symbol in the final formula traces back to a first-principles derivation. That is NMF — completely understood.</p><p><strong>— -</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33f15716cd7a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Principal Component Analysis (PCA): A Step-by-Step Derivation
with Intuition, Examples, and…]]></title>
            <link>https://medium.com/@abhishekh_15857/principal-component-analysis-pca-a-step-by-step-derivation-with-intuition-examples-and-ad0c42f592c1?source=rss-d6ea47d11a8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/ad0c42f592c1</guid>
            <dc:creator><![CDATA[Abhishekh]]></dc:creator>
            <pubDate>Thu, 05 Feb 2026 09:59:38 GMT</pubDate>
            <atom:updated>2026-02-05T18:26:51.445Z</atom:updated>
            <content:encoded><![CDATA[<p>Principal Component Analysis (PCA): A Step-by-Step Derivation<br>with Intuition, Examples, and Limitations</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LpCdt1gl_8QrjcjlSgclLA.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IOhowuIrLiqAbt8nEJ7PMQ.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IpIQCZAxCuHdwUWBu3F2Hw.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0kTbbTtgPGd-w2D3arsjaQ.jpeg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ad0c42f592c1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unlocking Python’s Magic for Beginners: Lambda Functions, Map, and Filter]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/@abhishekh_15857/unlocking-pythons-magic-for-beginners-lambda-functions-map-and-filter-27d20c180aa3?source=rss-d6ea47d11a8c------2"><img src="https://cdn-images-1.medium.com/max/1024/1*DrSpffvXdBK8L4ThFkNqsA.jpeg" width="1024"></a></p><p class="medium-feed-snippet">Data science can feel like a huge puzzle if you&#x2019;re just starting out with Python. But don&#x2019;t worry! In this beginner-friendly guide, we&#x2019;ll&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/@abhishekh_15857/unlocking-pythons-magic-for-beginners-lambda-functions-map-and-filter-27d20c180aa3?source=rss-d6ea47d11a8c------2">Continue reading on Medium »</a></p></div>]]></description>
            <link>https://medium.com/@abhishekh_15857/unlocking-pythons-magic-for-beginners-lambda-functions-map-and-filter-27d20c180aa3?source=rss-d6ea47d11a8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/27d20c180aa3</guid>
            <dc:creator><![CDATA[Abhishekh]]></dc:creator>
            <pubDate>Sat, 04 Jan 2025 21:15:17 GMT</pubDate>
            <atom:updated>2025-01-04T21:15:17.255Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Python Variables Tutorial for Beginners]]></title>
            <link>https://medium.com/@abhishekh_15857/python-variables-tutorial-for-beginners-70e14535203f?source=rss-d6ea47d11a8c------2</link>
            <guid isPermaLink="false">https://medium.com/p/70e14535203f</guid>
            <dc:creator><![CDATA[Abhishekh]]></dc:creator>
            <pubDate>Fri, 09 Aug 2024 15:30:53 GMT</pubDate>
            <atom:updated>2024-08-09T16:11:47.446Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*If-m4wwfFFEbVQhRqLkf4A.jpeg" /></figure><blockquote><strong>What is a Variable?</strong></blockquote><p>A variable in Python is a reserved memory location to store values. In other words, a variable in a program gives data to the computer for processing.</p><blockquote><strong>Creating Variables</strong></blockquote><p>In Python, you do not need to declare variables before using them or declare their type. To create a variable, you simply assign a value to it using the = operator.</p><pre># Example of creating variables<br>name = &quot;Alice&quot;<br>name</pre><pre>&#39;Alice&#39;</pre><pre># Example of creating variables<br>age = 25<br>age</pre><pre>25</pre><pre># Example of creating variables<br>height = 5.6<br>height</pre><pre>5.6</pre><pre># Example of creating variables<br>is_student = True<br>is_student</pre><pre>True</pre><blockquote><strong>Rules for Naming Variables</strong></blockquote><p>Variable names must start with a letter or an underscore (_).</p><p>The rest of the name can contain letters, numbers, or underscores.</p><p>Variable names are case-sensitive (age, Age, and AGE are three different variables).</p><p><strong>Examples of Valid Variable Names</strong></p><pre>first_name = &quot;John&quot;<br>lastName = &quot;Doe&quot;<br>age_25 = 25<br>_height = 5.8</pre><p><strong>Examples of Invalid Variable Names</strong></p><pre>2name = &quot;Jane&quot;     # Cannot start with a number</pre><pre>first-name = &quot;Doe&quot; # Hyphens are not allowed</pre><pre>@age = 30          # Special characters other than _ are not allowed</pre><blockquote><strong>Variable Types</strong></blockquote><p>Python is a dynamically typed language, which means you don’t have to declare the type of a variable. The interpreter infers the type based on the value assigned.</p><pre># String variable (sequence of characters)<br>name = &quot;Alice&quot;<br>type(name)   #str</pre><pre>str</pre><pre># Integer variable (whole number)<br>age = 25<br>type(age)   #int</pre><pre>int</pre><pre># Float variable (decimal number)<br>height = 5.6<br>type(height)   #float</pre><pre>float</pre><pre># Boolean variable (True or False)<br>is_student = True<br>type(is_student)   #bool</pre><pre>bool</pre><blockquote><strong>Changing Variable Values</strong></blockquote><p>You can change the value of a variable in Python at any time.</p><pre># Initial value<br>age = 25<br><br># Changing the value<br>age = 26<br>print(age)  # Output: 26</pre><pre>26</pre><blockquote><strong>Multiple Assignments</strong></blockquote><p>Python allows you to assign a single value to multiple variables simultaneously.</p><pre># Assigning the same value to multiple variables<br>x = y = z = 10<br>print(x, y, z)  # Output: 10 10 10</pre><pre>10 10 10</pre><pre># Assigning multiple values to multiple variables in one line<br>a, b, c = 1, 2, 3<br>print(a, b, c)  # Output: 1 2 3</pre><pre>1 2 3</pre><blockquote><strong>Using Variables</strong></blockquote><p>Variables can be used to perform operations and store the results</p><pre># Using variables in operations<br>num1 = 10<br>num2 = 5<br>result = num1 + num2<br>print(result)  # Output: 15</pre><pre>15</pre><pre># Concatenating strings<br>first_name = &quot;Alice&quot;<br>last_name = &quot;Johnson&quot;<br>full_name = first_name + &quot; &quot; + last_name<br>print(full_name)  # Output: Alice Johnson</pre><pre>Alice Johnson</pre><blockquote><strong>Lists</strong></blockquote><p>A list is a collection of items in a particular order. Lists are mutable, meaning you can change their contents.</p><pre># Creating an empty list<br>fruits = []<br><br># Adding elements<br>fruits.append(&quot;apple&quot;)<br>fruits.append(&quot;banana&quot;)<br>fruits.append(&quot;cherry&quot;)<br>print(fruits)  # Output: [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;]<br><br># Accessing elements<br>print(fruits[0])  # Output: apple<br><br># Adding another element<br>fruits.append(&quot;orange&quot;)<br>print(fruits)  # Output: [&#39;apple&#39;, &#39;banana&#39;, &#39;cherry&#39;, &#39;orange&#39;]<br><br># Removing an element<br>fruits.remove(&quot;banana&quot;)<br>print(fruits)  # Output: [&#39;apple&#39;, &#39;cherry&#39;, &#39;orange&#39;]</pre><blockquote><strong>NumPy Arrays</strong></blockquote><p>NumPy is a powerful library for numerical computing in Python. NumPy arrays are similar to lists but are designed for scientific computation.</p><pre>import numpy as np<br><br># Creating an empty array<br>empty_array = np.array([])<br><br># Adding elements to the empty array<br># Note: It&#39;s not typical to &quot;append&quot; to numpy arrays because it&#39;s inefficient.<br># Instead, if you know the eventual size, it&#39;s better to initialize to that size or use lists if size is unknown.<br>empty_array = np.append(empty_array, [1, 2, 3, 4, 5])<br>print(empty_array)  # Output: [1. 2. 3. 4. 5.]<br><br># Accessing elements<br>print(empty_array[0])  # Output: 1.0<br><br># Performing operations<br>print(empty_array + 2)  # Output: [3. 4. 5. 6. 7.]<br><br># Creating an array of zeros<br>zeros_array = np.zeros(5)  # Specify the number of elements<br>print(zeros_array)  # Output: [0. 0. 0. 0. 0.]<br><br># Creating an array of ones<br>ones_array = np.ones(5)  # Specify the number of elements<br>print(ones_array)  # Output: [1. 1. 1. 1. 1.]</pre><blockquote><strong>Difference between List and Array</strong></blockquote><p>List: Can store items of different types and is part of the core Python language.</p><p>Array: Usually refers to a NumPy array, which can store items of the same type and is optimized for numerical computations.</p><blockquote><strong>Dictionaries</strong></blockquote><p>A dictionary is a collection of key-value pairs. Dictionaries are mutable and unordered.</p><pre># Creating an empty dictionary<br>person = {}<br><br># Adding key-value pairs<br>person[&quot;name&quot;] = &quot;Alice&quot;<br>person[&quot;age&quot;] = 25<br>person[&quot;city&quot;] = &quot;New York&quot;<br>print(person)  # Output: {&#39;name&#39;: &#39;Alice&#39;, &#39;age&#39;: 25, &#39;city&#39;: &#39;New York&#39;}<br><br># Accessing values<br>print(person[&quot;name&quot;])  # Output: Alice<br><br># Adding another key-value pair<br>person[&quot;email&quot;] = &quot;alice@example.com&quot;<br>print(person)  # Output: {&#39;name&#39;: &#39;Alice&#39;, &#39;age&#39;: 25, &#39;city&#39;: &#39;New York&#39;, &#39;email&#39;: &#39;alice@example.com&#39;}<br><br># Removing a key-value pair<br>del person[&quot;age&quot;]<br>print(person)  # Output: {&#39;name&#39;: &#39;Alice&#39;, &#39;city&#39;: &#39;New York&#39;, &#39;email&#39;: &#39;alice@example.com&#39;}</pre><blockquote><strong>Tuples</strong></blockquote><p>A tuple is a collection of items that is ordered and immutable (cannot be changed).</p><pre># Creating a tuple<br>coordinates = (10, 20)<br><br># Accessing elements<br>print(coordinates[0])  # Output: 10</pre><blockquote>Tuples are immutable, so you cannot change their contents.</blockquote><pre>coordinates[0] = 15  # This will raise an error</pre><blockquote><strong>Mutable vs. Immutable Data Types</strong></blockquote><p>Mutable: Objects that can be changed after creation (e.g., lists, dictionaries).</p><p>Immutable: Objects that cannot be changed after creation (e.g., strings, tuples).</p><blockquote><strong>Examples and Details</strong></blockquote><p>Using Variables in Strings (f-strings):</p><p>Python allows you to embed expressions inside string literals, using {}.</p><pre>name = &quot;Alice&quot;<br>age = 25<br>greeting = f&quot;Hello, my name is {name} and I am {age} years old.&quot;<br>print(greeting)  # Output: Hello, my name is Alice and I am 25 years old.</pre><blockquote><strong>Swapping Variables:</strong></blockquote><p>Python allows you to swap the values of two variables in a single line without using a temporary variable.</p><pre>a = 5<br>b = 10<br>a, b = b, a<br>print(a, b)  # Output: 10 5</pre><blockquote><strong>Using Variables in Lists and Dictionaries:</strong></blockquote><p>Variables can be used to dynamically create and manipulate lists and dictionaries.</p><pre>fruits = [&quot;apple&quot;, &quot;banana&quot;, &quot;cherry&quot;]<br>numbers = {&quot;one&quot;: 1, &quot;two&quot;: 2, &quot;three&quot;: 3}<br><br>favorite_fruit = fruits[0]<br>print(favorite_fruit)  # Output: apple<br><br>number_two = numbers[&quot;two&quot;]<br>print(number_two)  # Output: 2</pre><blockquote><strong>Variable Reassignment:</strong></blockquote><p>Python allows you to reassign variables to different data types.</p><pre>var = &quot;Hello&quot;<br>print(var)  # Output: Hello<br><br>var = 42<br>print(var)  # Output: 42<br><br>var = [1, 2, 3]<br>print(var)  # Output: [1, 2, 3]</pre><blockquote><strong>Augmented Assignment Operators:</strong></blockquote><p>Python supports augmented assignment operators, which are shorthand for updating the value of a variable.</p><pre>x = 10<br>x += 5  # Equivalent to x = x + 5<br>print(x)  # Output: 15<br><br>y = 20<br>y *= 2  # Equivalent to y = y * 2<br>print(y)  # Output: 40</pre><blockquote><strong>Using del to Delete Variables:</strong></blockquote><p>You can delete a variable using the del statement.</p><pre>var = &quot;Hello&quot;<br>print(var)  # Output: Hello<br><br>del var<br># print(var)  # Uncommenting this line will raise an error because var is deleted</pre><blockquote><strong>DataFrame:</strong></blockquote><p>A DataFrame is a two-dimensional, size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). It’s one of the primary data structures used in data science and analytics, particularly with the Python library pandas, which provides powerful tools for data manipulation, analysis, and visualization.</p><p>Here’s a high-level example of how to define a DataFrame, initialize it, and access its elements:</p><pre>import pandas as pd<br><br># Creating a DataFrame<br>data = {<br>    &quot;Name&quot;: [&quot;Alice&quot;, &quot;Bob&quot;, &quot;Charlie&quot;],<br>    &quot;Age&quot;: [25, 30, 35],<br>    &quot;City&quot;: [&quot;New York&quot;, &quot;Los Angeles&quot;, &quot;Chicago&quot;]<br>}<br>df = pd.DataFrame(data)<br><br># Display the DataFrame<br>print(df)<br># Output:<br>#       Name  Age         City<br># 0    Alice   25     New York<br># 1      Bob   30  Los Angeles<br># 2  Charlie   35      Chicago<br><br># Accessing elements<br># Accessing a specific column<br>print(df[&quot;Age&quot;])<br># Output:<br># 0    25<br># 1    30<br># 2    35<br># Name: Age, dtype: int64<br><br># Accessing a specific row by index<br>print(df.iloc[1])  # Access the second row<br># Output:<br># Name      Bob<br># Age        30<br># City Los Angeles<br># Name: 1, dtype: object<br><br># Accessing a specific cell using row and column<br>print(df.at[0, &quot;City&quot;])  # Access the city of the first row<br># Output: New York</pre><blockquote><strong>Practice Exercises</strong></blockquote><p><strong>Exercise 1: Basic Variable Creation</strong></p><p>Create variables to store your name, age, and favorite color. Print these variables.</p><pre># Your code here<br>name = &quot;Your Name&quot;<br>age = 20<br>favorite_color = &quot;Blue&quot;<br><br>print(name)<br>print(age)<br>print(favorite_color)</pre><pre>Your Name<br>20<br>Blue</pre><p><strong>Exercise 2: Operations with Variables</strong></p><p>Create two variables to store numbers. Perform addition, subtraction, multiplication, and division with these numbers and print the results.</p><pre># Your code here<br>num1 = 8<br>num2 = 4<br><br>addition = num1 + num2<br>subtraction = num1 - num2<br>multiplication = num1 * num2<br>division = num1 / num2<br><br>print(addition)        # Output: 12<br>print(subtraction)     # Output: 4<br>print(multiplication)  # Output: 32<br>print(division)        # Output: 2.0</pre><p><strong>Exercise 3: String Concatenation</strong></p><p>Create two string variables for first name and last name. Concatenate them to create a full name and print it.</p><pre># Your code here<br>first_name = &quot;first_name&quot;<br>last_name = &quot;last_name&quot;<br><br>full_name = first_name + &quot; &quot; + last_name<br>print(full_name)   # output: first_name last_name</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=70e14535203f" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>