<?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 Sean Atukorala on Medium]]></title>
        <description><![CDATA[Stories by Sean Atukorala on Medium]]></description>
        <link>https://medium.com/@SeanAT19?source=rss-76ab560d7a92------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*OC_jGZN-GeQJ9mlLSMFJAg.jpeg</url>
            <title>Stories by Sean Atukorala on Medium</title>
            <link>https://medium.com/@SeanAT19?source=rss-76ab560d7a92------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 20 Nov 2026 23:33:52 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@SeanAT19/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[Strangers to Ourselves by Timothy D Wilson — Book Review]]></title>
            <link>https://medium.com/@SeanAT19/strangers-to-ourselves-by-timothy-d-wilson-book-review-358b0813bc29?source=rss-76ab560d7a92------2</link>
            <guid isPermaLink="false">https://medium.com/p/358b0813bc29</guid>
            <category><![CDATA[self-help]]></category>
            <category><![CDATA[free-will]]></category>
            <category><![CDATA[psychology]]></category>
            <category><![CDATA[unconscious-mind]]></category>
            <category><![CDATA[book-review]]></category>
            <dc:creator><![CDATA[Sean Atukorala]]></dc:creator>
            <pubDate>Sun, 28 Jan 2024 01:58:00 GMT</pubDate>
            <atom:updated>2024-01-28T01:58:00.863Z</atom:updated>
            <content:encoded><![CDATA[<h3>Strangers to Ourselves by Timothy D Wilson — Book Review</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1S-UtSraS-QOrbfsw2ESPA.jpeg" /></figure><p>The book Stranger to Ourselves by Timothy D. Wilson is largely about the concept of self-knowledge in psychology, the limitations of self-knowledge, scientific research on self-knowledge, and an in-depth analysis of the term <em>adaptive unconscious </em>and the immense role that the unconscious mind plays in our day-to-day thinking and decision-making.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/238/1*vZ5wIDxvyu-gKJyAkl64eg.jpeg" /><figcaption>Figure 1: Book cover</figcaption></figure><p>Secondly, the book dwells on the duality between the conscious and unconscious minds and the question of which of the two minds is truly in charge of our daily thinking and decision-making. While most people regard the conscious mind as dominating over the unconscious, this book argues that the opposite is actually the case. It states that the majority of our decision-making is largely influenced by our unconscious minds. However, it makes clear that the conscious mind is not completely out of the decision-making boardroom of the mind; its role is minor in comparison to the unconscious mind.</p><p>Third, and perhaps the most important message of the book, is that the conscious mind can influence the unconscious mind, or what Wilson calls the <em>adaptive unconscious,</em> to direct and control the way in which the <em>adaptive unconscious</em> mind operates. To do this, the author details a tangible technique in which the “conscious captain” can steer the “<em>adaptive unconscious</em> ship” of the mind. It is called the “do good, be good” strategy, wherein the person instantly does the desired behavior persistently and frequently enough such that the <em>adaptive unconscious</em> mind molds itself to the newly enforced behavior driven by the person’s conscious mind.</p><p>There are several things I like about this book:</p><ul><li>The message of the conscious mind being able to influence the <em>adaptive unconscious</em> mind gives off a sense of free will, autonomy, and self-empowerment.</li><li>The “do good, be good” strategy is highly reminiscent of the <a href="https://newparadigmadvisors.com/the-be-do-have-principle/">“Be-Do-Have” principle</a> touted by many contemporary self-help gurus, which is testament to its credibility as a tool of effective and lasting behavior and self-identify change.</li><li>The last chapter of the book highlights the focus on a change of self-identity and self-narrative to a more self-empowered, future-self-oriented, and realistic strategy, which I find inspiring.</li></ul><p>In closing, this book is a two-in-one: a self-help book and a science book. A great read!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=358b0813bc29" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to make API requests using Volley for Android App Development]]></title>
            <link>https://medium.com/@SeanAT19/how-to-make-api-requests-using-volley-for-android-app-development-4eb9e58ea63?source=rss-76ab560d7a92------2</link>
            <guid isPermaLink="false">https://medium.com/p/4eb9e58ea63</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[volley]]></category>
            <category><![CDATA[api-request]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Sean Atukorala]]></dc:creator>
            <pubDate>Fri, 16 Jun 2023 17:58:26 GMT</pubDate>
            <atom:updated>2023-06-16T17:58:26.903Z</atom:updated>
            <content:encoded><![CDATA[<p>In this blog post we’ll go over how to make API requests using the <a href="https://google.github.io/volley/">Volley Android library</a>, for Android app development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*MuSZDDp-GuuoA2RKxWq-KA.jpeg" /></figure><h3>Steps for sending an API request using Volley:</h3><ol><li>Instantiate the RequestQueue object. This <a href="https://javadoc.io/doc/com.android.volley/volley/1.1.1/com/android/volley/RequestQueue.html">RequestQueue</a> object does two things: transports requests along a network and caches the requests sent along it. The network that Volley uses by default is the <a href="https://javadoc.io/static/com.android.volley/volley/1.1.1/com/android/volley/toolbox/BasicNetwork.html">BasicNetwork</a>class. Here is an example of a RequestQueue object being instantiated:</li></ol><pre>RequestQueue queue = Volley.newRequestQueue(this);</pre><p>2. Create a request using Request Constructors. The four parameters that they use are in the following order: HTTP Request type, Request URL, the Success response listener, the Error response listener. Here is an example code snippet demonstrating the use of the StringRequest request constructor:</p><pre>StringRequest stringRequest = new StringRequest(Request.Method.GET, URL,<br>            new Response.Listener&lt;String&gt;() {<br>    @Override<br>    public void onResponse(String response) {<br>        // Display the first 500 characters of the response string.<br>    }<br>    }, new Response.ErrorListener() {<br>        @Override<br>        public void onErrorResponse(VolleyError error) {<br>        }<br>    });</pre><p>3. Add the request to the RequestQueue object via the following command:</p><pre>queue.add(request);</pre><p>After running the above command, Volley will send the API request immediately. If it is a success, the success callback function will be triggered(the 3rd argument in the StringRequest() object). If it fails, then the error callback function will be executed(the 4th argument in the StringRequest() object)</p><p>That is all that is required to send an API request using the Volley Android Library. I hope this tutorial was helpful!</p><h3>Conclusion</h3><p>Thanks for reading this blog post!</p><p>If you have any questions or concerns please feel free to post a comment in this post and I will get back to you when I find the time.</p><p>If you found this article helpful please share it and make sure to follow me on <a href="https://twitter.com/SeanAtukorala">Twitter </a>and <a href="https://github.com/ShehanAT">GitHub</a>, connect with me on <a href="https://www.linkedin.com/in/shehan-atukorala-8631491a5/">LinkedIn</a> and subscribe to my <a href="https://www.youtube.com/channel/UCtxed_NljgtAXrQMMdLvhrQ">YouTube channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4eb9e58ea63" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introductory Probability Concepts Explained]]></title>
            <link>https://medium.com/@SeanAT19/introductory-probability-concepts-explained-3a78ae0be513?source=rss-76ab560d7a92------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a78ae0be513</guid>
            <category><![CDATA[conditional-probability]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[probability]]></category>
            <dc:creator><![CDATA[Sean Atukorala]]></dc:creator>
            <pubDate>Thu, 18 May 2023 01:39:38 GMT</pubDate>
            <atom:updated>2023-05-18T01:39:38.684Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TaYDP9LNMpnlgcUFLwddBA.jpeg" /></figure><p>Here are some brief definitions of some introductory probability concepts:</p><ul><li><strong>Discrete Probability Distributions</strong>: Is a type of probability distribution where a given random variable can only take on values defined in a specified set.</li><li>An example of a discrete probability distribution is the classic coin toss experiment where the only two possible outcomes are either heads or tails.</li><li><strong>Continuous Probability Distributions</strong>: Is a type of probability distribution where a given random variable x can take on a potentially infinite number of possible values. Accordingly, the probability associated with any specific value of a continuous distribution is null. This means that continuous distributions can only be described in terms of probability density. This density can be converted into the probability that a value will fall within a certain range.</li><li>An example of a continuous probability distribution is the calculation that a given man is within 65 to 70 inches in terms of height. The output of this calculation would be a numerical and discrete probability, but the man’s exact height will never be known.</li><li><strong>Discrete Uniform Distribution</strong>: In a set of integer values that occur in the same frequency, all the integers 1 through k(where k is the last integer in the set) must occur with equal probability. This is known as Discrete Uniform Distribution.</li><li><strong>Conditional Probability</strong>: Is the probability of event A occurring given that event B has occurred. Or put more generally, it is the likelihood of an outcome occurring based on the occurrence of a previous outcome.</li><li>The example defined above can be written mathematical as P(A | B).</li><li>From here, if the events A and B are independent then the conditional probability of A given B works out to just the probability of B(P(B)).</li><li>If the events A and B are not independent then the conditional probability of A given B can be derived by solving the following equation: P(A | B) = P(B ∩ A) / P(B)</li><li><strong>Probability Axioms</strong>: These are some presupposed true statements(which is the meaning of the term ‘axiom’) about probability. Let’s quickly go over three probability axioms:</li></ul><ol><li><strong>Probability of Event</strong>: This axiom states that the probability of any event is always between 0 and 1. The probability can also be either 0 or 1. This probability is derived by dividing the number of outcomes of the specific event by the total number of outcomes in <a href="https://www.mathsisfun.com/definitions/sample-space.html">the sample space</a></li><li><strong>Probability of Sample Space</strong>: This axiom states that given multiple different events that have unique probabilities, when we add up all the probability values of all the events, the final result should equal 1. This value of 1 is the probability for the entire sample space.</li><li><strong>Mutually Exclusive Events</strong>: This axiom states that two given events, let’s say A and B, cannot occur together. Differently stated, their intersection is null. Note that although A and B are <a href="https://www.mathsisfun.com/data/probability-events-mutually-exclusive.html">mutually exclusive</a> from each other, they are not complements of each other</li></ol><ul><li><strong>Multiplication Rule of Probability</strong>: Is a rule that states: The probability of some events C and D occurring is equal to the product of the probability of D occurring and the conditional probability of C given D occurring.</li><li>Here is the mathematical formula for it: P(C ∩ D) = P(D) . P(C|D)</li><li><strong>Addition Rule of Probability</strong>: Is a rule that states: The probability of two events, say C and D, is the sum of those two events minus the probability of both events happening.</li><li>Here is the mathematical formula for it: P(C ∪ D) = P (C) + P(D) - P(C ∩ D)</li></ul><h3>Conclusion</h3><p>Thanks for reading this blog post!</p><p>If you have any questions or concerns please feel free to post a comment in this post and I will get back to you if I find the time.</p><p>If you found this article helpful please share it and make sure to follow me on <a href="https://twitter.com/SeanAtukorala">Twitter </a>and <a href="https://github.com/ShehanAT">GitHub</a>, connect with me on <a href="https://www.linkedin.com/in/shehan-atukorala-8631491a5/">LinkedIn</a> and subscribe to my <a href="https://www.youtube.com/channel/UCtxed_NljgtAXrQMMdLvhrQ">YouTube channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a78ae0be513" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Scaling and Normalization in Machine Learning]]></title>
            <link>https://medium.com/@SeanAT19/scaling-and-normalization-in-machine-learning-18d405d43b11?source=rss-76ab560d7a92------2</link>
            <guid isPermaLink="false">https://medium.com/p/18d405d43b11</guid>
            <category><![CDATA[normalization]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-cleaning]]></category>
            <category><![CDATA[scaling]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Sean Atukorala]]></dc:creator>
            <pubDate>Sat, 13 May 2023 21:49:06 GMT</pubDate>
            <atom:updated>2023-05-13T21:49:06.988Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1vlQA8NKYzpQ9l2wzFuuPg.jpeg" /><figcaption>Figure 1: Introduction image featuring nature scenery</figcaption></figure><p>Here is the basic gist of what Scaling and Normalization in Machine Learning refers to:</p><p><strong>Scaling </strong>is where you change the range of your data.</p><p><strong>Normalization </strong>is where you’re changing the shape of the distribution of your data.</p><p>Now let’s describe these two terms in more detail…</p><h3>Scaling</h3><p>Scaling is when you can transform whatever data you have to fit a pre-defined scale or range. For example if the x-axis values in some original dataset ranges from 0 to 10, the ranges will change after using a scaler such as Min Max Scaling.</p><p>In the case of using the minmax_scaling() method, the range afterwards will go from 0 to 1, such that all values that previously lay between 0 and 10 now lay between 0 and 1, while the proportions/ratios between the values are preserved despite the changes to the scaling.</p><p>There are various types of scaling such as <a href="https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MinMaxScaler.html">Min Max Scaling</a>, <a href="https://subscription.packtpub.com/book/data/9781789806311/8/ch08lvl1sec70/performing-mean-normalization">Mean Normalization</a>, <a href="https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.MaxAbsScaler.html">Max Absolute Scaling</a> and <a href="https://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.RobustScaler.html">Robust Scaling</a></p><p>Here is an example of Scaling using the MinMaxScaler():</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/698/1*W4vFWHA_F9TdYRJlMZUTUQ.png" /><figcaption>Figure 2: An example of Scaling using the MinMaxScaler()</figcaption></figure><p>And <a href="https://www.kaggle.com/code/seanatukorala/min-max-scaling-example">here is the Kaggle Notebook link</a> that produced the above scatter plot</p><h3>Normalization</h3><p>Normalization is a more extreme version of scaling such that it not only changes the range of the data in question but also fits the data into a <a href="https://en.wikipedia.org/wiki/Normal_distribution">normal distribution</a>. Doing so will change the shape of the data when graphed, with the fully normalized version looking highly similar to a normal distribution(also known as a bell curve).</p><p>There are various types of normalization such as <a href="https://www.statology.org/z-score-normalization/">Z-Score Normalization</a>(Also known as Standardization) and <a href="https://www.statisticshowto.com/probability-and-statistics/normal-distributions/box-cox-transformation/">Box Cox Transformation</a>.</p><p>Here is an example of Normalization using BoxCox Transformation:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/578/1*qFSLhD-6bWNfPZ-3G4GljA.png" /><figcaption>Figure 3: An example of Normalization using BoxCox Transformation</figcaption></figure><p>And <a href="https://www.kaggle.com/seanatukorala/boxcox-transformation-example">here is the Kaggle Notebook link</a> that produced the above dist plot</p><h3>Similarities between Scaling and Normalization:</h3><p>There are many similarities between Scaling and Normalization and here are a few of them:</p><ul><li>Both techniques are used to transform numeric values</li><li>Both techniques are part of the broader practice of data cleaning in machine learning</li><li>Both techniques are only applied to numeric data</li></ul><h3>Differences between Scaling and Normalization:</h3><p>There are also many differences between Scaling and Normalization. Here are a few of them:</p><ul><li>Scaling changes the range of the data and keeps the shape of the distribution unaffected</li><li>Normalization changes the shape of the distribution and keeps the range of the data unaffected</li><li>Scaling not just changes the range of the data, it can also shrink and stretch the data to fit within a given range</li><li>Normalization adjusts the numeric values of the data to a common scale while leaving the range unaffected</li></ul><h3>Conclusion</h3><p>Thanks for reading this blog post!</p><p>If you have any questions or concerns feel free to post a comment in this post and I will get back to you if I find the time.</p><p>If you found this article helpful feel free share it and make sure to follow me on <a href="https://twitter.com/SeanAtukorala">Twitter </a>and <a href="https://github.com/ShehanAT">GitHub</a>, connect with me on <a href="https://www.linkedin.com/in/shehan-atukorala-8631491a5/">LinkedIn</a> and subscribe to my <a href="https://www.youtube.com/channel/UCtxed_NljgtAXrQMMdLvhrQ">YouTube channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=18d405d43b11" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Handling Missing Values in Datasets for Machine Learning/Data Science]]></title>
            <link>https://medium.com/@SeanAT19/handling-missing-values-in-datasets-for-machine-learning-data-science-1383d66715f5?source=rss-76ab560d7a92------2</link>
            <guid isPermaLink="false">https://medium.com/p/1383d66715f5</guid>
            <category><![CDATA[data-cleaning]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Sean Atukorala]]></dc:creator>
            <pubDate>Sun, 07 May 2023 18:44:25 GMT</pubDate>
            <atom:updated>2023-05-07T18:44:25.622Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rryE7gp2b514X_8LDUvvJA.jpeg" /></figure><p>A key and vital part of data cleaning for Machine Learning and Data Science is knowing how to handle missing values in datasets.</p><p>This blog post will show three methods of handling missing values in datasets. But before we get into that main topic, let’s attempt to answer another important question:</p><h3>Why is the data missing?</h3><p>An important preliminary step in data cleaning is the use of your own intuition in trying to figure out why the missing values in a given dataset are indeed missing.</p><p>This involves the use of what is called ‘Data Intuition’. This skill consists of thoroughly looking at the dataset, establishing why it is in its current state and how this current state will affect your analysis.</p><p>One important question to ask yourself while in the process of ‘data intuiting’ is:</p><blockquote>Is this value missing because it wasn’t recorded or because it doesn’t exist?</blockquote><p>Answering the above question will clarify whether to fill in a missing value via Imputation or drop the missing value from the dataset altogether.</p><p>In case you aren’t sure, Imputation is the practice of estimating what the missing values should be by basing them on other values in the same column and row of a given dataset.</p><h3>Ways for handling missing values:</h3><ol><li><strong>Drop the missing values:</strong> This option is not the most optimal in terms of dataset accuracy but if you’re in a rush, it can be a viable method of handing missing data. The <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.dropna.html">dropna()</a> method can be used for this purpose. When using it without passing in any arguments(or axis=0), it will delete any rows containing at least one missing value, whereas including the axis=1 argument will delete all columns containing at least one missing value. Also, the inplace=True argument is required if you need to drop some data in the current dataset itself, otherwise a new dataset containing the remaining values will be returned. Here is an example of its usage:</li></ol><pre>sample_dataset.dropna(axis=0, inplace=True)</pre><h3>🗈 <strong>Note</strong>:</h3><blockquote>The total number of columns in a dataset can be revealed through the shape[1] attribute. For example:</blockquote><pre>sample_dataset.shape[1]<br># Outputs the number of columns in the dataset</pre><blockquote>The total number of rows in a dataset can be revealed through the len() method like so:</blockquote><pre>len(sf_permits)<br># Outputs the number of rows in the dataset</pre><p>2. <strong>Fill in the missing values via Imputation:</strong> The second option is to try and fill in the missing values using the <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.fillna.html">fillna()</a> method. For example, the following line of code:</p><pre>sample_dataset.fillna(5)</pre><p>Would replace all NaN values with the number 5.</p><p>There is also another way of filling in missing values: Copy the last or next valid observation of a value to fill the missing value. This feature can be accomplished using the method=bfill argument, to use the next valid observation as the basis for replacing a given NaN value, and the method=ffil argument, for using the last valid observation as the basis for replacing a given NaN value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*aFDvKxDg6j6C5UE_lxwpCA.jpeg" /><figcaption><em>Figure 1: Showing the top 5 rows of a sample dataset, which contain some </em><em>NaN values</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YuDBkEFSBGgX9n13ISJ8bQ.jpeg" /><figcaption><em>Figure 2: Showing the top 5 rows with </em><em>method=bfill applied so that empty values are filled in with the next valid observation</em></figcaption></figure><p>3. <strong>Fill in the missing values with an extension to Imputation:</strong> The third option is derived from Imputation with the extension of adding an extra column to denote whether or not a value in the current row was imputed. This is a way of denoting to the reader of the dataset that, if the extra column indicates a True value, that row&#39;s value was imputed from the adjacent values and that it should be used with some skepticism. This approach is helpful in improving the prediction power of the models in some cases and seem to have no effect in other cases.</p><p>Here is a visual example of this method:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/271/1*iMhUfrgG1iQx7b4cCBvYfQ.png" /><figcaption><em>Figure 3: Before applying Imputation Extension method</em></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/402/1*b2DXB9vGSyTs4jim9GONaA.png" /><figcaption><em>Figure 4: After applying Imputation Extension method</em></figcaption></figure><h3>Conclusion</h3><p>Well that’s it for this post! Thanks for following along in this article and if you have any questions or concerns please feel free to post a comment in this post and I will get back to you when I find the time.</p><p>If you found this article helpful please share it and make sure to follow me on <a href="https://twitter.com/SeanAtukorala">Twitter</a> and <a href="https://github.com/ShehanAT">GitHub</a>, connect with me on <a href="https://www.linkedin.com/in/shehan-atukorala-8631491a5/">LinkedIn</a> and subscribe to my <a href="https://www.youtube.com/channel/UCtxed_NljgtAXrQMMdLvhrQ">YouTube channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1383d66715f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Basics Definition From Set Theory]]></title>
            <link>https://medium.com/@SeanAT19/basics-definition-from-set-theory-5dbda9de5818?source=rss-76ab560d7a92------2</link>
            <guid isPermaLink="false">https://medium.com/p/5dbda9de5818</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[statistics]]></category>
            <category><![CDATA[set-theory]]></category>
            <category><![CDATA[probability]]></category>
            <dc:creator><![CDATA[Sean Atukorala]]></dc:creator>
            <pubDate>Sat, 06 May 2023 01:19:11 GMT</pubDate>
            <atom:updated>2023-05-06T01:19:11.240Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DgLskSF4kLwar5mPTMXG6w.png" /></figure><p>Here are some common definitions found in Set Operations:</p><ul><li><strong>Complement</strong>: Is the set that contains all the elements that don’t belong to an example set S. This can be mathematically written as S^c = U \ A</li><li><strong>Union</strong>: Is the combination of two sets such that all elements that belong to given sets A or B(or both sets) are contained in the new set A ∪ B</li><li><strong>Intersection</strong>: Is the combination of two sets such that only elements that belong to given sets A and B are contained in the new set A ∩ B</li><li><strong>Disjoint</strong>: Is when two given sets do not have any elements in common. Therefore, their intersection would be empty</li><li><strong>Partition</strong>: Is when there is a set A and smaller sets within it that are all disjoint sets. In this scenario, the collection of smaller sets within set A can be said to be a partition of set A</li><li><strong>Sample space</strong>: Is the set of all possible outcomes of an experiment</li><li><strong>Probability law</strong>: Is a law of probability that assigns a nonnegative number, P, to a set A where the P represents our knowledge or belief about the collective probability of the elements of set A.</li><li><strong>Event</strong>: Is a subset of the sample space also known as a potential outcome from a set of possible outcomes</li><li><strong>Collectively Exhaustive</strong>: Is a probability related concept where at least one of the events in a given sample space must occur(or have a 100% probability)</li><li><strong>Mutually Exclusive</strong>: Is a probability related concept where two events cannot occur at the same time or simultaneously. This is also known as disjoint events</li></ul><h3>Conclusion</h3><p>Well that’s it for this post! Thanks for following along in this article and if you have any questions or concerns please feel free to post a comment in this post and I will get back to you when I find the time.</p><p>If you found this article helpful please share it and make sure to follow me on <a href="https://twitter.com/SeanAtukorala">Twitter</a> and <a href="https://github.com/ShehanAT">GitHub</a>, connect with me on <a href="https://www.linkedin.com/in/shehan-atukorala-8631491a5/">LinkedIn</a> and subscribe to my <a href="https://www.youtube.com/channel/UCtxed_NljgtAXrQMMdLvhrQ">YouTube channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=5dbda9de5818" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to create Heatmaps using matplotlib.pyplot]]></title>
            <link>https://medium.com/@SeanAT19/how-to-create-heatmaps-using-matplotlib-pyplot-db9ff94d25e8?source=rss-76ab560d7a92------2</link>
            <guid isPermaLink="false">https://medium.com/p/db9ff94d25e8</guid>
            <category><![CDATA[pandas]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[heatmap]]></category>
            <dc:creator><![CDATA[Sean Atukorala]]></dc:creator>
            <pubDate>Sun, 30 Apr 2023 16:07:50 GMT</pubDate>
            <atom:updated>2023-04-30T16:07:50.258Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TbuCDX3NfPBE8-diM2bsSg.jpeg" /><figcaption>Figure 1: Nature scenery</figcaption></figure><p>In this tutorial we will go over how to create heat maps such as this one using Pandas and matplotlib.pyplot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/532/1*UEu8rTM1FO7xRsdmFwZ5bw.png" /><figcaption>Figure 2: Example of a heatmap</figcaption></figure><h3>What is matplotlib.pyplot?</h3><p>matplotlib.pyplot is a submodule of Matplotlib, the popular plotting library using Python.</p><p>The pyplot submodule is intended for interactive plots and plot generation.</p><h3>Creating heat maps using the imshow function:</h3><p>The imshow() can be used to create heat maps. Let&#39;s go over a basic example on how to do so now:</p><p>First, we need to create the data and the labels that are needed to be displayed using the heatmap:</p><pre>import numpy as np<br>import matplotlib<br>import matplotlib as mpl<br>import matplotlib.pyplot as plt<br><br>nhl_teams = [&quot;Bruins&quot;, &quot;Maple Leafs&quot;, &quot;Lightning&quot;, &quot;Panthers&quot;,<br>              &quot;Sabres&quot;, &quot;Senators&quot;, &quot;Red Wings&quot;]<br>nhl_team_stats = [&quot;2022&quot;, &quot;2021&quot;, &quot;2020&quot;, &quot;2019&quot;, &quot;2018&quot;, &quot;2017&quot;, &quot;2016&quot;]<br>nhl_games_won = np.array([[82, 63, 83, 92, 70, 45, 64],<br>                    [86, 48, 72, 67, 46, 42, 71],<br>                    [76, 89, 45, 43, 51, 38, 53],<br>                    [54, 56, 78, 76, 72, 80, 65],<br>                    [67, 49, 91, 56, 68, 40, 87],<br>                    [45, 70, 53, 86, 59, 63, 97],<br>                    [97, 67, 62, 90, 67, 78, 39]])</pre><p>Then we will create the figure and subplots needed to display the heatmap. Also, the imshow() function will be used to display the nhl_games_won numpy array as a heat map:</p><pre>fig, ax = plt.subplots()<br>im = ax.imshow(nhl_games_won)</pre><p>Next, we add the ticks and labels for our heatmap:</p><pre>ax.set_xticks(np.arange(len(nhl_teams)), labels=nhl_teams)<br>ax.set_yticks(np.arange(len(nhl_team_stats)), labels=nhl_team_stats)</pre><p>In order to improve the readability of the x-axis we will rotate the x-axis tick labels via the following code:</p><pre>plt.setp(ax.get_xticklabels(), rotation=45, ha=&quot;right&quot;,<br>         rotation_mode=&quot;anchor&quot;)</pre><p>Now, in order to add text annotations that show the values contained in the nhl_games_won numpy array we use a double for loop and the ax.text() method:</p><pre>for i in range(len(nhl_teams)):<br>    for j in range(len(nhl_team_stats)):<br>        text = ax.text(j, i, nhl_games_won[i, j],<br>                       ha=&quot;center&quot;, va=&quot;center&quot;, color=&quot;w&quot;)</pre><p>And finally, we set the title for the heatmap, adjust the padding between and around the subplot via fig.tight_layout(pad=0.5) and call plt.show() to display the generated figure:</p><pre>ax.set_title(&quot;NHL Games Won By Year&quot;)<br>fig.tight_layout(pad=0.5)<br>plt.show()</pre><p>And here is the final result, a heatmap generated using matplotlib.pyplot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/612/1*WeDXOGTyczLY5_m2OOD1Fw.png" /><figcaption>Figure 3: A heatmap generated using matplotlib.pyplot</figcaption></figure><p>Here is the final version of the above code example <a href="https://github.com/ShehanAT/machine-learning-mini-projects/blob/master/heatmaps-matplotlib-pyplot/main.py">on GitHub</a>.</p><p>Here are some definitions of the concepts that we covered above, in case you were unfamiliar with them:</p><ul><li>Figure: A figure in matplotlib is the most basic foundation for plotting data using matplotlib</li><li>Subplot: A smaller chart that is nested with a matplotlib figure</li><li>Ticks: A series of values on either the x or y axis to show the coordinates on the graph</li></ul><h3>Conclusion</h3><p>Well that’s it for this post! Thanks for following along in this article and if you have any questions or concerns please feel free to post a comment in this post and I will get back to you when I find the time.</p><p>If you found this article helpful feel free to share it and make sure to follow me on <a href="https://twitter.com/SeanAtukorala">Twitter</a> and <a href="https://github.com/ShehanAT">GitHub</a>, connect with me on <a href="https://www.linkedin.com/in/shehan-atukorala-8631491a5/">LinkedIn</a> and subscribe to my <a href="https://www.youtube.com/channel/UCtxed_NljgtAXrQMMdLvhrQ">YouTube channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=db9ff94d25e8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Insert Latitude/Longitude columns to Pandas DataFrame — Machine Learning Tutorial]]></title>
            <link>https://medium.com/@SeanAT19/insert-latitude-longitude-columns-to-pandas-dataframe-machine-learning-tutorial-ef2920d41529?source=rss-76ab560d7a92------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef2920d41529</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[dataframes]]></category>
            <category><![CDATA[pandas]]></category>
            <dc:creator><![CDATA[Sean Atukorala]]></dc:creator>
            <pubDate>Sat, 11 Feb 2023 20:09:07 GMT</pubDate>
            <atom:updated>2023-02-11T20:09:07.441Z</atom:updated>
            <content:encoded><![CDATA[<h3>Insert Latitude/Longitude columns to Pandas DataFrame — Machine Learning Tutorial</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2LThll0e8XCv1SK9nbPqIg.jpeg" /></figure><p>This will be a brief tutorial on how to insert latitude and longitude values to a Pandas DataFrame. These GPS coordinates will be derived from a column containing US state names as strings, as shown in this screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/404/1*f4LOCrWSOtgUaDjN1CcvrQ.png" /></figure><h3>Instructions:</h3><p>You can find the Kaggle Notebooks link for this tutorial by <a href="https://www.kaggle.com/seanatukorala/inserting-lat-long-to-dataframe">clicking here</a></p><p>I recommend running the code in the tutorial using the dataset used in the above Kaggle Notebook. You can do so easily by clicking the ‘Copy &amp; Edit’ button on the top-right of the Kaggle Notebook page. Using Kaggle as the execution platform would be the most convenient method to follow along for this tutorial. Now let’s start the tutorial!</p><h3>Development:</h3><p>First we need to import the geopy.geocoders library by running the following Python line:</p><pre>from geopy.geocoders import Nominatim</pre><p>Next we need to instantiate a Nominatim instance using the following line:</p><pre>geolocator = Nominatim(user_agent=&#39;us_opiod_deaths&#39;)</pre><p>Now we can iterate over all the values in the state column of the df DataFrame, convert each string state name into latitude/longitude coordinates and then insert all those values into two arrays. One for the latitude values and one for the longitude values. Here is the code to do so:</p><pre>lat_arr = []<br>long_arr = []<br>for state in df[&#39;state&#39;]:<br>    lat_long_coords = geolocator.geocode(state)<br>    lat_arr.append(lat_long_coords.raw[&#39;lat&#39;])<br>    long_arr.append(lat_long_coords.raw[&#39;lon&#39;])</pre><p>After that, we have to insert the latitude and longitude values in the two arrays into the original dataset via the <a href="https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.insert.html">pandas.DataFrame.insert() method</a>:</p><pre>df.insert(loc=1, column=&#39;long&#39;, value=long_arr)<br>df.insert(loc=1, column=&#39;lat&#39;, value=lat_arr)</pre><p>Finally, we can display the newly created lat and long columns using these lines:</p><pre>for index, row in df.iterrows():<br>    print(&quot;lat: &quot; + str(row[&#39;lat&#39;]) + &quot;, long: &quot;+ str(row[&#39;long&#39;]))</pre><p>Here is a screenshot of the output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/464/1*e-yNQz3odGSAXGkk70Vx5A.png" /></figure><p>Well, that’s it for this blog post! Hope it was helpful!</p><h3>Conclusion</h3><p>Thanks for reading this blog post!</p><p>If you have any questions or concerns feel free to post a comment in this post and I will get back to you if I find the time.</p><p>If you found this article helpful feel free share it and make sure to follow me on <a href="https://twitter.com/SeanAtukorala">Twitter </a>and <a href="https://github.com/ShehanAT">GitHub</a>, connect with me on <a href="https://www.linkedin.com/in/shehan-atukorala-8631491a5/">LinkedIn</a> and subscribe to my <a href="https://www.youtube.com/channel/UCtxed_NljgtAXrQMMdLvhrQ">YouTube channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef2920d41529" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solution for “error[E0425]: cannot find function `every` in module `time`” when using Iced Rust GUI…]]></title>
            <link>https://medium.com/@SeanAT19/solution-for-error-e0425-cannot-find-function-every-in-module-time-when-using-iced-rust-gui-1d9e289d511c?source=rss-76ab560d7a92------2</link>
            <guid isPermaLink="false">https://medium.com/p/1d9e289d511c</guid>
            <category><![CDATA[gui]]></category>
            <category><![CDATA[rust]]></category>
            <category><![CDATA[iced]]></category>
            <category><![CDATA[rust-programming-language]]></category>
            <dc:creator><![CDATA[Sean Atukorala]]></dc:creator>
            <pubDate>Mon, 26 Dec 2022 22:20:22 GMT</pubDate>
            <atom:updated>2022-12-26T22:20:22.840Z</atom:updated>
            <content:encoded><![CDATA[<h3>Solution for “error[E0425]: cannot find function `every` in module `time`” when using Iced Rust GUI library</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H3iwZ02WBbYfX0csQvDDPQ.jpeg" /><figcaption>Figure 1: Winter scenery</figcaption></figure><p><strong>Problem:</strong> Running into the following error when trying to use the <a href="https://github.com/iced-rs/iced">Iced GUI library</a> for a Rust program that replicates the <a href="https://github.com/iced-rs/iced/tree/master/examples/stopwatch">stopwatch Iced GUI example</a>:</p><pre>$ cargo build<br>error[E0425]: cannot find function `every` in module `time`<br>   --&gt; src\main.rs:203:23<br>    |<br>203 |                 time::every(Duration::from_millis(10)).map(Message::Tick)<br>    |                       ^^^^^ not found in `time`</pre><p><strong>Solution:</strong> The problem was that the smol feature was not included in the features option for the iced dependency listed in the Cargo.toml file.</p><p>Try replacing your existing iced dependency line with the following line:</p><pre># Cargo.toml file<br><br>[dependencies]<br>iced = {version = &quot;0.6&quot;, features = [&quot;smol&quot;]}</pre><p>Then run cargo build and see if the error is resolved!</p><h3>Conclusion</h3><p>Thanks for reading this blog post!</p><p>If you have any questions or concerns please feel free to post a comment in this post and I will get back to you if I find the time.</p><p>If you found this article helpful please share it and make sure to follow me on <a href="https://twitter.com/SeanAtukorala">Twitter </a>and <a href="https://github.com/ShehanAT">GitHub</a>, connect with me on <a href="https://www.linkedin.com/in/shehan-atukorala-8631491a5/">LinkedIn</a> and subscribe to my <a href="https://www.youtube.com/channel/UCtxed_NljgtAXrQMMdLvhrQ">YouTube channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1d9e289d511c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Solution for: “graal/truffle/mx.truffle/suite.py:]]></title>
            <link>https://medium.com/@SeanAT19/solution-for-graal-truffle-mx-truffle-suite-py-1a837f03c3f6?source=rss-76ab560d7a92------2</link>
            <guid isPermaLink="false">https://medium.com/p/1a837f03c3f6</guid>
            <category><![CDATA[graalvm]]></category>
            <category><![CDATA[c-programming]]></category>
            <category><![CDATA[error]]></category>
            <category><![CDATA[make]]></category>
            <dc:creator><![CDATA[Sean Atukorala]]></dc:creator>
            <pubDate>Thu, 01 Dec 2022 02:27:56 GMT</pubDate>
            <atom:updated>2022-12-01T02:27:56.861Z</atom:updated>
            <content:encoded><![CDATA[<h3>Solution for: “graal/truffle/mx.truffle/suite.py: Could not find a GNU make executable on the current path.” error</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Kzf4-jDLRrK-mPJq" /></figure><p><strong>Problem:</strong> While trying to setup <a href="https://github.com/oracle/graal">GraalVM</a> on a Ubuntu 22.04 DigitalOcean droplet, running the command mx build in the graal/compiler folder throws the following error:</p><pre>File &quot;/home/javaApplications/graal/truffle/mx.truffle/suite.py&quot;, line 796 in definition of libffi:<br>Could not find a GNU make executable on the current path.</pre><p>Note that the aforementioned error was received after setting up the JAVA_HOME environment variable to a <a href="https://github.com/graalvm/labs-openjdk-11">labs-openjdk-11 JDK</a> and adding mx to the PATH variable.</p><p><strong>Solution:</strong></p><p>The primary cause for this error is that make isn&#39;t installed or it is excluded from the PATH variable.</p><p>In order to install make and add it to PATH, run the following commands:</p><pre>sudo apt update<br>sudo apt install make<br>which make<br>export PATH=&lt;copy output from which make&gt;:$PATH<br><br>// Then run the initial command:<br>mx build</pre><p>Afterwards, if you get an error about a C compiler not being found, you’ll have to install one and add it to PATH. Use the following commands to do so:</p><pre>sudo apt install build-essential<br>which gcc<br>export PATH=&lt;copy output from which gcc&gt;:$PATH<br><br>// Then run the initial command:<br>mx build</pre><p>This should resolve the error. If not, keep looking for an answer that works!</p><h3>Conclusion</h3><p>Thanks for reading this blog post!</p><p>If you have any questions or concerns please feel free to post a comment in this post and I will get back to you when I find the time.</p><p>If you found this article helpful please share it and make sure to follow me on <a href="https://twitter.com/SeanAtukorala">Twitter </a>and <a href="https://github.com/ShehanAT">GitHub</a>, connect with me on <a href="https://www.linkedin.com/in/shehan-atukorala-8631491a5/">LinkedIn</a> and subscribe to my <a href="https://www.youtube.com/channel/UCtxed_NljgtAXrQMMdLvhrQ">YouTube channel</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1a837f03c3f6" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>