<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.10.0">Jekyll</generator><link href="https://aritrade1709.github.io/feed.xml" rel="self" type="application/atom+xml" /><link href="https://aritrade1709.github.io/" rel="alternate" type="text/html" /><updated>2026-09-06T18:50:48+00:00</updated><id>https://aritrade1709.github.io/feed.xml</id><title type="html">Aritra De - Curiosity Lab</title><subtitle>I set out to buy ARTIficialintelligence.com… but accidentally ended up with ARITficialintelligence.com —a happy typo blending “ARItra” (me) and “Artificial Intelligence.”  So I turned this into a personal playground for data science experiments, unexpected projects, and creative AI tinkering.</subtitle><author><name>Aritra De</name></author><entry><title type="html">Theory of Linear Regression</title><link href="https://aritrade1709.github.io/linear-regression/" rel="alternate" type="text/html" title="Theory of Linear Regression" /><published>2025-10-18T00:00:00+00:00</published><updated>2025-10-18T00:00:00+00:00</updated><id>https://aritrade1709.github.io/linear-regression</id><content type="html" xml:base="https://aritrade1709.github.io/linear-regression/"><![CDATA[<h1 id="linear-regression-theory">Linear Regression Theory</h1>
<p><img src="/assets/images/Linear_Regression/Theory_of_Linear_Regression-1.webp" alt="Theory_of_Linear_Regression_1" />
<img src="/assets/images/Linear_Regression/Theory_of_Linear_Regression-2.webp" alt="Theory_of_Linear_Regression_2" />
<img src="/assets/images/Linear_Regression/Theory_of_Linear_Regression-3.webp" alt="Theory_of_Linear_Regression_3" />
<img src="/assets/images/Linear_Regression/Theory_of_Linear_Regression-4.webp" alt="Theory_of_Linear_Regression_4" />
<img src="/assets/images/Linear_Regression/Theory_of_Linear_Regression-5.webp" alt="Theory_of_Linear_Regression_5" />
<img src="/assets/images/Linear_Regression/Theory_of_Linear_Regression-6.webp" alt="Theory_of_Linear_Regression_6" />
<img src="/assets/images/Linear_Regression/Theory_of_Linear_Regression-7.webp" alt="Theory_of_Linear_Regression_7" /></p>]]></content><author><name>Aritra De</name></author><summary type="html"><![CDATA[Linear Regression Theory]]></summary></entry><entry><title type="html">Theory of Logistic Regression</title><link href="https://aritrade1709.github.io/logistic-regression/" rel="alternate" type="text/html" title="Theory of Logistic Regression" /><published>2025-10-18T00:00:00+00:00</published><updated>2025-10-18T00:00:00+00:00</updated><id>https://aritrade1709.github.io/logistic-regression</id><content type="html" xml:base="https://aritrade1709.github.io/logistic-regression/"><![CDATA[<h1 id="theory-of-logistic-regression">Theory of Logistic Regression</h1>
<p><img src="/assets/images/Logistic_Regression/Theory_of_Logistic_Regression-1.webp" alt="Theory_of_Logistic_Regression_1" />
<img src="/assets/images/Logistic_Regression/Theory_of_Logistic_Regression-2.webp" alt="Theory_of_Logistic_Regression_2" />
<img src="/assets/images/Logistic_Regression/Theory_of_Logistic_Regression-3.webp" alt="Theory_of_Logistic_Regression_3" />
<img src="/assets/images/Logistic_Regression/Theory_of_Logistic_Regression-4.webp" alt="Theory_of_Logistic_Regression_4" />
<img src="/assets/images/Logistic_Regression/Theory_of_Logistic_Regression-5.webp" alt="Theory_of_Logistic_Regression_5" />
<img src="/assets/images/Logistic_Regression/Theory_of_Logistic_Regression-6.webp" alt="Theory_of_Logistic_Regression_6" /></p>]]></content><author><name>Aritra De</name></author><summary type="html"><![CDATA[Theory of Logistic Regression]]></summary></entry><entry><title type="html">Revisiting Probability Theory for ML</title><link href="https://aritrade1709.github.io/probability-theory-revision/" rel="alternate" type="text/html" title="Revisiting Probability Theory for ML" /><published>2025-10-02T00:00:00+00:00</published><updated>2025-10-02T00:00:00+00:00</updated><id>https://aritrade1709.github.io/probability-theory-revision</id><content type="html" xml:base="https://aritrade1709.github.io/probability-theory-revision/"><![CDATA[<h1 id="probability-theory-revision">Probability Theory Revision</h1>
<p><img src="/assets/images/Probability_Theory/Probability_Theory_Revision-1.webp" alt="Probability_Theory_Revision_1" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-2.webp" alt="Probability_Theory_Revision_2" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-3.webp" alt="Probability_Theory_Revision_3" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-4.webp" alt="Probability_Theory_Revision_4" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-5.webp" alt="Probability_Theory_Revision_5" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-6.webp" alt="Probability_Theory_Revision_6" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-7.webp" alt="Probability_Theory_Revision_7" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-8.webp" alt="Probability_Theory_Revision_8" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-9.webp" alt="Probability_Theory_Revision_9" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-10.webp" alt="Probability_Theory_Revision_10" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-11.webp" alt="Probability_Theory_Revision_11" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-12.webp" alt="Probability_Theory_Revision_12" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-13.webp" alt="Probability_Theory_Revision_13" />
<img src="/assets/images/Probability_Theory/Probability_Theory_Revision-14.webp" alt="Probability_Theory_Revision_14" /></p>]]></content><author><name>Aritra De</name></author><summary type="html"><![CDATA[Probability Theory Revision]]></summary></entry><entry><title type="html">Revisiting Matrix Calculus for ML</title><link href="https://aritrade1709.github.io/matrix-calculus-revision/" rel="alternate" type="text/html" title="Revisiting Matrix Calculus for ML" /><published>2025-09-15T00:00:00+00:00</published><updated>2025-09-15T00:00:00+00:00</updated><id>https://aritrade1709.github.io/matrix-calculus-revision</id><content type="html" xml:base="https://aritrade1709.github.io/matrix-calculus-revision/"><![CDATA[<h1 id="matrix-calculus-revision">Matrix Calculus Revision</h1>
<p><img src="/assets/images/Matrix_Calculus/Matrix_Calculus_Revision-1.webp" alt="Matrix_Calculus_Revision_1" />
<img src="/assets/images/Matrix_Calculus/Matrix_Calculus_Revision-2.webp" alt="Matrix_Calculus_Revision_2" />
<img src="/assets/images/Matrix_Calculus/Matrix_Calculus_Revision-3.webp" alt="Matrix_Calculus_Revision_3" />
<img src="/assets/images/Matrix_Calculus/Matrix_Calculus_Revision-4.webp" alt="Matrix_Calculus_Revision_4" /></p>]]></content><author><name>Aritra De</name></author><summary type="html"><![CDATA[Matrix Calculus Revision]]></summary></entry><entry><title type="html">Revisiting Linear Algbra for ML</title><link href="https://aritrade1709.github.io/linear-algebra-revision/" rel="alternate" type="text/html" title="Revisiting Linear Algbra for ML" /><published>2025-09-14T00:00:00+00:00</published><updated>2025-09-14T00:00:00+00:00</updated><id>https://aritrade1709.github.io/linear-algebra-revision</id><content type="html" xml:base="https://aritrade1709.github.io/linear-algebra-revision/"><![CDATA[<h1 id="linear-algebra-revision">Linear Algebra Revision</h1>

