<?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: stevephary</title>
    <description>The latest articles on DEV Community by stevephary (@stevephary).</description>
    <link>https://dev.to/stevephary</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%2F1086592%2F89ff4bf7-701b-4d99-b132-80b7a97ab1dd.jpg</url>
      <title>DEV Community: stevephary</title>
      <link>https://dev.to/stevephary</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/stevephary"/>
    <language>en</language>
    <item>
      <title>Understanding the Whys of Dealing with Missing Values in Your Dataset</title>
      <dc:creator>stevephary</dc:creator>
      <pubDate>Tue, 01 Aug 2023 19:34:12 +0000</pubDate>
      <link>https://dev.to/stevephary/understanding-the-whys-of-dealing-with-missing-values-in-your-dataset-3ogk</link>
      <guid>https://dev.to/stevephary/understanding-the-whys-of-dealing-with-missing-values-in-your-dataset-3ogk</guid>
      <description>&lt;p&gt;Dealing with missing values is a crucial step in the data cleaning process. Most of us know what techniques to apply when handling missing values, but it's essential to understand why we choose specific techniques for our dataset. &lt;/p&gt;

&lt;p&gt;In this article, we will explore the reasons behind using &lt;br&gt;
 deletion or imputation techniques.&lt;/p&gt;

&lt;p&gt;Deletion: Removing rows or columns with missing values.&lt;br&gt;
Imputation: Filling in missing values with estimates such as mean, median or mode.&lt;/p&gt;
&lt;h2&gt;
  
  
  Types of Missing Values:
&lt;/h2&gt;

&lt;p&gt;Before diving into the techniques, let's briefly review the three types of missing values: consider the task of predicting performance of a student.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;| Hours of Study | Previous Test Score | Attendance Rate | Final Exam Score |
|----------------|---------------------|-----------------|------------------|
|      5         |         70          |       90%       |        80        |
|      2         |         45          |       75%       |        60        |
|      7         |         85          |       95%       |        90        |
|      4         |         60          |       80%       |        70        |
|      6         |         75          |       85%       |        85        |
|      3         |         50          |       70%       |        65        |
|      8         |         90          |       100%      |        95        |
|      4         |         65          |       80%       |        75        |
|      6         |         80          |       90%       |        85        |
|      2         |         40          |       60%       |        55        |
|      9         |         95          |       95%       |        100       |
|      5         |         70          |       85%       |        80        |
|      3         |         55          |       75%       |        70        |
|      7         |         80          |       90%       |        90        |
|      4         |         65          |       80%       |        75        |

&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Missing Completely At Random (MCAR):&lt;br&gt;
In MCAR, missing values occur completely at random and are unrelated to any other variables in the dataset. The absence of data happens purely by chance, and there is no systematic reason for the missingness. If some rows were missing randomly, irrespective of any pattern or relationship with other variables, it would be considered MCAR.&lt;/p&gt;

&lt;p&gt;Missing At Random (MAR):&lt;br&gt;
In MAR, the missing values' occurrence is related to other observed variables in the dataset, but not the missing values themselves. The missingness is conditional on other variables but not on the missing values. For example, if the "Attendance Rate" is missing for students who scored poorly in the previous test, it could be considered MAR.&lt;/p&gt;

&lt;p&gt;Missing Not At Random (MNAR):&lt;br&gt;
In MNAR, the missing values' occurrence is related to the missing values themselves. The missingness is related to information that is missing and not captured by other variables in the dataset. For example, if students with high "Hours of Study" tend to have missing values for "Final Exam Score," it would be considered MNAR.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Apply Deletion:
&lt;/h2&gt;

&lt;p&gt;Missing Completely At Random (MCAR):&lt;br&gt;
If the missing values occur completely at random, deleting the rows or columns with missing data is a valid option. It does not introduce bias, and the remaining data can still be representative of the overall dataset.&lt;/p&gt;

&lt;p&gt;Small Amount of Missing Data:&lt;br&gt;
If the dataset has a small proportion of missing values (e.g., less than 5%), deletion may be reasonable, especially if the missingness is random. In such cases, the impact of removing the missing data might not significantly affect the analysis.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Apply Imputation:
&lt;/h2&gt;

