<?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: MakenaKinyua</title>
    <description>The latest articles on DEV Community by MakenaKinyua (@makenakinyua).</description>
    <link>https://dev.to/makenakinyua</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%2F3254097%2F2008d211-26ab-46ff-bb3f-697703323023.jpg</url>
      <title>DEV Community: MakenaKinyua</title>
      <link>https://dev.to/makenakinyua</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/makenakinyua"/>
    <language>en</language>
    <item>
      <title>Visualizing the Africa Energy Project</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Mon, 27 Oct 2025 14:20:45 +0000</pubDate>
      <link>https://dev.to/makenakinyua/visualizing-the-africa-energy-project-25ic</link>
      <guid>https://dev.to/makenakinyua/visualizing-the-africa-energy-project-25ic</guid>
      <description>&lt;p&gt;There are so many untold stories that lie hidden in data that can be useful to us in one way or another. I worked on the Africa Energy Project, which is a data extraction project that involves getting data on energy indicators for all African countries. &lt;/p&gt;

&lt;p&gt;The project goes beyond data extraction into visualization which is am important aspect. Data visualization helps others understand the data and in this case, it is useful in policy making for such an important sector.&lt;/p&gt;

&lt;p&gt;I recommend you start &lt;a href="https://dev.to/makenakinyua/web-scrapping-project-3bnb"&gt;here&lt;/a&gt; which contains web scrapping before making your way to visualization. &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt; The Process...
&lt;/u&gt;
&lt;/h3&gt;



&lt;p&gt;Before getting into visualization, there were several questions that became points of interest that could be answered by the data.. &lt;/p&gt;

&lt;p&gt;i. How does the performance across indicator topics look like?&lt;br&gt;
ii. How do the energy scores across regions differ?&lt;br&gt;
iii. Which are the best performing countries and the worst performing countries?&lt;br&gt;
iv. How does the trend in scores across the years look like? &lt;br&gt;
v. What is the performance for individual countries? &lt;/p&gt;

&lt;h3&gt;
  
  
  &lt;u&gt; The Visualizations
&lt;/u&gt;
&lt;/h3&gt;



&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ooadyvh9irodyntpyiz.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6ooadyvh9irodyntpyiz.png" alt=" " width="800" height="448"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The report contains slicers, KPI cards, pie chart, bar chart and column charts. &lt;/p&gt;

&lt;p&gt;The slicers are meant to provide an interactive way for the user to filter data.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;The year slicer in in form of a slider which enables the user to view the different trends between selected years. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The second one is for the indicator topic, one can select multiple indicator topics and see how the visuals change with each selection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;The last slicer is for the units. This one in particular is important because the scores are measured in different units. Filtering out scores by unit gives a more informed picture of what is happening.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The pie chart is used to represent the share by region. It reveals that North Africa is more developed when it comes to electricity access, supply and technical aspects as compared to other parts of Africa.&lt;/p&gt;

&lt;p&gt;The bar chart is used to represent the top and bottom (n) countries and is responsive to the slicers. This gives shines a light on high performing and low performing countries which informs policy making.&lt;/p&gt;

&lt;p&gt;The column chart shows the trend in total and average scores over the years.&lt;/p&gt;

&lt;p&gt;The report has a second page which is used to filter further for individual countries and the indicator topics. It uses a table to show the sum and average score for all indicators under a specific indicator topic for a chosen country. &lt;/p&gt;

&lt;p&gt;The visualization process paints a clear picture of the information once hidden in the data. There are various recommendations that are reached by policy makers as a result of visualization.&lt;/p&gt;

&lt;p&gt;You can view the full report &lt;a href="https://github.com/MakenaKinyua/Energy-Data-Project" rel="noopener noreferrer"&gt;here&lt;/a&gt; and interact with the visuals!&lt;/p&gt;

</description>
      <category>analytics</category>
      <category>datascience</category>
      <category>powerbi</category>
      <category>data</category>
    </item>
    <item>
      <title>Web Scrapping Project</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Thu, 23 Oct 2025 15:08:54 +0000</pubDate>
      <link>https://dev.to/makenakinyua/web-scrapping-project-3bnb</link>
      <guid>https://dev.to/makenakinyua/web-scrapping-project-3bnb</guid>
      <description>&lt;p&gt;Getting data from modern websites is not the same as it used to be- today, most websites render their data dynamically making it hard for traditional web scrapping tools to obtain any data. &lt;/p&gt;

