<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Technical on Sandeep Gangarapu</title>
    <link>https://sandeepgangarapu.com/tags/technical/</link>
    <description>Recent content in Technical on Sandeep Gangarapu</description>
    <image>
      <title>Sandeep Gangarapu</title>
      <url>https://sandeepgangarapu.com/images/profile/vivekkrishnanphotography-6_websize.jpg</url>
      <link>https://sandeepgangarapu.com/images/profile/vivekkrishnanphotography-6_websize.jpg</link>
    </image>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sat, 29 Oct 2022 15:30:00 -0600</lastBuildDate>
    <atom:link href="https://sandeepgangarapu.com/tags/technical/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Essays on Causal Inference</title>
      <link>https://sandeepgangarapu.com/blog/essays-on-causal-inference/</link>
      <pubDate>Sat, 29 Oct 2022 15:30:00 -0600</pubDate>
      <guid>https://sandeepgangarapu.com/blog/essays-on-causal-inference/</guid>
      <description>&lt;h2 id=&#34;the-fundamental-problem-of-causal-inference&#34;&gt;The fundamental problem of causal inference&lt;/h2&gt;
&lt;p&gt;You probably know the COVID-19 pandemic and the race between all the pharma companies to create a vaccine. There was a lot of talk about different phases of clinical trials and the effectiveness of various vaccines. In clinical trials, companies are trying to estimate the causal effect of giving a drug on patient&amp;rsquo;s health.&lt;/p&gt;
&lt;figure class=&#34;align-center &#34;&gt;
    &lt;img loading=&#34;lazy&#34; src=&#34;https://sandeepgangarapu.com/images/blog/technical/essay-1-the-fundamental-problem-of-causal-inference/coronavirus.png#center&#34;
         alt=&#34;Coronavirus illustration&#34;/&gt; 
&lt;/figure&gt;

&lt;figure class=&#34;align-center &#34;&gt;
    &lt;img loading=&#34;lazy&#34; src=&#34;https://sandeepgangarapu.com/images/blog/technical/essay-1-the-fundamental-problem-of-causal-inference/flask.png#center&#34;
         alt=&#34;Flask illustration&#34;/&gt; 
&lt;/figure&gt;

&lt;p&gt;Causal effect is the difference between what happened if the treatment was given and what would have happened if the treatment was not given&lt;/p&gt;</description>
    </item>
    <item>
      <title>Under null hypothesis, p-values are uniformly distributed</title>
      <link>https://sandeepgangarapu.com/blog/under-null-hypothesis-p-values-are-uniformly-distributed/</link>
      <pubDate>Thu, 06 Oct 2022 16:44:00 -0600</pubDate>
      <guid>https://sandeepgangarapu.com/blog/under-null-hypothesis-p-values-are-uniformly-distributed/</guid>
      <description>&lt;p&gt;Central limit theorem states that sample means follow normal distribution. People often confuse this with and question the validity of uniform distribution of p-values under nul hypothesis. Should we not be observing extreme p-values much less ofter than usual pvalues like 0.2 or 0.3?&lt;/p&gt;
&lt;p&gt;Imagine if null hypothesis is true. This means there is no difference betweem treatment and control.&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;numpy&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;as&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;np&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;pandas&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;as&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;pd&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;statsmodels.api&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;as&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;sm&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;from&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;scipy&lt;/span&gt; &lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;stats&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;kn&#34;&gt;import&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class=&#34;k&#34;&gt;as&lt;/span&gt; &lt;span class=&#34;nn&#34;&gt;plt&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;pval_lis&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;t_stat_lis&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;samp_mean_lis&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;p&#34;&gt;[]&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;k&#34;&gt;for&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;i&lt;/span&gt; &lt;span class=&#34;ow&#34;&gt;in&lt;/span&gt; &lt;span class=&#34;nb&#34;&gt;range&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;100000&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;):&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;sample&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;np&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;random&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;normal&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;0&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;1&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;mi&#34;&gt;10&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;samp_mean&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;sample&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;mean&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;samp_mean_lis&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;append&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;samp_mean&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;t_stat&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;sample&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;mean&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sample&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;std&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;()&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;/&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;np&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sqrt&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sample&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;size&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;t_stat_lis&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;append&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;t_stat&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;pval&lt;/span&gt; &lt;span class=&#34;o&#34;&gt;=&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;stats&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;t&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sf&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;nb&#34;&gt;abs&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;t_stat&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;),&lt;/span&gt; &lt;span class=&#34;n&#34;&gt;df&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;=&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;sample&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;size&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;*&lt;/span&gt;&lt;span class=&#34;mi&#34;&gt;2&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;    &lt;span class=&#34;n&#34;&gt;pval_lis&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;append&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;pval&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;)&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-python&#34; data-lang=&#34;python&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;plt&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;hist&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;np&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;.&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;array&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;(&lt;/span&gt;&lt;span class=&#34;n&#34;&gt;samp_mean_lis&lt;/span&gt;&lt;span class=&#34;p&#34;&gt;))&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;figure class=&#34;align-center &#34;&gt;
    &lt;img loading=&#34;lazy&#34; src=&#34;https://sandeepgangarapu.com/images/blog/technical/under-null-hypothesis-p-values-are-uniformly-distributed/output_2_1.png#center&#34;
         alt=&#34;Histogram of sample means&#34;/&gt; &lt;figcaption&gt;
            &lt;p&gt;Distribution of sample means&lt;/p&gt;</description>
    </item>
    <item>
      <title>Practical significance is the North Star</title>
      <link>https://sandeepgangarapu.com/blog/practical-significance-is-the-north-star/</link>
      <pubDate>Wed, 03 Mar 2021 06:53:00 -0600</pubDate>
      <guid>https://sandeepgangarapu.com/blog/practical-significance-is-the-north-star/</guid>
      <description>&lt;p&gt;Practical significance is the North Star. 🌟&lt;/p&gt;