&lt;p&gt;Missing At Random (MAR) or Missing Not At Random (MNAR):&lt;br&gt;
When the missing data is not completely random and has some patterns related to other observed variables, imputation methods can be used to estimate missing values. Imputation tries to preserve relationships between variables and can help retain valuable information.&lt;/p&gt;

&lt;p&gt;Significant Amount of Missing Data:&lt;br&gt;
If a large portion of the dataset contains missing values, outright deletion may lead to a loss of valuable information and potentially biased results. Imputation, in this case, allows you to keep the entire dataset and work with the complete information.&lt;/p&gt;

&lt;p&gt;Drawback of Imputation:&lt;br&gt;
While imputation techniques can be helpful in estimating missing values, they do make assumptions about the data. The quality of imputed values depends on the accuracy of these assumptions. Therefore, it is crucial to validate the imputation techniques used and assess their impact on the final results.&lt;/p&gt;

&lt;p&gt;In conclusion, understanding the types of missing values in your dataset is essential for making informed decisions about how to handle them. If the missingness is random, deletion might be a suitable option, but if there are patterns in the missing data, imputation techniques can help retain valuable information. Always remember to validate the chosen techniques to ensure the integrity of your analysis.&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>machinelearning</category>
      <category>data</category>
      <category>analyst</category>
    </item>
    <item>
      <title>TEMPORARY FUNCTION IN SQL</title>
      <dc:creator>stevephary</dc:creator>
      <pubDate>Tue, 30 May 2023 16:42:05 +0000</pubDate>
      <link>https://dev.to/stevephary/temporary-function-in-sql-3cpi</link>
      <guid>https://dev.to/stevephary/temporary-function-in-sql-3cpi</guid>
      <description>&lt;h2&gt;
  
  
  Why use temporary functions?
&lt;/h2&gt;

&lt;p&gt;You might ask “Do we really need functions in SQL?”, &lt;br&gt;
absolutely yes. Temporary functions are important for several reasons:&lt;/p&gt;

&lt;p&gt;• Organization -- As program grow in complexity, having all the queries in a big chunk increase difficult in understanding the program. Temporary function is almost like a mini-program that we can write separately from our main program, this allows us to reduce a complicated program into smaller, more manageable chunks, which reduces the overall complexity of our program.&lt;br&gt;
• Reusability -- Once a temporary function is written, it can be called multiple times to the current session. This avoids duplicated queries (“Don’t Repeat Yourself”) and minimizes the probability of copy/paste errors. &lt;/p&gt;
&lt;h2&gt;
  
  
  Example of temporary function
&lt;/h2&gt;

&lt;p&gt;Assume you are a data analyst of a wholesale company, having a database containing tables (Sales and Products). The “Sales” table contains information about sales transactions, including the product ID, quantity, and total price. The “Products” table holds product information, including the product ID, name, price, and discount. You want to know the price of products after discount.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;CREATE OR REPLACE FUNCTION get_discounted_price(product_id INT)
RETURNS NUMERIC(10, 2)
AS
$$
DECLARE
  original_price NUMERIC(10, 2); 
  discount_rate NUMERIC(5, 2);
  discounted_price NUMERIC(10, 2);
BEGIN
  SELECT price, discount INTO original_price, discount_rate
  FROM Products
  WHERE product_id = product_id;

  discounted_price := original_price * (1 - discount_rate);

  RETURN discounted_price;
END;
$$
LANGUAGE plpgsql;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In the above code we create a temporary function named "get_discounted_price" that takes a product ID as a parameter and returns the price after applying the discount for that product.&lt;/p&gt;

&lt;p&gt;We utilize our temporary function in our query as follows&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;SELECT product_id, product_name, get_discounted_price(product_id) AS discounted_price
FROM Products;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;&lt;em&gt;REMEMBER&lt;/em&gt;&lt;/strong&gt;: Temporary functions are specific to the current session and will be automatically dropped when the session ends.&lt;/p&gt;