&lt;p&gt;In this project: The Africa Energy project, we are going to use different tools to obtain data about Energy Indicators across 54 African countries for the years 2000 - 2022 from the The Africa Energy Portal.&lt;/p&gt;

&lt;p&gt;The project features: a web scrapper that extracts JSON data from API network responses.&lt;/p&gt;

&lt;h3&gt;
  
  
  Project Overview
&lt;/h3&gt;

&lt;p&gt;The Africa Energy Portal is a dynamic webpage that contains information about energy indicators across 54 African countries. The indicators are energy access, supply and technical aspects related to energy.&lt;/p&gt;

&lt;p&gt;The indicators are further broken down into sub-sectors such as 'Population access to electricity-National' which shows the percentage of people with access to electricity on a national level etc.&lt;/p&gt;

&lt;h3&gt;
  
  
  The Process
&lt;/h3&gt;

&lt;p&gt;The project uses the following technologies:&lt;/p&gt;

&lt;p&gt;a. Python for developing the web scrapping logic&lt;br&gt;
b. Selenium for browser automation and capturing network responses&lt;br&gt;
c. Pandas for data handling and manipulation&lt;br&gt;
d. MongoDB which is a NOSQL database for storing and querying the data&lt;/p&gt;

&lt;p&gt;The scrapper utilizes Selenium to automate browser interaction such as loading the page and selecting all required themes, years and countries for precise data extraction. &lt;/p&gt;

&lt;h3&gt;
  
  
  The results
&lt;/h3&gt;

&lt;p&gt;The scrapper obtains all the selected fields of the data ie;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;id, name, score, unit, region name, indicator topic, indicator source, indicator name, indicator group, year, url&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The data is extracted in JSON format and appended to an empty list before it is flattened and converted to csv format.&lt;/p&gt;




&lt;p&gt;Working on this project has been nothing short of a learning experience from the thought process of understanding the project, to learning of different ways to execute the project, to implementation of the same.&lt;/p&gt;

&lt;p&gt;You can check out the project on &lt;a href="https://github.com/MakenaKinyua/Energy-Data-Project" rel="noopener noreferrer"&gt;Github&lt;/a&gt; and feel free to reach out for inquiries or collaboration!&lt;/p&gt;

</description>
      <category>python</category>
      <category>selenium</category>
      <category>webscraping</category>
      <category>mongodb</category>
    </item>
    <item>
      <title>RAGs for beginners</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Sat, 20 Sep 2025 07:35:21 +0000</pubDate>
      <link>https://dev.to/makenakinyua/rags-for-beginners-2d02</link>
      <guid>https://dev.to/makenakinyua/rags-for-beginners-2d02</guid>
      <description>&lt;p&gt;Advancement in Artificial Intelligence has made it possible for humans to interact with AI in different ways such as holding conversations that make sense for example using LLMs like GPT-4. &lt;/p&gt;

&lt;p&gt;Despite the strides achieved, one thing that can be frustrating when dealing with LLMs is querying and getting responses that make no sense. For instance, in the medical field, you can ask about the mode of action of a new drug in the market. Instead of answering correctly, the model gives you information that is outdated or made up. &lt;/p&gt;

&lt;p&gt;This is one of the limitations of traditional LLMs: they have knowledge gaps because they were trained on totally different data. LLMs also tend to provide generic answers and they hallucinate, answering questions out of context. To solve this, RAG systems were introduced.&lt;/p&gt;

&lt;h3&gt;
  
  
  RAG
&lt;/h3&gt;

&lt;p&gt;RAG refers to Retrieval-Augmented Generation systems which provide support to LLMs. RAG systems work by enabling the LLMs to access information from an external database. As a result, the models are able to generate responses that have more context and are up-to-date thus addressing the limitations of traditional Large Language Models.&lt;/p&gt;

&lt;h3&gt;
  
  
  How does it work?
&lt;/h3&gt;