<p><img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-1.webp" alt="Linear Algebra Revision 1" />
<img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-2.webp" alt="Linear Algebra Revision 2" />
<img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-3.webp" alt="Linear Algebra Revision 3" />
<img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-4.webp" alt="Linear Algebra Revision 4" />
<img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-5.webp" alt="Linear Algebra Revision 5" />
<img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-6.webp" alt="Linear Algebra Revision 6" />
<img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-7.webp" alt="Linear Algebra Revision 7" />
<img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-8.webp" alt="Linear Algebra Revision 8" />
<img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-9.webp" alt="Linear Algebra Revision 9" />
<img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-10.webp" alt="Linear Algebra Revision 10" />
<img src="/assets/images/Linear_Algebra/Linear%20Algebra%20Revision-11.webp" alt="Linear Algebra Revision 11" /></p>]]></content><author><name>Aritra De</name></author><summary type="html"><![CDATA[Linear Algebra Revision]]></summary></entry><entry><title type="html">Why We Divide by ( n-1 ) When Calculating Sample Variance</title><link href="https://aritrade1709.github.io/n-minus-1-variance/" rel="alternate" type="text/html" title="Why We Divide by ( n-1 ) When Calculating Sample Variance" /><published>2025-08-10T00:00:00+00:00</published><updated>2025-08-10T00:00:00+00:00</updated><id>https://aritrade1709.github.io/n-minus-1-variance</id><content type="html" xml:base="https://aritrade1709.github.io/n-minus-1-variance/"><![CDATA[<p>If you’ve ever worked with statistics, you’ve probably seen this little quirk in the formula for variance:</p>

\[s^2 = \frac{\sum (x_i - \bar{x})^2}{n - 1}\]

<p>Why <strong>( n - 1 )</strong> instead of just ( n )?<br />
It’s not a random tradition it’s a mathematical correction that makes your estimate <strong>unbiased</strong>. In this post, I’ll show you <strong>two experiments</strong> that make the idea visually clear:</p>

