<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: kamau waweru</title>
    <description>The latest articles on DEV Community by kamau waweru (@kamauwaweru).</description>
    <link>https://dev.to/kamauwaweru</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F882499%2Feb1faa26-3052-48bb-9137-66486267f126.jpg</url>
      <title>DEV Community: kamau waweru</title>
      <link>https://dev.to/kamauwaweru</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/kamauwaweru"/>
    <language>en</language>
    <item>
      <title>HIGH JS QUALITY CODE</title>
      <dc:creator>kamau waweru</dc:creator>
      <pubDate>Wed, 31 Aug 2022 05:54:23 +0000</pubDate>
      <link>https://dev.to/kamauwaweru/high-js-quality-code-2g5f</link>
      <guid>https://dev.to/kamauwaweru/high-js-quality-code-2g5f</guid>
      <description>&lt;p&gt;&lt;strong&gt;DEBUGGING IN THE BROWSER&lt;/strong&gt;JAVASCRIPT&lt;br&gt;
Before writing more complex code, let’s talk about debugging.&lt;/p&gt;

&lt;p&gt;Debugging is the process of finding and fixing errors within a script. All modern browsers and most other environments support debugging tools – a special UI in developer tools that makes debugging much easier. It also allows to trace the code step by step to see what exactly is going on.&lt;/p&gt;

&lt;p&gt;We’ll be using Chrome here, because it has enough features, most other browsers have a similar process.&lt;br&gt;
**&lt;/p&gt;

&lt;h2&gt;
  
  
  The “Sources” panel
&lt;/h2&gt;

&lt;p&gt;**&lt;br&gt;
Your Chrome version may look a little bit different, but it still should be obvious what’s there.&lt;/p&gt;

&lt;p&gt;Open the example page in Chrome.&lt;br&gt;
Turn on developer tools with F12 (Mac: Cmd+Opt+I).&lt;br&gt;
Select the Sources panel.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>[Redis Hackathon Submission Post Placeholder Title]</title>
      <dc:creator>kamau waweru</dc:creator>
      <pubDate>Fri, 19 Aug 2022 12:53:49 +0000</pubDate>
      <link>https://dev.to/kamauwaweru/redis-hackathon-submission-post-placeholder-title-127l</link>
      <guid>https://dev.to/kamauwaweru/redis-hackathon-submission-post-placeholder-title-127l</guid>
      <description>&lt;h3&gt;
  
  
  Overview of My Submission
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Submission Category:
&lt;/h3&gt;

&lt;h3&gt;
  
  
  [Optional: Video Explainer of My Project]
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Language Used
&lt;/h3&gt;

&lt;h3&gt;
  
  
  Link to Code
&lt;/h3&gt;

&lt;p&gt;BTW, your Github code’s README file should contain the details as &lt;a href="https://github.com/redis-developer/hackathon-docs/blob/main/README.md"&gt;per this template&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Additional Resources / Info
&lt;/h3&gt;

&lt;p&gt;[Note:] # (Be sure to link to any open source projects that are using your workflow!)&lt;/p&gt;

&lt;p&gt;[Note:] # Screenshots/demo videos are encouraged!&lt;/p&gt;

&lt;h3&gt;
  
  
  Collaborators
&lt;/h3&gt;

&lt;p&gt;[Reminder]: # (Submissions are due on August 29th, 2022 @ 11:59 PM UTC).&lt;/p&gt;




&lt;ul&gt;
&lt;li&gt;&lt;em&gt;Check out &lt;a href="https://redis.io/docs/stack/get-started/clients/#high-level-client-libraries"&gt;Redis OM&lt;/a&gt;, client libraries for working with Redis as a multi-model database.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Use &lt;a href="https://redis.info/redisinsight"&gt;RedisInsight&lt;/a&gt; to visualize your data in Redis.&lt;/em&gt;&lt;/li&gt;
&lt;li&gt;&lt;em&gt;Sign up for a &lt;a href="https://redis.info/try-free-dev-to"&gt;free Redis database&lt;/a&gt;.&lt;/em&gt;&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>redishackathon</category>
    </item>
    <item>
      <title>Decision Trees</title>
      <dc:creator>kamau waweru</dc:creator>
      <pubDate>Fri, 19 Aug 2022 07:50:00 +0000</pubDate>
      <link>https://dev.to/kamauwaweru/comprehensive-to-decision-trees-5i8</link>
      <guid>https://dev.to/kamauwaweru/comprehensive-to-decision-trees-5i8</guid>
      <description>&lt;p&gt;What is a decision tree?&lt;br&gt;