&lt;p&gt;A simple RAG system flow has six stages: data extraction, chunking extracted data, embedding the chunks, storing the data in a vector database, retrieval when a user queries the database and generating a response. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fricnil2h9ndfkvak0nml.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fricnil2h9ndfkvak0nml.png" alt=" " width="750" height="355"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  i) Data collection
&lt;/h4&gt;

&lt;p&gt;This is the first stage which involves extracting data from a source, such as a pdf, that will be fed into the model. After extraction, the data is loaded ready to go to the next step.&lt;/p&gt;

&lt;h4&gt;
  
  
  ii) Chunking
&lt;/h4&gt;

&lt;p&gt;Data is extracted as a single string. Chunking involves breaking down the data into chunks using text splitters such as the &lt;code&gt;RecursiveCharacterTextSplitter&lt;/code&gt;. Define the chunk size (characters in each chunk) and the chunk overlap(by how many characters the chunks overlap) in order to preserve context.&lt;/p&gt;

&lt;h4&gt;
  
  
  iii) Embedding
&lt;/h4&gt;

&lt;p&gt;The chunks are not interpretable by the machine in their extracted state. Thus an embedding model is used to transform the characters into vector representations which are understood by the machine. There are different embedding models from &lt;code&gt;SentenceTransformers&lt;/code&gt; that can be used based on your need.&lt;/p&gt;

&lt;h4&gt;
  
  
  iv) Vector Database
&lt;/h4&gt;

&lt;p&gt;Once the chunks have been embedded, they need to be stored in a vector database such as &lt;code&gt;Chroma&lt;/code&gt;. The vector database stores the embeddings as vectors thus easier for it conduct a similarity search when queried.&lt;/p&gt;

&lt;h4&gt;
  
  
  v) Retrieval
&lt;/h4&gt;

&lt;p&gt;The user interacts with the LLM at this point by querying it. The queries are embedded into vectors then a similarity search occurs in the data base, comparing the vectors of the query to what is stored in the vector database. The most relevant response is retrieved and it proceeds to the next step.&lt;/p&gt;

&lt;h4&gt;
  
  
  vi) Generating a response
&lt;/h4&gt;

&lt;p&gt;After retrieving information from the database, a response is generated to the user based on the information available to the system. &lt;/p&gt;

&lt;p&gt;RAG systems can be used in various ways such as:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Providing customer support that is helpful to the users rather than frustrating.&lt;/li&gt;
&lt;li&gt;In market research where it has access to a vast pool of data. &lt;/li&gt;
&lt;li&gt;Useful in recommendation systems&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is incredible how much incorporating a RAG to a LLM improves the response quality of the model as well as the satisfaction of the user. In our ever growing tech space, it will be great to see how RAG systems will be improved upon and incorporated more in our day-to-day activities.&lt;/p&gt;

</description>
      <category>deeplearning</category>
      <category>ai</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Unsupervised Machine Learning</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Sun, 31 Aug 2025 17:06:46 +0000</pubDate>
      <link>https://dev.to/makenakinyua/unsupervised-machine-learning-kjo</link>
      <guid>https://dev.to/makenakinyua/unsupervised-machine-learning-kjo</guid>
      <description>&lt;p&gt;Machine learning is one of the core concepts of data science which forms the foundation for AI. &lt;/p&gt;

&lt;p&gt;Have you ever wondered how recommendation systems such as YouTube work? How are they able to recommend just the right content? The answer is simple: &lt;strong&gt;unsupervised machine learning&lt;/strong&gt;.&lt;/p&gt;

&lt;h4&gt;
  
  
  Unsupervised Machine Learning
&lt;/h4&gt;

&lt;p&gt;It is a type of machine learning where the model is fed raw, unstructured data without any labels. &lt;/p&gt;

&lt;p&gt;The model then learns and make sense of the data through discovering patterns and relationships on its own.&lt;/p&gt;

&lt;h4&gt;
  
  
  How does it work?
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;For it to learn the patterns and relationships, unsupervised machine learning depends heavily on mathematical concepts.&lt;/li&gt;
&lt;li&gt;Data points with similar features are grouped together each in its own group. &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  Models of Unsupervised Machine Learning
&lt;/h4&gt;

&lt;p&gt;There are different unsupervised machine learning models: clustering and dimensionality reduction. &lt;/p&gt;

&lt;h4&gt;
  
  
  i. Clustering
&lt;/h4&gt;