<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>a. one with a normally distributed population, and 

b. one with a non-normal (uniform) population,

c. plus the intuitive theory behind it.
</code></pre></div></div>

<hr />

<h2 id="experiment-1-normally-distributed-population">Experiment 1: Normally Distributed Population</h2>

<p><strong>Setup:</strong></p>
<ul>
  <li>Population: Normally distributed with <strong>mean = 50</strong>, <strong>std = 10</strong>, <strong>size = 50,000</strong>.</li>
  <li>True variance calculated directly from the population.</li>
  <li>Sample sizes: 10 to 100.</li>
  <li>Variance estimated using different divisors:</li>
</ul>

\[n-4,\; n-3,\; n-2,\; n-1,\; n,\; n+1,\; n+2\]

<ul>
  <li>Each sample size repeated <strong>500 times</strong>, and results averaged.</li>
</ul>

<p><strong>Result:</strong></p>

<p><img src="/assets/images/variance_normal.png" alt="Variance Estimator Simulation - Normal Distribution" /></p>

<p>The <strong>red dashed line</strong> is the true variance.<br />
The <strong>red solid line</strong> (dividing by (n-1)) sticks closest to the truth across all sample sizes.<br />
Dividing by (n) <strong>underestimates</strong> variance; using (n-2) or smaller overestimates it.</p>

<p><em>If you want to run the code and play around with the sample size/population/repetitions etc the code and data used to generate the graph above can be found here.</em></p>

<p><a href="https://github.com/aritrade1709/bessels_correction_simulation/blob/main/bessels_correction_simulation.ipynb">View the Jupyter notebook code here</a></p>

<hr />

<h2 id="experiment-2-uniform-population">Experiment 2: Uniform Population</h2>

<p>One might wonder…. <em>what if the population isn’t normal?</em> Does the (n-1) correction still hold?</p>

<p>To check, I repeated the experiment with a <strong>population consisting of the integers 1 to 50,000</strong>.</p>

<p><strong>Result:</strong></p>

<p><img src="/assets/images/variance_uniform.png" alt="Variance Estimator Simulation - Uniform Distribution" /></p>

<p>The pattern is the same:</p>
<ul>
  <li>(n-1) still gives the best unbiased estimate of the true variance.</li>
  <li>Bias from using (n) or other divisors is visible, especially at smaller sample sizes.</li>
</ul>

<p>This tells us that <strong>Bessel’s correction</strong> works regardless of whether the underlying population is normal, uniform, or otherwise. It’s a property of sampling, not of the distribution shape.</p>

<p><em>If you want to run the code and play around with the sample size/population/repetitions etc the code and data used to generate the graph above can be found here.</em></p>

<p><a href="https://github.com/aritrade1709/bessels_correction_simulation/blob/main/bessels_correction_simulation.ipynb">View the Jupyter notebook code here</a></p>

<hr />

<h2 id="why--n---1--works-the-theory">Why ( n - 1 ) Works: The Theory</h2>

<p>When calculating sample variance, we use the <strong>sample mean</strong> ($\bar{x}$) in place of the true population mean ($\mu$).</p>

<p>This introduces a <strong>bias</strong> because:</p>
<ul>
  <li>The deviations from ($\bar{x}$) are, on average, <strong>smaller</strong> than deviations from ($\mu$).</li>
  <li>That’s because ($\bar{x}$) is calculated from the sample itself and “pulls” towards the data points.</li>
</ul>

<p>To correct for this, we divide by (n - 1) instead of (n). This is called <strong>Bessel’s correction</strong>, and it ensures that the expected value of the sample variance equals the true variance.</p>

<hr />

<h2 id="a-simple-intuition-degrees-of-freedom">A Simple Intuition: Degrees of Freedom</h2>

<p>Imagine you have just <strong>two numbers</strong> in your sample.<br />
Once you know the mean, the second number’s deviation is completely determined by the first, there’s no extra “freedom” left. You’ve lost one degree of freedom.</p>

<p>In general:</p>
<ul>
  <li>When estimating the variance, <strong>one degree of freedom</strong> is used up in estimating the mean.</li>
  <li>That’s why you divide by (n - 1) instead of (n).</li>
</ul>

<hr />

<p><a href="https://www.linkedin.com/in/aritra-de/">Connect with me on LinkedIn</a> 
|
<a href="https://medium.com/@aritrade.iitkgp/why-we-divide-by-n-1-when-calculating-sample-variance-7a4dcafdf5f4">I also post on medium</a></p>]]></content><author><name>Aritra De</name></author><summary type="html"><![CDATA[A visual and theoretical explanation of Bessel’s correction with simulations on normal and uniform populations.]]></summary></entry></feed>