A decision tree is a model used in a wide array of industries that visually maps out the if-else flow of a particular scenario. As an example, consider a scenario where you want to plan out the next day’s schedule. A decision tree is well-suited to visualise the probable schedule:&lt;/p&gt;

&lt;p&gt;The decision tree starts off by asking a single question "Will it rain tomorrow?". Depending on the answer, we move on to the next corresponding question, and we repeat this process until we get to the end. To introduce some jargon here, each question/decision is called a node (i.e. the rounded rectangles in the diagram). This decision tree contains 5 nodes. The starting node (i.e. the node with "Will it rain tomorrow?") is called the root node. The nodes at the very end of the tree are called leaf nodes. In this example, we have 3 leaf nodes.&lt;/p&gt;

&lt;p&gt;Decision trees in machine learning&lt;br&gt;
In the context of machine learning, decision trees are a suite of tree based-models used for classification and regression. Just like all the other machine learning algorithms, decision trees can be constructed using data.&lt;/p&gt;

&lt;p&gt;Transparency&lt;br&gt;
What makes decision trees stand out from the rest is its transparency in how the result are reached. Machine learning models, like neural networks, are notorious for being black-boxes, that is, they fail to justify why the model returned a particular output. Decision trees do not share the same caveat; we can easily visualise the reasons behind its output, as we shall demonstrate later in this tutorial. This feature makes it extremely appealing for some applications such as market segmentation, where we want to differentiate the traits of customers.&lt;/p&gt;

&lt;p&gt;Simple numerical example&lt;br&gt;
To keep things concrete, suppose we wanted to predict whether or not students would pass their exam given their gender and group. The following is the our dataset, which we will use as the training data:&lt;/p&gt;

&lt;p&gt;gender&lt;/p&gt;

&lt;p&gt;group&lt;/p&gt;

&lt;p&gt;is_pass&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;A&lt;/p&gt;

&lt;p&gt;true&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;B&lt;/p&gt;

&lt;p&gt;true&lt;/p&gt;

&lt;p&gt;female&lt;/p&gt;

&lt;p&gt;A&lt;/p&gt;

&lt;p&gt;false&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;A&lt;/p&gt;

&lt;p&gt;false&lt;/p&gt;

&lt;p&gt;female&lt;/p&gt;

&lt;p&gt;C&lt;/p&gt;

&lt;p&gt;true&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;B&lt;/p&gt;

&lt;p&gt;false&lt;/p&gt;

&lt;p&gt;female&lt;/p&gt;

&lt;p&gt;C&lt;/p&gt;

&lt;p&gt;true&lt;/p&gt;

&lt;p&gt;Our training data contains a total of 7 observations, and 2 categorical features: gender and the group. gender is a binary categorical variable, whereas group is a multi-class categorical variable with three distinct values. The last column is_pass is the target label, that is, the value that we want to predict.&lt;/p&gt;

&lt;p&gt;Our goal is to build a decision tree using this training data and predict whether or not students would pass the exam given their gender and group.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Listing all possible binary splits
Our first sub-goal is to determine what binary split we should use for the root node. Since decision trees typically opt for binary splits, the four possible binary splits for this instance problem are as follows:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;male vs female&lt;/p&gt;

&lt;p&gt;group A or not A&lt;/p&gt;

&lt;p&gt;group B or not B&lt;/p&gt;

&lt;p&gt;group C or not C&lt;/p&gt;

&lt;p&gt;The key question here is - which of the above four provides the best split? To answer this question, we need to understand what pure and impure subsets are.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Building a frequency table
To keep things concrete, we first focus on the male vs female split. The following is our original dataset with the gender column extracted and sorted:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;gender&lt;/p&gt;