&lt;p&gt;Just as the name suggests, clustering involves grouping data into different clusters such that data points in the same cluster have very similar features while data points in different clusters are very different. &lt;/p&gt;

&lt;p&gt;There are different algorithms used in clustering:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;K-means&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In K-means clustering, the user defines the number of desired clusters (K) that the algorithm is supposed to form. &lt;/p&gt;

&lt;p&gt;Distance metrics such as the Euclidean distance and Manhattan distance come in to play whereby the algorithm measures the distance of data points from a centroid and clusters the data points depending on how similar a point is to a centroid.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Hierarchical clustering&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It involves forming a hierarchy of data points thus creating a tree of clusters. There are two types of hierarchical clustering: agglomerative which is a bottom-up approach and divisive which is a top-bottom approach.&lt;/p&gt;

&lt;h4&gt;
  
  
  ii. Dimensionality Reduction
&lt;/h4&gt;

&lt;p&gt;At times, we encounter datasets that have so many features; features which are of no meaningful value to the data we are trying to make sense of.&lt;/p&gt;

&lt;p&gt;In such a case, we use dimensionality reduction which works by reducing the number of variables while preserving key information. The model filters through the noise and gets rid of the unnecessary dimensions.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;My thoughts:&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;There is so much to learn from unsupervised machine learning models which exist to help us understand data beyond what is obvious to the human eye.&lt;/p&gt;

&lt;p&gt;Its ability to recognize patterns and relationships makes it powerful to use because real world data is messy and noisy!&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>data</category>
      <category>machinelearning</category>
      <category>ai</category>
    </item>
    <item>
      <title>Classification in Machine Learning.</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Mon, 25 Aug 2025 18:54:42 +0000</pubDate>
      <link>https://dev.to/makenakinyua/classification-in-machine-learning-43b7</link>
      <guid>https://dev.to/makenakinyua/classification-in-machine-learning-43b7</guid>
      <description>&lt;p&gt;Classification takes many forms in our day to day activities. It can take a simple form in spam filters, trends to a complex form like image search.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Classification?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;Classification&lt;/strong&gt; is a type of Supervised Machine Learning that is used to predict categories of data points.&lt;/p&gt;

&lt;p&gt;Classification works by looking at the characteristics or features of data points and putting them into categories based on the similarities depending on the model chosen. &lt;/p&gt;

&lt;p&gt;There are different algorithms used in classification:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Logistic regression &lt;/li&gt;
&lt;li&gt;K-Nearest Neighbors&lt;/li&gt;
&lt;li&gt;Random forest&lt;/li&gt;
&lt;li&gt;Decision trees etc&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;A good example of classification in action is your email service provider predicting whether an email is spam or not spam.&lt;/p&gt;

&lt;p&gt;How is Gmail/Outlook able to achieve that? Is there a trade off that occurs behind the scenes that guides decision making?&lt;/p&gt;

&lt;h4&gt;
  
  
  Metrics of Evaluation🧮
&lt;/h4&gt;

&lt;p&gt;These are the decision making guidelines that determine how well our model is doing.&lt;/p&gt;

&lt;p&gt;Scenario:&lt;/p&gt;

&lt;p&gt;Predicting spam and legitimate emails. Our model has 200 data points of which 180 are legitimate and 20 are spam. Our model predicts that 150 are legitimate and 50 are spam. There are 4 possible outcomes from the prediction:&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Predicted Positive&lt;/th&gt;
&lt;th&gt;Predicted Negative&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;Positive&lt;/td&gt;
&lt;td&gt;True Positive&lt;/td&gt;
&lt;td&gt;False Negative&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Negative&lt;/td&gt;
&lt;td&gt;False positives&lt;/td&gt;
&lt;td&gt;True Negative&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;h4&gt;
  
  
  a. Accuracy
&lt;/h4&gt;

&lt;p&gt;Accuracy tells us how many correct predictions our model has captured, whether positive or negative, out of all predictions. It is important because it explains how right our model is in classifying the categories.&lt;/p&gt;

&lt;h4&gt;
  
  
  b. Precision
&lt;/h4&gt;

&lt;p&gt;Precision tells us more about the positive predictions. How many positives have been correctly predicted out of all our positives?  For instance, our model predicted 50 positives but could have included some values as spam that were not.&lt;/p&gt;