&lt;h3 id=&#34;why-experiment&#34;&gt;Why experiment?&lt;/h3&gt;
&lt;p&gt;At the end of the day we want to know if treatment is better than control and whether changing the status quo is worth it. That is why we do experimentation or derive inference from observational data. Being better is not enough to take a practical decision. Is it worth changing the status quo? Both go in conjunction. That&amp;rsquo;s where practical significance comes in.&lt;/p&gt;</description>
    </item>
    <item>
      <title>A layman&#39;s explanation of Law of Large numbers</title>
      <link>https://sandeepgangarapu.com/blog/a-laymans-explanation-of-law-of-large-numbers/</link>
      <pubDate>Thu, 17 Dec 2020 17:50:00 -0600</pubDate>
      <guid>https://sandeepgangarapu.com/blog/a-laymans-explanation-of-law-of-large-numbers/</guid>
      <description>&lt;p&gt;The first step is to nail their intuition for randomness. Here&amp;rsquo;s how I will do it.&lt;/p&gt;
&lt;p&gt;I will ask them &lt;em&gt;if I flip a coin once, will it be heads or tails&lt;/em&gt;. The answer would be &lt;em&gt;It will be heads!&lt;/em&gt; or &lt;em&gt;It can be either!&lt;/em&gt; (smart kid). If it is former, I can prove them wrong in 1-3 tries and lay the path for explaining randomness. If it is later, they already have some intuition for randomness.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Who and when should one use Multi-Armed Bandits? A scenario.</title>
      <link>https://sandeepgangarapu.com/blog/who-and-when-should-one-use-multi-armed-bandits-a-scenario/</link>
      <pubDate>Sun, 11 Oct 2020 23:13:00 -0600</pubDate>
      <guid>https://sandeepgangarapu.com/blog/who-and-when-should-one-use-multi-armed-bandits-a-scenario/</guid>
      <description>&lt;blockquote&gt;
&lt;p&gt;💡 This is a humor piece. I am using the scenario to communicate the use of MAB&amp;rsquo;s. Please take it with a pinch of salt.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;A manager at a tech company that sells Alphonso mangoes online is stuck with one of the most difficult decisions. What should the color of the &amp;ldquo;Buy Now&amp;rdquo; button be? She recently came to know that data-driven decision making is the new fad and wants to follow suit. She has a meeting with her team of data scientists and marketing folks.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Thompson Sampling Algorithm for Normal outcome distribution</title>
      <link>https://sandeepgangarapu.com/blog/thompson-sampling-algorithm-for-normal-outcome-distribution/</link>
      <pubDate>Thu, 10 Sep 2020 21:46:00 -0600</pubDate>
      <guid>https://sandeepgangarapu.com/blog/thompson-sampling-algorithm-for-normal-outcome-distribution/</guid>
      <description>&lt;p&gt;Thompson Sampling is one of the most popular Multi-Armed bandit (MAB) algorithms - the main reason being its explainability (imagine explaining upper confidence bound to your manager) and decent performance in practice [1].&lt;/p&gt;
&lt;p&gt;Many blog posts on the Internet show how to implement Thompson sampling (&lt;a href=&#34;https://visualstudiomagazine.com/articles/2019/06/01/thompson-sampling.aspx&#34;&gt;here&lt;/a&gt;, &lt;a href=&#34;https://towardsdatascience.com/hompson-sampling-for-multi-armed-bandit-problems-part-1-b750cbbdad34&#34;&gt;here&lt;/a&gt;, &lt;a href=&#34;https://peterroelants.github.io/posts/multi-armed-bandit-implementation/&#34;&gt;here&lt;/a&gt; and &lt;a href=&#34;https://medium.com/analytics-vidhya/multi-armed-bandit-analysis-of-thompson-sampling-algorithm-6375271f40d1&#34;&gt;here&lt;/a&gt;). Almost all of them consider Bernoulli outcome distribution (e.g. click or no click, purchase, or no purchase) and use the Beta-Bernoulli Bayesian update procedure for simulations and usually compare the performance (Regret) to other MAB algorithms like UCB or sometimes to A/B testing. However, none of them consider Gaussian outcome distribution and especially the case when both mean and variance of the distributions are unknown (which is usually the case when you are conducting an experiment where the outcome is continuous, ex: dollars spent, time spent, etc.).&lt;/p&gt;</description>
    </item>
    <item>
      <title>Learning Resources</title>
      <link>https://sandeepgangarapu.com/blog/learning-resources-collection/</link>
      <pubDate>Tue, 18 Aug 2020 00:00:00 -0600</pubDate>
      <guid>https://sandeepgangarapu.com/blog/learning-resources-collection/</guid>
      <description>&lt;p&gt;Over the years, I have come across multiple resources I learned things from with ease. This is a page to track those resources. Please &lt;a href=&#34;https://sandeepgangarapu.com/about/&#34;&gt;reach out to me&lt;/a&gt; if you think something belongs to this list. I will add it.&lt;/p&gt;
&lt;h3 id=&#34;general&#34;&gt;General&lt;/h3&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;a href=&#34;https://wizardzines.com/&#34;&gt;Julia Evans&lt;/a&gt; has online zines for topics ranging from SQL, Shell scripts to Linux. These are hand-drawn explanations of stuff related to a particular topic. I stumbled upon here twitter post about how SQL actually executes a query and have been a fan ever since.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