&lt;p&gt;is_pass&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;true&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;true&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;false&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;false&lt;/p&gt;

&lt;p&gt;female&lt;/p&gt;

&lt;p&gt;true&lt;/p&gt;

&lt;p&gt;female&lt;/p&gt;

&lt;p&gt;false&lt;/p&gt;

&lt;p&gt;female&lt;/p&gt;

&lt;p&gt;false&lt;/p&gt;

&lt;p&gt;We have 4 records with gender=male, and 3 with gender=female. Out of the 4 records with male, we have 2 records with is_pass=true, and 2 records with is_pass=false. We can easily summarise the counts using a frequency table like so:&lt;/p&gt;

&lt;p&gt;gender&lt;/p&gt;

&lt;p&gt;is_pass (true:false)&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;2:2&lt;/p&gt;

&lt;p&gt;female&lt;/p&gt;

&lt;p&gt;1:2&lt;/p&gt;

&lt;p&gt;Here, the ratio 2:2 just means that there are 2 records with is_pass=true, and 2 records with is_pass=false. In this case, the partition isn't absolute - we have is_pass=true and is_pass=false for both the partitions. We call these partitions impure subsets. On the other hand, pure subsets are partitions where the target class is completely one-sided, that is, the ratio contains a 0 (e.g. 5:0, 0:7).&lt;/p&gt;

&lt;p&gt;Intuition behind pure and impure subsets&lt;br&gt;
We can measure how good of a candidate a feature is for the root node by focusing on the metric of impurity. We want to minimise impurity, that is, we prefer pure subsets over impure subsets. To illustrate this point, just suppose for now that the gender split was as follows:&lt;/p&gt;

&lt;p&gt;gender&lt;/p&gt;

&lt;p&gt;is_pass (true:false)&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;0:3&lt;/p&gt;

&lt;p&gt;female&lt;/p&gt;

&lt;p&gt;2:0&lt;/p&gt;

&lt;p&gt;We've got two pure subsets, making the gender split ideal. In simple words, this means that all male students seem to have failed the exam, while the female students have passed the exam. Intuitively, it makes sense that this split is extremely useful when it comes to predicting whether a student would pass the exam; if the student is male, then we predict that he would fail the exam, and if she is female, then we predict that she would pass the exam.&lt;/p&gt;

&lt;p&gt;In this case, the perfect decision tree would be as follows:&lt;/p&gt;

&lt;p&gt;Just as a comparison, suppose the ratio table for the gender split was instead as follows:&lt;/p&gt;

&lt;p&gt;gender&lt;/p&gt;

&lt;p&gt;is_pass (true:false)&lt;/p&gt;

&lt;p&gt;male&lt;/p&gt;

&lt;p&gt;2:2&lt;/p&gt;

&lt;p&gt;female&lt;/p&gt;

&lt;p&gt;3:3&lt;/p&gt;

&lt;p&gt;This time, we have two impure subsets. Can you see how this is inferior to the case when we had two pure subsets? Just by looking at the ratio, the gender split seems to not really have an impact on whether the student would pass or fail the exam.&lt;/p&gt;

&lt;p&gt;From this comparison between pure and impure features, we can intuitively understand that we want to choose a feature with the least impurity for the target node - pure subsets are to be preferred.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Computing the Gini Impurity for each split
With the two ratio tables now complete, we must decide which feature to use as the root node. There are numerous criteria by which we make the decision, but a commonly used one is called the Gini impurity. The Gini impurity is a numerical value we compute for each value of a feature (e.g. male vs female) that tells us how much information that feature will provide to us.&lt;/li&gt;
&lt;/ol&gt;

</description>
    </item>
    <item>
      <title>hello world</title>
      <dc:creator>kamau waweru</dc:creator>
      <pubDate>Sat, 25 Jun 2022 08:25:15 +0000</pubDate>
      <link>https://dev.to/kamauwaweru/hello-world-dej</link>
      <guid>https://dev.to/kamauwaweru/hello-world-dej</guid>
      <description>&lt;p&gt;Hello software developers,anyone from kenya&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