&lt;h4&gt;
  
  
  c. Recall
&lt;/h4&gt;

&lt;p&gt;Recall shows us how many of the true positives were predicted by our model. The model can predict positives but how many of the true positives was it able to capture?&lt;/p&gt;

&lt;h4&gt;
  
  
  d. F1 Score
&lt;/h4&gt;

&lt;p&gt;The balance between recall and precision.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Okay, but why does any of this matter?📍&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Classification is used in many fields and thus the models need to suit the different scenarios as best as possible. The metrics are important because they guide us on the decisions we make based on what our models predict. &lt;/p&gt;

&lt;p&gt;The trade off occurs where the model predicts more positives and in the process, it captures false positives which are treated as points of interest. On the other hand, the model may predict less positives but risks not capturing some of the actual positives. &lt;/p&gt;

&lt;p&gt;The implications of favoring one metric can be missing out on important data points or capturing a lot more that may not necessarily be accurate. Thus the need to balance the metrics. &lt;/p&gt;

&lt;p&gt;Classification is thought provoking because the process of model design and decision making goes beyond just the code. It is a deeper process that needs you to factor in what level of correctness you desire and understand what that means to the problem that is at hand. &lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>analytics</category>
      <category>data</category>
    </item>
    <item>
      <title>Type i and Type ii errors</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Tue, 12 Aug 2025 11:16:25 +0000</pubDate>
      <link>https://dev.to/makenakinyua/type-i-and-type-ii-errors-5bl5</link>
      <guid>https://dev.to/makenakinyua/type-i-and-type-ii-errors-5bl5</guid>
      <description>&lt;h3&gt;
  
  
  &lt;u&gt; Errors in Hypothesis testing🧮
&lt;/u&gt;
&lt;/h3&gt;



&lt;p&gt;In hypothesis testing, we conduct statistical tests in order to determine the validity of our tests at a specific level of significance. &lt;/p&gt;

&lt;p&gt;We start by setting the null and alternate hypothesis. The alternate hypothesis is what we observe from an experiment and the null hypothesis is the opposite of the alternate hypothesis.&lt;/p&gt;

&lt;p&gt;In the process, there is always a chance of encountering errors when it comes to rejecting or failing to reject the null hypothesis. With these errors, there is a question of how to balance the errors and what we are willing to trade off.&lt;/p&gt;

&lt;p&gt;There are two types of errors:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Type i error - occurs when we &lt;strong&gt;reject&lt;/strong&gt; null when we should not have rejected it. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Type ii error - occurs when we &lt;strong&gt;fail to reject&lt;/strong&gt; the null hypothesis when we should have rejected it.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;u&gt; Medical Dilemma : A Cancer Scenario🩺
&lt;/u&gt;
&lt;/h4&gt;

&lt;p&gt;A patient walks into a hospital with several signs and symptoms. The doctor suspects that the patient's symptoms are consistent with cancer.&lt;br&gt;
In this case:&lt;br&gt;
&lt;em&gt;H0&lt;/em&gt; : The patient does not have cancer&lt;br&gt;
&lt;em&gt;H1&lt;/em&gt; : The patient has cancer &lt;/p&gt;

&lt;p&gt;Is it 'better' for a type i or a type ii error to occur? Where do we trade off between the two and how do we decide which one is better? &lt;/p&gt;

&lt;h4&gt;
  
  
  &lt;u&gt;Type i error&lt;/u&gt;
&lt;/h4&gt;

&lt;p&gt;A type i error would be that we reject null; that the patient does not have cancer, when we should not have rejected it. &lt;/p&gt;

&lt;p&gt;The implication:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The patient is in turn put on cancer treatments such as chemotherapy, a draining treatment,  when they are in fact healthy. &lt;/li&gt;
&lt;li&gt;It leads to physical, mental and financial drain on the patient. &lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  &lt;u&gt;Type ii error&lt;/u&gt;
&lt;/h4&gt;

&lt;p&gt;A type ii error would mean that we fail to reject null; that the patient does not have cancer, when we should have rejected it. &lt;/p&gt;

