<?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 Anand Seetharam, PhD on Medium]]></title>
        <description><![CDATA[Stories by Anand Seetharam, PhD on Medium]]></description>
        <link>https://medium.com/@seetharam.anand?source=rss-c82225d1b421------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*BhEjgGST_V1Tfvye</url>
            <title>Stories by Anand Seetharam, PhD on Medium</title>
            <link>https://medium.com/@seetharam.anand?source=rss-c82225d1b421------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 03:52:41 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@seetharam.anand/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[Recursion: Fibonacci Series]]></title>
            <link>https://medium.com/@seetharam.anand/recursion-fibonacci-series-682da45bfd01?source=rss-c82225d1b421------2</link>
            <guid isPermaLink="false">https://medium.com/p/682da45bfd01</guid>
            <category><![CDATA[algorithms]]></category>
            <category><![CDATA[data-structures]]></category>
            <dc:creator><![CDATA[Anand Seetharam, PhD]]></dc:creator>
            <pubDate>Thu, 26 Jan 2023 20:04:34 GMT</pubDate>
            <atom:updated>2023-01-26T20:04:34.538Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will study recursion using the Fibonacci series. But first, what is a Fibonacci series and why is it interesting?</p><p>The Fibonacci series is an infinite series that looks like this: 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 ….. Basically, one adds the two preceding numbers in the sequence to obtain the next number.</p><p>The Fibonacci series is a mathematical sequence and it appears a lot in nature. For example, one of its first applications was to model the growth of rabbit populations in the 19th century.</p><p>Next, let us turn our attention to what a recursive function does. A <strong>recursive function</strong> is a function that calls itself. It consists of two parts.</p><p><strong>Base case (anchor)</strong></p><ul><li>returns a result without a recursive call (it is the simple case for which the answer is known)</li></ul><p><strong>Recursive case (inductive)</strong></p><ul><li>calls the function itself</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*P-0Kxt71EVywmgkF.jpg" /></figure><p>To understand this concept and to see how this is applied in practice, let us consider the following problem.</p><p><strong>Problem:</strong> Compute the nth value in the Fibonacci series using recursion.</p><pre>double Fib(int n)<br>{<br>    if ( n == 0  || n == 1)<br>        return n;<br>    else<br>        return Fib(n-1) + Fib(n-2);<br>}</pre><p>The above written C++ function <strong><em>Fib(int n)</em></strong> computes the nth Fibonacci number. As one can see from the above code, the base case occurs when <strong><em>n</em></strong> is equal to 0 or <strong><em>n</em></strong> is equal to 1. In the recursive case, the program calls <strong><em>Fib(n — 1) </em></strong>and <strong><em>Fib(n — 2) </em></strong>and adds them together. Note that whenever we implement recursion in code, we must have a function that repeatedly calls itself.</p><blockquote>As an example, when we call <strong>Fib(10)</strong>, it yields 55.</blockquote><p>Now, let us understand the flow of logic in this code. The function <strong>Fib(10) </strong>will call <strong>Fib(9)</strong> and <strong>Fib(8)</strong>, <strong>Fib(9) </strong>in turn will call <strong>Fib(8) </strong>and <strong>Fib(7)</strong>, while <strong>Fib(8) </strong>will call <strong>Fib(7)</strong> and <strong>Fib(6)</strong>. This process will continue for each of these functions until we reach the base case of <strong>n = 0</strong> or<strong> n = 1</strong>, at which point, the function will start returning.</p><p><strong>A Note on Computational Complexity:</strong></p><p>While at first glance determining the Fibonacci Series using recursion might appear as an attractive option, but is <strong>not, </strong>as it is computationally expensive. An <strong><em>iterative</em></strong> approach for calculating a Fibonacci number is computationally efficient and scales linearly with the value of <strong>n</strong>. In comparison, the <strong><em>recursive</em></strong> approach keeps recomputing the Fib( ) function with the same argument values (e.g., <strong>Fib(3)</strong>) multiple times instead of storing the computed value in an array as is done in the iterative approach. This results in the recursive approach for computing the Fibonacci series to have exponential complexity.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=682da45bfd01" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Gentle Introduction to Reinforcement Learning]]></title>
            <link>https://medium.com/@seetharam.anand/a-gentle-introduction-to-reinforcement-learning-5b651866de58?source=rss-c82225d1b421------2</link>
            <guid isPermaLink="false">https://medium.com/p/5b651866de58</guid>
            <category><![CDATA[reinforcement-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Anand Seetharam, PhD]]></dc:creator>
            <pubDate>Thu, 26 Jan 2023 19:24:14 GMT</pubDate>
            <atom:updated>2023-01-26T19:24:14.839Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Reinforcement Learning (RL)</strong> is a sub-field of <strong>artificial intelligence (AI)</strong> in which an <strong>agent</strong> takes actions based on the <strong>numeric reward</strong> it obtains from its environment. As an example, let us assume that an agent is learning to play chess. For the agent to be able to learn how to play, each time it makes a move, it requires some <strong>feedback</strong> on whether the move is bad one or a good one.</p><p>An example of a good move could be when the agent is able to remove one of the pieces of its opponents without losing any of its pieces. At the highest level, this kind of <strong>feedback</strong> is called <strong>reinforcement</strong> and hence the name <strong>reinforcement learning</strong> (because the agent learns based on such reinforcements).</p><p>In reinforcement learning, the agent has a <strong>state space</strong> that it explores, there are a <strong>set of actions</strong> that the agent can take in any particular state, and there is a <strong>reward</strong> associated with the <strong>next state the agent lands into</strong>. <strong>The goal of reinforcement learning is to design the optimal or near-optimal policy based on the rewards received. </strong>Figure 1 provides an overview of reinforcement learning.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*Yk7R1m1oOFS6rueN" /></figure><p>At the highest level, there are two types of reinforcement learning — 1) <strong>passive learning</strong> and 2) <strong>active learning</strong>.</p><p>In <strong>passive learning</strong>, the <em>policy </em>taken in each state is fixed and the goal of the agent is to determine the utilities of being in the different states.</p><p><strong>Active learning</strong> is the more challenging approach where the agent must learn what to do. As the agent is <em>learning the best policy</em> to adopt, it must <strong>explore the environment</strong> in which it is in.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5b651866de58" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[What is an algorithm?]]></title>
            <link>https://medium.com/@seetharam.anand/what-is-an-algorithm-94d03b87042c?source=rss-c82225d1b421------2</link>
            <guid isPermaLink="false">https://medium.com/p/94d03b87042c</guid>
            <category><![CDATA[algorithms]]></category>
            <dc:creator><![CDATA[Anand Seetharam, PhD]]></dc:creator>
            <pubDate>Wed, 25 Jan 2023 02:31:02 GMT</pubDate>
            <atom:updated>2023-01-25T02:31:02.328Z</atom:updated>
            <content:encoded><![CDATA[<p>An algorithm can be defined as a sequence of computational steps that transform an input into an output. An algorithm is a well-defined procedure that takes one set of values as input and produces some or another set of values as output.</p><blockquote>Sometimes, people think that algorithms are similar to recipes. While there are similarities, there are some important differences as well.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*8MTYFkOS3mb75C3g.jpg" /></figure><p><strong>Similarities:</strong></p><p>1. Both take an input and produce an output. For example, in the case of recipes, the input = meat, veggies, while the output = a cooked dish.</p><p>2. Both recipes and algorithms follow a series of steps.</p><p><strong>Differences:</strong></p><p>1. When compared to a recipe, the steps of an algorithm have to be precise. For example, in the case of recipes, one can make imprecise statements such as add a ‘pinch of salt’ or ‘cook for somewhere around 30 to 40 minutes’.</p><p><strong>Examples of an Algorithm:</strong></p><p>Let us define a sorting problem formally, where the objective is to sort a bunch of numbers in ascending order.</p><p><strong><em>Input</em>:</strong> A sequence of numbers &lt;a1, a2, ….., an&gt;</p><p><strong><em>Output</em>:</strong> A permutation or reordering &lt;b1, b2, …., bn&gt; of the input sequence &lt;a1, a2, ….., an&gt; such that b1 ≤ b2 ≤ b3…… ≤ bn.</p><p>For example, for the above problem, an input and corresponding output can be the following.</p><p><strong><em>Input</em>:</strong> &lt;0, 1, -5, 19, -3&gt;</p><p><strong><em>Output</em>:</strong> &lt;-5, — 3, 0, 1, 19&gt;</p><p>This is called an instance of the problem.</p><blockquote>An algorithm is correct if it produces the correct output for each and every input.</blockquote><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FMSyGwYA9AUs%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DMSyGwYA9AUs&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FMSyGwYA9AUs%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="640" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/98aa6a7dc14a4008fd11cc7d1002e7dc/href">https://medium.com/media/98aa6a7dc14a4008fd11cc7d1002e7dc/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=94d03b87042c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Measures of Central Tendency]]></title>
            <link>https://medium.com/@seetharam.anand/measures-of-central-tendency-dc9550bb5603?source=rss-c82225d1b421------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc9550bb5603</guid>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Anand Seetharam, PhD]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 22:04:22 GMT</pubDate>
            <atom:updated>2023-01-24T22:04:22.475Z</atom:updated>
            <content:encoded><![CDATA[<p>In statistics, a measure of central tendency is a single value that attempts to capture the central point of a dataset. The three most common forms of central tendency are the<strong><em> mean</em></strong>, the <strong><em>median</em></strong> and the <strong><em>mode</em></strong>. Let us understand these concepts with a simple example.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*AWGVIUH7XQhzrCwn.jpg" /></figure><p><strong>Example:</strong> Let us consider the following dataset comprising of the age of 15 players in a football team.</p><p><strong>Dataset:</strong> 20, 35, 25, 27, 33, 20, 22, 24, 25, 28, 28, 30, 31, 24, 25</p><p><strong>Mean:</strong> The <strong><em>mean</em></strong> is average of all the values in the dataset.</p><p>In our dataset, mean = (20 + 35 + 25 + 27+ 33 + 20 + 22 + 24 + 25 + 28 + 28 + 30 + 31 + 24 + 25)/15 = <strong>26.44</strong></p><p><strong>Median:</strong> The <strong><em>median</em></strong> is the <strong><em>middle</em></strong> value in the dataset when they arranged in ascending/descending order. In other words, median is that value of the dataset such that 50% of the values are below it.</p><p>Let us arrange the values in our dataset in ascending order. The highlighted value <strong>25</strong> is the median. Note that if the dataset consists of an even set of values, the median is the average of the middle two values.</p><p><strong><em>Ascending Order:</em></strong> 20, 20, 22, 24, 24, 25, 25, <strong>25</strong>, 27, 28, 28, 30, 31, 33, 35</p><p><strong>Mode:</strong> The <strong><em>mode</em></strong> is the <strong><em>most frequently occurring value</em></strong> in the dataset.</p><p>In our dataset, the value 25 occurs the highest number of times (i.e., 3). Therefore, the <strong><em>mode is 25</em></strong>.</p><p>Depending on the type of dataset one is working with, one measure of central tendency can be more relevant than others. For example, if a dataset has some extreme values, median is better measure of central tendency than the mean because the mean will be skewed significantly by these extreme values. Let us look at an example.</p><p><strong>Dataset:</strong> 2, 3, 2, 2, 3, 2, 2, 2, 2, 2, 2, 3, 3, 200, 250</p><p>For this dataset, the <strong><em>mean</em></strong> is <strong><em>32</em></strong> while the <strong><em>median</em></strong> is <strong><em>2</em></strong>. In this scenario, the median is a better measure of central tendency (i.e., where the data is centered) than the mean.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc9550bb5603" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Conditional Probability explained with a simple example]]></title>
            <link>https://medium.com/@seetharam.anand/conditional-probability-explained-with-a-simple-example-9fd9284b7ddc?source=rss-c82225d1b421------2</link>
            <guid isPermaLink="false">https://medium.com/p/9fd9284b7ddc</guid>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Anand Seetharam, PhD]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 21:28:47 GMT</pubDate>
            <atom:updated>2023-01-24T21:28:47.595Z</atom:updated>
            <content:encoded><![CDATA[<p>Let us start with the definition and then look at an example to understand the concept better.</p><p><strong>Definition:</strong> Let <strong><em>E</em></strong> and <strong><em>F</em></strong> be two <strong><em>dependent</em></strong> random variables or events. Probability of E occurring given F has occurred [denoted by<strong> P(E|F)</strong>] is called the <strong><em>conditional probability of E given F</em></strong>.</p><p>Mathematically, this can be written as<strong> P(E∩F) = P(E |F)*P(F)</strong></p><p><strong>Example:</strong> A family has two children. What is the probability that both children are girls given that one of them is a girl?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*XiCHRYETApDYMTNY.png" /></figure><p><strong>Solution:</strong> Let <strong>E</strong> and <strong>F </strong>denote the events that the family has two girls and one girl child, respectively. Here we are interested in determining <strong>P(E|F). </strong>We will look at two ways to solve this problem.</p><p>In the first approach, we consider the sample space. The sample space <strong>S, </strong>which is the set of all possible outcomes is given by <strong>S= [ (b, b), (b, g), (g, b), (g, g)]</strong>. We know that the family has at least one girl child (because the event <strong>F</strong> has occurred). Therefore, the event (b, b) cannot occur.</p><p>Therefore, <strong>P(E|F) = 1/3 </strong>as (g, g) is one of the other three [(b, g), (g, b), (g, g)] possibilities.</p><p>The second way to solve the problem is by using the formula listed in the definition.</p><p>We know, <strong>P(E ∩ F) = 1/4</strong> and <strong>P(F) = 3/4</strong>.</p><p>Therefore, <strong>P(E|F) = P(E ∩ F)/ P(F) = (1/4)/(3/4}) = 1/3</strong></p><p>More information about conditional probability can be found in this video.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FB3OyUD5YDCU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DB3OyUD5YDCU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FB3OyUD5YDCU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/06a767498eb163f9db974658f2bfabd6/href">https://medium.com/media/06a767498eb163f9db974658f2bfabd6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=9fd9284b7ddc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Conditional Probability: Explained with a simple example]]></title>
            <link>https://medium.com/@seetharam.anand/conditional-probability-explained-with-a-simple-example-bda23c927e56?source=rss-c82225d1b421------2</link>
            <guid isPermaLink="false">https://medium.com/p/bda23c927e56</guid>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Anand Seetharam, PhD]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 19:48:25 GMT</pubDate>
            <atom:updated>2023-01-24T19:48:25.710Z</atom:updated>
            <content:encoded><![CDATA[<p>The easiest way to understand conditional probability is to start with the definition and to look at an example.</p><p><strong>Definition:</strong> Let <strong><em>E</em></strong> and <strong><em>F</em></strong> be two <strong><em>dependent</em></strong> random variables or events. Probability of E occurring given that F has occurred [denoted by <strong><em>P(E|F)</em></strong>] is called the <strong><em>conditional probability of E given F</em></strong>.</p><p>P(E ∩ F) = P(E |F)*P(F) .</p><p><strong>Example:</strong> Let’s consider a scenario where there are 20 cards numbered 1 to 20 in a hat. A card is drawn at random from the hat. We are interested in the conditional probability of the card drawn being greater than 15, if we are told that the card drawn is greater than 10.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*s8QOmhWbShH42qCF.jpg" /></figure><p><strong>Solution:</strong> Let <strong>E</strong> and <strong>F </strong>denote the events that the card drawn is greater than 15 and 10, respectively.</p><p>Note that we are interested in determining P(E|F), which is the conditional probability of the card drawn being greater than 15, if one is told that the card drawn is greater than 10.</p><p>Now, <strong>P(E ∩ F) = P(E) = (20–15)/20 = 5/20</strong>, because it denotes the probability that is card drawn is above 15 as well as above 10. As <strong>F</strong> denotes the random variable that the number drawn is greater than 10,</p><p><strong>P(F) = (20–10)/20 = 10/20</strong>.</p><p>Therefore,</p><p><strong>P(E|F) = P(E </strong>∩<strong> F)/ P(F) =(5/20)/(10/20) = 5/10 = 1/2, </strong>which is the value that we are interested in.</p><p>One can learn more about conditional probability in this video.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FB3OyUD5YDCU%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DB3OyUD5YDCU&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2FB3OyUD5YDCU%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/06a767498eb163f9db974658f2bfabd6/href">https://medium.com/media/06a767498eb163f9db974658f2bfabd6/href</a></iframe><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bda23c927e56" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to Markov Chains]]></title>
            <link>https://medium.com/@seetharam.anand/introduction-to-markov-chains-91d33a21aa3e?source=rss-c82225d1b421------2</link>
            <guid isPermaLink="false">https://medium.com/p/91d33a21aa3e</guid>
            <category><![CDATA[probability]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[markov-chains]]></category>
            <dc:creator><![CDATA[Anand Seetharam, PhD]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 18:37:06 GMT</pubDate>
            <atom:updated>2023-01-24T18:37:06.908Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Markov Chain</strong> is a stochastic process where the probability of transitioning from the current state to the next state is only dependent on the current state.</p><p>Let us consider a stochastic process <em>X_n</em>, where <strong>n</strong> = 0, 1, 2,….. can take a finite number of possible values (known as states), usually denoted by a set of non-negative integers (i.e., 0, 1, 2…k). At any time <strong>n</strong>, if<em> X_n </em>=<strong> i</strong>, the process is said to be in state <strong>i</strong>. In the next time instance <strong>(n+1)</strong>, the process can transition from state <strong>i</strong> to another state <strong>j</strong>. Note that the process may continue to remain in state <strong>i</strong> at time <strong>(n+1)</strong> as well, in which case we say that the transition happened from state <strong>i</strong> to state <strong>i</strong>.</p><p>Let <em>P_ij </em>denote the probability of the process transitioning from state <strong>i</strong> to state <strong>j</strong>. <em>P_ij</em> is called the <strong><em>transition probability</em></strong>. We assume that when the process is in state <strong>i</strong>, this probability <em>P_ij</em> is fixed and its value is only dependent on the current state <strong>i</strong> and not on any previous state. Mathematically, this means the following.</p><p><em>P[X_(n+1) = j|X_n = i, X_(n-1) = i_(n-1), … X_0 = i_0] = P[X_(n+1) = j|X_n = i]</em></p><p>where <em>i_(n-1), i_(n-2)….. i_0</em> are the states the process is in at times <strong>(n-1)</strong>, <strong>(n-2)</strong>, …… 0.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*vCsAjAAlI1me3lLH.jpg" /><figcaption>Figure 1: Markov Chain and the Transition Matrix</figcaption></figure><p>Figure 1 above represents a simple 3-state <strong><em>Markov Chain</em></strong> (denoted by states 1, 2 and 3). Let M denote the transition matrix of the Markov chain. For example, in this transition matrix, P₁₁ = 0.5, which means that the probability of staying in state 1 in the next time step (or transitioning from state 1 to state 1) is 0.5. Similarly, P₂₁ = 0.1 ,which means that the probability of transitioning from state 2 to state 1 in the next time step is 0.1. Note that the probabilities in each row add up to 1 because the process has to transition from one state to some other state including itself.</p><p><strong>Modeling the Weather of a City</strong></p><p>Figure 1 could be used to model the weather in a city (Sunny, Cloudy or Rainy) where Sunny, Cloudy and Rainy correspond to states 1, 2 and 3 respectively. The transition probabilities capture the probability of transitioning from one state (e.g., Cloudy) to another state (e.g., Rainy). Note that by modeling the weather in this manner, we assume that the weather in the next day is only dependent on the current day.</p><p><strong><em>Let us assume that today (i.e., Monday), you want use the Markov Model to determine the weather on Thursday.</em></strong> You know that the weather today is Cloudy. We use this knowledge and encode today’s weather in the form of a vector <strong>I = [0, 1, 0]</strong>. We then multiply <strong>I</strong> with <strong>M</strong> (i.e., <strong>I*M</strong>) to find the distribution of the weather tomorrow (i.e., Tuesday) given that it is Cloudy today. By multiplying with the transition matrix <strong>M</strong> thrice (<strong>I*M³</strong>), we will be able to obtain the distribution of what the weather is likely to be on Thursday.</p><p><strong>Steady State Distribution</strong></p><p>Based on the above discussion, a natural question that arises is — what if we want to determine the probability distribution of the weather 1 month (30 days) or 1 year (365 days) in advance? To obtain these distributions, we will have first obtain <strong>M³⁰</strong> and <strong>M³⁶⁵</strong>, respectively. When we perform this multiplication, we observe that all rows of the transition matrix <strong>M</strong> of the Markov Chain have the same probabilities, specifically <strong>[0.294, 0.324, 0.382]</strong>. It means that after a large number of transitions the probability of being in a particular state <strong>j</strong> is independent of the initial state <strong>I</strong> and is a constant. This is referred to as the <strong><em>steady state distribution</em></strong>.</p><p>For our weather model, this result matches with our intuition because the weather on a particular day 1 year later is not dependent on today’s weather and our assessment will only be dependent on the limiting probabilities (i.e., the steady state distribution).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91d33a21aa3e" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bernoulli Random Variables: Expectation and Variance]]></title>
            <link>https://medium.com/@seetharam.anand/bernoulli-random-variables-expectation-and-variance-40e59c5c4204?source=rss-c82225d1b421------2</link>
            <guid isPermaLink="false">https://medium.com/p/40e59c5c4204</guid>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[probability]]></category>
            <dc:creator><![CDATA[Anand Seetharam, PhD]]></dc:creator>
            <pubDate>Tue, 24 Jan 2023 02:29:48 GMT</pubDate>
            <atom:updated>2023-01-24T02:29:48.463Z</atom:updated>
            <content:encoded><![CDATA[<p>A Bernoulli random variable (say X) is a discrete random variable that takes two values — it takes value 1 with probability p and value 0 with probability (1-p).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/0*Mjc7oqzWhkrjFMEk.png" /></figure><p>Tossing a coin once is an example of a Bernoulli random variable. It has two outcomes — heads (say, denoted by 1) that occurs with probability p and tails (denoted by 0) that occurs with probability (1-p). Note that if the coin is a fair coin p = 0.5, otherwise p can take any value between 0 and 1.</p><p>Expectation of discrete random variable is given by</p><p>E[X] = xP[X = x]</p><p>Therefore, the expectation of a Bernoulli random variable is</p><p>E[X] = 1*p + 0*(1-p) = p</p><p>The variance of a discrete random variable is given by,</p><p>Var(X) = E[X²] — E²[X]</p><p>Now, E[X²] = 1*p + 0*(1-p) = p</p><p>Therefore, the variance of a Bernoulli random variable is</p><p>Var(X) = p-p² = p(1-p)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=40e59c5c4204" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A Gentle Introduction to Markov Blanket]]></title>
            <link>https://medium.com/@seetharam.anand/a-gentle-introduction-to-markov-blanket-cefc5ce4fcab?source=rss-c82225d1b421------2</link>
            <guid isPermaLink="false">https://medium.com/p/cefc5ce4fcab</guid>
            <category><![CDATA[artificial-intelligence]]></category>
            <category><![CDATA[markov-blanket]]></category>
            <dc:creator><![CDATA[Anand Seetharam, PhD]]></dc:creator>
            <pubDate>Mon, 23 Jan 2023 17:27:02 GMT</pubDate>
            <atom:updated>2023-01-23T18:19:07.043Z</atom:updated>
            <content:encoded><![CDATA[<p>In a Bayesian network, the <strong><em>Markov Blanket</em></strong> of a node<strong> X </strong>is the set of nodes comprising of <strong>X</strong>’s parents, its children and its co-parents.</p><p><strong>Definition</strong>: <strong><em>Co-parents</em></strong> of a node are the parents of its children.</p><p>Let us consider a Bayesian network as shown in Figure 1.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gbkuwWVqUjiYwptI.jpg" /><figcaption>Figure 1: Complete Network</figcaption></figure><p>Let us now find out the Markov Blanket of X₄, the node highlighted in red in Figure 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cvdhuQ6zzv0MQ_Aq.jpg" /><figcaption>Figure 2: The highlighted node for which we want to find the Markov Blanket</figcaption></figure><p>Figure 3 shows the Markov Blanket of X₄. X₁ and X₂ are the <strong><em>parents</em></strong> of X₄ , X₇ and X₉ are the <strong><em>children</em></strong> of X₄, while X₆ is the <strong><em>co-parent</em></strong> of X₄.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*xxtT65hewn9IUswr.jpg" /><figcaption>Figure 3: The Markov Blanket</figcaption></figure><h4>Utility of Markov Blanket</h4><p>In a Bayesian network, a node <strong>X</strong> is conditionally independent of all other nodes in the network given the Markov blanket. Additionally, the Markov blanket d-separates <strong>X</strong> from all other nodes in the network.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cefc5ce4fcab" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>