</description>
      <category>sql</category>
      <category>datascience</category>
      <category>database</category>
    </item>
    <item>
      <title>ARTIFICIAL NEURAL NETWORK: UNDERSTANDING BIOLOGICAL INSPIRATION</title>
      <dc:creator>stevephary</dc:creator>
      <pubDate>Sun, 21 May 2023 13:59:22 +0000</pubDate>
      <link>https://dev.to/stevephary/artificial-neural-network-understanding-biological-inspiration-56fh</link>
      <guid>https://dev.to/stevephary/artificial-neural-network-understanding-biological-inspiration-56fh</guid>
      <description>

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;**&lt;br&gt;
Artificial neural network can be defined as a model of reasoning based on the human brain. The brain consists of a densely interconnected set of nerve cells, or basic information-processing units, called neurons. The human brain incorporates nearly 10 billion neurons and 60 trillion connections(synapses).&lt;br&gt;
Although each neuron has a very simple structure, an army of such elements constitutes a tremendous processing power. A neuron consists of a cell body called soma, a number of fibers called dendrites, and a single long fiber called the axon. While dendrites branch into a network around the soma, the axon stretches out to the dendrites and somas of other neurons.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Biological neural network&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--p60vvWBb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0acsyzmahqocryoeaqgr.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--p60vvWBb--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/0acsyzmahqocryoeaqgr.png" alt="Biological neural network" width="800" height="344"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h2&gt;
  
  
  Dynamic Connections of Neurons and Artificial Neural Networks
&lt;/h2&gt;

&lt;p&gt;** &lt;br&gt;
Signals travel between neurons through complicated chemical reactions. When chemical substances are released from synapses, they change the electricity in the cell body. Once the electricity reaches a certain point, it sends an electrical pulse called an action potential down the axon. This pulse spreads and reaches synapses, which can either increase or decrease their electricity. The most interesting thing is that the brain can change and form new connections between neurons, even entire groups of neurons can move from one place to another. These changes are what allow us to learn and remember things.&lt;br&gt;
The most interesting finding is that neural network exhibits plasticity. In response to the stimulation pattern, neurons also can form new connections with other neurons. Even entire collections of neurons may sometimes migrate from one place to another. These mechanisms form the basis for learning in the brain.&lt;br&gt;
Based on the characteristic of plasticity, connections between neurons leading to the ‘right answer’ are strengthened while those leading to the ‘wrong answer’ weaken. As a result, neural networks have the ability to learn through experience.&lt;br&gt;
Although a present-day artificial neural network (ANN) resembles the human brain much as a paper plane resembles a supersonic jet, it is a big step forward. ANNs are capable of ‘learning’, that is, they use experience to improve their performance. When exposed to a sufficient number of samples, ANNs can generalize to others they have not yet encountered.&lt;/p&gt;

&lt;p&gt;**&lt;/p&gt;

&lt;h2&gt;
  
  
  How artificial neural networks model the brain
&lt;/h2&gt;

&lt;p&gt;**&lt;br&gt;
An artificial neural network consists of a number of very simple and highly interconnected processors, also called neurons, which are analogous to the biological neurons in the brain. The neurons are connected by weighted links passing signals from one neuron to another. Each neuron receives a number of input signals through its connections; however, it never produces more than a single output signal. The output signal is transmitted through the neuron’s outgoing connection (corresponding to the biological axon). The outgoing connection, in turn, splits into a number of branches that transmit the same signal (the signal is not divided among these branches in any way). The outgoing branches terminate at the incoming connections of other neurons in the network.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Structure of artificial neural networks&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--VFGgXA62--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qyvmwuvv7mwv0eok52i6.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--VFGgXA62--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qyvmwuvv7mwv0eok52i6.jpg" alt="ann" width="800" height="587"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;The following table shows analogy between biological and artificial neural networks&lt;/em&gt;&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dzfDhEIp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58v6fo5jx7505d5xgfpg.PNG" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dzfDhEIp--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/58v6fo5jx7505d5xgfpg.PNG" alt="Analogy between biological and artificial neural networks" width="705" height="214"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>ai</category>
      <category>machinelearning</category>
      <category>datascience</category>
    </item>
  </channel>
</rss>