&lt;p&gt;The implication:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The patient would be sent home thinking that they are not sick when in fact, they are sick.&lt;/li&gt;
&lt;li&gt;They do not receive any sort of care and might end up having a sudden decline in health which might lead to death. &lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  &lt;u&gt;Reflection📑&lt;/u&gt;
&lt;/h3&gt;

&lt;p&gt;So which one is more acceptable in this case? A false positive or a false negative? How can we balance between the two? &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A type i error is reduced by setting an acceptable alpha value for the hypothesis test.&lt;/li&gt;
&lt;li&gt;A type ii error is reduced by increasing the statistical power.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It is important to strike a good balance between the two because both extremes can be dangerous.&lt;br&gt;
I say we need to consider our priorities, our morality, the cost of each type of error and the effects in the long run. What are your thoughts?&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>data</category>
      <category>learning</category>
      <category>statistics</category>
    </item>
    <item>
      <title>Calculating win probabilities of the EPL.</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Thu, 31 Jul 2025 17:12:20 +0000</pubDate>
      <link>https://dev.to/makenakinyua/calculating-win-probabilities-of-the-epl-3pjf</link>
      <guid>https://dev.to/makenakinyua/calculating-win-probabilities-of-the-epl-3pjf</guid>
      <description>&lt;p&gt;The English Premier League is about to resume for the next season and I hope all fans are ready for it! This a simple experiment to calculate and visualize win probabilities ; as a bernoulli distribution and binomial distribution using python.&lt;/p&gt;

&lt;p&gt;Data from the 2024/2025 season obtained from &lt;a href="https://www.football-data.org" rel="noopener noreferrer"&gt;Football Data Org API&lt;/a&gt; , an API for football, and I used several python libraries;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;requests&lt;/span&gt; 
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt; 
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;scipy&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;stats&lt;/span&gt; 
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;seaborn&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;sns&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;After obtaining the data, it was converted from json data to a pandas DataFrame for wrangling and visualization.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;1. Defining a function to calculate probabilities.&lt;/u&gt;&lt;br&gt;
The defined function has two objectives: calculate the win, draw and loss probabilities and calculate the binomial probability of the teams winning the same amount of games based on the number of games they won.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5dbeenv6f4oyvoiip7gf.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F5dbeenv6f4oyvoiip7gf.png" alt="Function to calculate Probability" width="800" height="217"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;i. The first part of the function&lt;br&gt;
Calculates the win, loss and draw probabilities. It takes the number of games divided by the total games. This provides us with an understanding of the probability of the outcomes for the individual teams at any point during the season. It can be likened to a bernoulli distribution which calculates the probability of a success ie; probability of a win or no win.&lt;/p&gt;

&lt;p&gt;ii. Second part of the function&lt;br&gt;
Calculates the binomial probabilities using the scipy python library. We use the &lt;code&gt;stats.binom.pmf&lt;/code&gt; which takes in the arguments (k, n, p) where;&lt;/p&gt;

&lt;p&gt;k - number of successes which is number of games won&lt;br&gt;
n - total games played&lt;br&gt;
p - probability of a win&lt;/p&gt;

&lt;p&gt;The binomial probabilities are interpreted as the probability of the team having the same number of wins for the next season.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;2. Visualizing the results&lt;/u&gt;&lt;br&gt;
From the results, I noticed the differences in team positions as a result of the calculated probabilities. I created a plot of both the win rate which is in orange and the win probability in blue just to help me understand the analysis. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0sg6et13cblg45myxda.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fz0sg6et13cblg45myxda.png" alt="Team Positions" width="800" height="313"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Based on this, we see that Liverpool FC is most likely to be at the top of the table followed by Manchester City FC and Chelsea FC. The three bottom most teams have higher probability of winning the same amount of games than the rate of winning any games. They suffer the penalty of relegation onto a lower competition.&lt;/p&gt;

&lt;p&gt;&lt;u&gt;Conclusion&lt;/u&gt;&lt;br&gt;
Working on this was interesting and I got to learn a lot through my trials and errors. There is so much that goes into predicting football outcome probabilities such as form, stage, players etc. I can't wait to explore these variables for a more informed prediction. As for now, I stand with Manchester United FC.&lt;/p&gt;

</description>
      <category>python</category>
      <category>datascience</category>
      <category>statistics</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Mean, Median and Mode in Statistics</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Tue, 22 Jul 2025 17:09:05 +0000</pubDate>
      <link>https://dev.to/makenakinyua/mean-median-and-mode-in-statistics-1clm</link>
      <guid>https://dev.to/makenakinyua/mean-median-and-mode-in-statistics-1clm</guid>
      <description>&lt;p&gt;Statistics, as a whole, is one of the subjects I enjoy most as a data scientist. In this article, we explore measures of central tendency which are part of the fundamentals of statistics and get to understand how they are used.&lt;/p&gt;

&lt;p&gt;Measures of central tendency are values that are used to summarize data in order to understand how the data is distributed. They include; mean, median and mode&lt;/p&gt;

&lt;p&gt;&lt;u&gt;i) Mean&lt;/u&gt;&lt;br&gt;
It is the average value of a given data set and is obtained by adding all the values of the data and dividing the result by the number of values in the data set.&lt;/p&gt;

&lt;p&gt;The mean is used when you want  to see where the average value of the data set lies which helps you understand the nature of the distribution. It is also used to fill in missing values in data set where the distribution is a symmetric and has no outliers.&lt;/p&gt;

&lt;p&gt;Calculating mean using python library numpy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import numpy as np
num = [2,2,3,4,8,5]
mean = np.mean(num)
print(mean)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;ii)&lt;u&gt; Median&lt;/u&gt;&lt;br&gt;
This is the midpoint in the data set; data is arranged in ascending or descending order and the middle value is obtained. In a symmetric distribution, the median value usually equals or is close to the mean value. For the median, it is used to fill missing values in a data set where the data has no outliers.&lt;/p&gt;

&lt;p&gt;Calculating median using python library numpy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import numpy as np
num = [2,2,3,4,8,5]
median = np.median(num)
print(median)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;u&gt;iii)Mode &lt;br&gt;
&lt;/u&gt;&lt;br&gt;
It refers to the most repeated value in a data set. The mode is also used to replace missing values depending on how many times it appears and the nature of the distribution. &lt;/p&gt;

&lt;p&gt;Calculating mode sing python library statistics:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import statistics
num = [2,2,3,4,8,5]
mode = statistics.mode(num)
print(mode)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In conclusion, the measures of central tendency are fundamental when exploring your data and can tell you so much about it. I hope this article has helped to shed some light on your understanding of the measures of central tendency and their importance! &lt;/p&gt;

</description>
      <category>statistics</category>
      <category>datascience</category>
      <category>python</category>
      <category>learning</category>
    </item>
    <item>
      <title>Relationships, in Power BI</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Sun, 22 Jun 2025 15:45:04 +0000</pubDate>
      <link>https://dev.to/makenakinyua/relationships-in-power-bi-4acj</link>
      <guid>https://dev.to/makenakinyua/relationships-in-power-bi-4acj</guid>
      <description>&lt;p&gt;Power BI is quite an interesting data tool and one of the concepts that I have enjoyed working on is relationships. This simply refers to the connection made between two tables. &lt;/p&gt;

&lt;p&gt;It is created by joining two separate tables using a selected column that has similar information on both tables. The table selected first is the fact table and the other table is the dimension table. There is a primary key in one table which is the unique identifier that maps on to the foreign key in the other table.&lt;/p&gt;

&lt;p&gt;There are four types of relationships:&lt;/p&gt;

&lt;p&gt;i)&lt;u&gt;One to One&lt;/u&gt;&lt;br&gt;
This is the simplest type of relationship. Values from the selected column of the first table match perfectly with values from the second table. All the values appear only once in each table hence a one-to-one relationship.&lt;/p&gt;

&lt;p&gt;Consider two tables; one with sales date and another with calendar dates. The sales date can only match with one date on the calendar table, this creates a connection between the two tables based on these columns.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feusifo8v3l1fu7swrwl9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Feusifo8v3l1fu7swrwl9.png" alt="One-to-one relationship" width="517" height="1035"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;ii)&lt;u&gt;One to Many&lt;/u&gt;&lt;br&gt;
For this type of relationship, values in the first table match multiple values on the second table. &lt;/p&gt;

&lt;p&gt;When you have customer table with customer id and sales table with customer id, the customer ID can match the sales table multiple times. This is because one customer can have multiple sales creating a one-to-many relationship.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs93bpizm1nn9cdt5bpux.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fs93bpizm1nn9cdt5bpux.png" alt="One-to-many relationship" width="518" height="1035"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;iii)&lt;u&gt;Many to One&lt;/u&gt; &lt;br&gt;
This is basically a reverse of the on- to-many relationship; multiple values from the first table match one value on the second table.&lt;/p&gt;

&lt;p&gt;For example, table with Sales information and another table with Products information. The common column between them is the product ID column. In this case, there are multiple sales that are made of one product. Therefore, multiple values on the sales table match with one value on the product table.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr3lewhr6j0aj0r7fpi33.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr3lewhr6j0aj0r7fpi33.png" alt="Many-to-one relationship" width="519" height="1038"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;iv)&lt;u&gt;Many to Many&lt;/u&gt;&lt;br&gt;
In this type of relationship, multiple values from the first table match with multiple values from the second table.&lt;/p&gt;

&lt;p&gt;Another thing about relationships is the cross-filter direction. This refers to the direction in which a filter that is applied on tables that have a relationship affect those tables. &lt;br&gt;
a) Single cross filter direction - filters are applied from one table to another&lt;br&gt;
b)Both cross filter direction - filters are applied in both tables&lt;/p&gt;

&lt;p&gt;Relationships in PowerBI have made it easy to understand, explore and join tables for easier visualization of data and I can't wait to learn more!&lt;/p&gt;

</description>
      <category>powerbi</category>
      <category>analytics</category>
      <category>data</category>
    </item>
    <item>
      <title>Excel, an analysis.</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Wed, 11 Jun 2025 13:43:17 +0000</pubDate>
      <link>https://dev.to/makenakinyua/excel-an-analysis-3i6n</link>
      <guid>https://dev.to/makenakinyua/excel-an-analysis-3i6n</guid>
      <description>&lt;p&gt;I have learnt and built with Microsoft Excel and it has been an interesting experience. Excel is amongst the most important data tools for any analyst. It is used for analysis, storage and visualization of data.&lt;/p&gt;

&lt;p&gt;Excel uses formulas and functions that enables the analysis of data in order to capture useful insights. In real-world data, such insights are very important and are used to make data driven decisions. Some examples of excel in the real world include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Preparing Financial Statements&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Excel can be used to prepare financial statements such as balance sheets and profit and loss statements amongst others. These are used in understanding business performance.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Budgeting Process&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Excel is used to create dynamic budgets. We have the expected expenses and income, using different formulas and functions, excel is able to update the budget with every input and compute given values and delivers an outcome.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Financial Planning&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Excel provides analyst with a platform to provide data context on performance indicators that help with long term financial planning.&lt;/p&gt;

&lt;h3&gt;
  
  
  Features And Formulas
&lt;/h3&gt;

&lt;p&gt;Some of the interesting things I have learnt include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Data Validation&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is a feature that allows on specific data to be input in a selected range of cells. For example, when you input data on marital status, it can be restricted to: single, married, divorced and widowed. This ensures that nothing outside that selection is entered in the specific cells.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Conditional Formatting&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is used to create simple visuals of the data using icons, data bars, color among others. In a category that has sales, it can be used to see high, low and moderate sales depending on the rules that have been input.  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Filtering&lt;/strong&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This is used to view your data based on different categories. I love this because it is very helpful when you are exploring your data in order to understand what you are working with.&lt;/p&gt;

&lt;h3&gt;
  
  
  Reflection
&lt;/h3&gt;

&lt;p&gt;Learning excel has made me appreciate the importance and power of data. Good data brings with it endless possibilities in the amount of information that can be obtained from it and how much sense can be made from a bunch of numbers and words which is beautiful to behold.&lt;/p&gt;

</description>
      <category>excel</category>
      <category>datascience</category>
      <category>analytics</category>
      <category>beginners</category>
    </item>
    <item>
      <title>[Boost]</title>
      <dc:creator>MakenaKinyua</dc:creator>
      <pubDate>Mon, 09 Jun 2025 15:51:44 +0000</pubDate>
      <link>https://dev.to/makenakinyua/excel-1c9h</link>
      <guid>https://dev.to/makenakinyua/excel-1c9h</guid>
      <description></description>
    </item>
  </channel>
</rss>
