<?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>Forem: Michelle Njuguna</title>
    <description>The latest articles on Forem by Michelle Njuguna (@michellenjeriscientist).</description>
    <link>https://forem.com/michellenjeriscientist</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%2F1869257%2Fe226c0b4-a2e4-4a11-ba79-e157ccf575e0.jpg</url>
      <title>Forem: Michelle Njuguna</title>
      <link>https://forem.com/michellenjeriscientist</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/michellenjeriscientist"/>
    <language>en</language>
    <item>
      <title>Classification Metrics</title>
      <dc:creator>Michelle Njuguna</dc:creator>
      <pubDate>Mon, 10 Mar 2025 20:21:52 +0000</pubDate>
      <link>https://forem.com/michellenjeriscientist/classification-metrics-l0m</link>
      <guid>https://forem.com/michellenjeriscientist/classification-metrics-l0m</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In machine learning, classification is the task of predicting the class to which input data belongs. One example would be to classify whether the text from an email (input data) is spam (one class) or not spam (another class).&lt;/p&gt;

&lt;p&gt;When building a classification system, we need a way to evaluate the performance of the classifier. And we want to have evaluation metrics that are reflective of the classifier’s true performance.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Common Classification Metrics&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Accuracy: &lt;br&gt;
This is the simplest and most intuitive metric, measuring the proportion of correct predictions. We use it when a dataset is balanced and you want to perform simple classification.&lt;br&gt;
It’s calculated as (True Positives + True Negatives) / Total Predictions.&lt;br&gt;
Example: A sample class has 80% males and 20% females. Our model can easily predict 80% accuracy of the male representation by predicting total students in the sample.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Precision: &lt;br&gt;
Precision, also known as positive predictive value measures the proportion of true positive predictions among all positive predictions. It helps answer the question: “Of all the positive predictions made by the model, how many were correct?” The formula for precision is True Positives / (True Positives + False Positives).&lt;br&gt;
It is used where false positives are costly. &lt;br&gt;
Example: Fraud detection.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Recall:&lt;br&gt;
Recall, or sensitivity, gauges the proportion of true positive predictions among all actual positive instances. It answers the question: “Of all the actual positive instances, how many did the model correctly predict?” The formula for recall is True Positives / (True Positives + False Negatives).&lt;br&gt;
It is used where false negatives are costly.&lt;br&gt;
Example: Medical cases that are sensitive like having a patient who has cancer testing negative.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;F1 Score: &lt;br&gt;
The F1 score is the harmonic mean of precision and recall. It provides a balance between these two metrics, giving you a single value that considers both false positives and false negatives. The formula for the F1 score is 2 * (Precision * Recall) / (Precision + Recall).&lt;br&gt;
Used when we have an imbalanced dataset.&lt;br&gt;
Example: Sentiment Analysis.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;5.Specificity: &lt;br&gt;
Specificity, also known as the true negative rate, measures the proportion of true negative predictions among all actual negative instances. It’s calculated as True Negatives / (True Negatives + False Positives).&lt;br&gt;
The focus is on correctly identifying negatives and minimizing false alarms.&lt;br&gt;
Example: Patient explaining symptoms to doctor.&lt;/p&gt;

&lt;p&gt;6.Confusion Matrix: &lt;br&gt;
While not a single metric, the confusion matrix is a table that summarizes the model’s performance. It includes values for true positives, true negatives, false positives, and false negatives, providing a detailed view of classification results.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;em&gt;Terms to remember:&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;True Positives: It is the case where we predicted Yes and the real output was also yes.&lt;/li&gt;
&lt;li&gt;True Negatives: It is the case where we predicted No and the real output was also No.&lt;/li&gt;
&lt;li&gt;False Positives: It is the case where we predicted Yes but it was actually No.&lt;/li&gt;
&lt;li&gt;False Negatives: It is the case where we predicted No but it was actually Yes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;7.AUC-ROC: &lt;br&gt;
The Receiver Operating Characteristic (ROC) curve plots the true positive rate (TPR) against the false positive rate (FPR) at various threshold settings. The Area Under the Curve (AUC) of the ROC curve quantifies the model’s ability to distinguish between positive and negative classes.&lt;br&gt;
It focuses on the trade-off between precision and recall, which is particularly important when dealing with imbalanced datasets. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;True positive rate:&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Also called or termed sensitivity. True Positive Rate is considered as a portion of positive data points that are correctly considered as positive, with respect to all data points that are positive.&lt;/p&gt;

&lt;p&gt;2.True Negative Rate&lt;/p&gt;

&lt;p&gt;Also called or termed specificity. False Negative Rate is considered as a portion of negative data points that are correctly considered as negative, with respect to all data points that are negatives.&lt;/p&gt;

&lt;p&gt;3.False-positive Rate&lt;/p&gt;

&lt;p&gt;False Negatives rate is actually the proportion of actual positives that are incorrectly identified as negatives.&lt;/p&gt;

&lt;p&gt;8.Matthews Correlation Coefficient (MCC):&lt;/p&gt;

&lt;p&gt;The Matthews Correlation Coefficient is a metric that takes into account true positives, true negatives, false positives, and false negatives to provide a balanced measure of classification performance. It ranges from -1 (total disagreement) to 1 (perfect agreement), with 0 indicating no better than random chance.&lt;/p&gt;

&lt;p&gt;9.Log Loss (Logarithmic Loss):&lt;/p&gt;

&lt;p&gt;Log Loss, or Cross-Entropy Loss, is a metric used in the evaluation of probabilistic classifiers. It quantifies how well the predicted probabilities match the actual class labels. Lower log loss values indicate better model performance.&lt;br&gt;
It usually works well with multi-class classification. &lt;br&gt;
Working on Log loss, the classifier should assign a probability for each and every class of all the samples. If there are N  samples belonging to the M class, then we calculate the Log loss in this way:&lt;/p&gt;

&lt;p&gt;[Tex]LogarithmicLoss$=\frac{-1}{N} \sum_{i=1}^{N} \sum_{j=1}^{M} y_{i j} * \log \left(p_{i j}\right)$     [/Tex]&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;yij indicate whether sample i belongs to class j.&lt;/li&gt;
&lt;li&gt;pij : The probability of sample i belongs to class j.&lt;/li&gt;
&lt;li&gt;The range of log loss is [0,?). When the log loss is near 0 it indicates high accuracy and when away from zero then, it indicates lower accuracy.&lt;/li&gt;
&lt;li&gt;Minimizing log loss gives you higher accuracy for the classifier.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Regression Evaluation Metrics&lt;/strong&gt;&lt;br&gt;
Predicts the target variable which is in the form of continuous values. To evaluate the performance of such a model the evaluation metrics listed below are used:&lt;/p&gt;

&lt;p&gt;1.Mean Absolute Error(MAE)&lt;br&gt;
It is the average distance between Predicted and original values. Basically, it gives how we have predicted from the actual output. However, there is one limitation i.e. it doesn’t give any idea about the direction of the error which is whether we are under-predicting or over-predicting our data.&lt;/p&gt;

&lt;p&gt;2.Mean Squared Error(MSE)&lt;br&gt;
It is similar to mean absolute error but the difference is it takes the square of the average of between predicted and original values. The main advantage to take this metric is here, it is easier to calculate the gradient whereas, in the case of mean absolute error, it takes complicated programming tools to calculate the gradient. By taking the square of errors it pronounces larger errors more than smaller errors, we can focus more on larger errors.&lt;br&gt;
​&lt;br&gt;
3.Root Mean Square Error(RMSE)&lt;br&gt;
We can say that RMSE is a metric that can be obtained by just taking the square root of the MSE value. As we know that the MSE metrics are not robust to outliers and so are the RMSE values. This gives higher weightage to the large errors in predictions.&lt;/p&gt;

&lt;p&gt;4.Root Mean Squared Logarithmic Error(RMSLE)&lt;br&gt;
There are times when the target variable varies in a wide range of values. And hence we do not want to penalize the overestimation of the target values but penalize the underestimation of the target values. For such cases, RMSLE is used as an evaluation metric which helps us to achieve the above objective.&lt;/p&gt;

&lt;p&gt;5.R2 – Score&lt;br&gt;
The coefficient of determination also called the R2 score is used to evaluate the performance of a linear regression model. It is the amount of variation in the output-dependent attribute which is predictable from the input independent variable(s). It is used to check how well-observed results are reproduced by the model, depending on the ratio of total deviation of results described by the model.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Choosing the right classification metric depends on the problem you're solving. Accuracy is useful when classes are balanced, but in cases where false positives or false negatives have serious consequences, metrics like precision, recall, and F1 score are more reliable. The confusion matrix provides a detailed breakdown, while AUC-ROC helps evaluate model performance across different thresholds. Other metrics like MCC and Log Loss offer deeper insights, especially for imbalanced datasets or probabilistic models.&lt;/p&gt;

&lt;p&gt;For regression models, MAE, MSE, RMSE, and R²-score help evaluate predictions of continuous values. Each metric has its strengths, and selecting the right one ensures your model is not just working, but working well.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Summary&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Classification helps categorize data into classes.&lt;/li&gt;
&lt;li&gt;Common evaluation metrics include Accuracy, Precision, Recall, F1 Score, Specificity, AUC-ROC, and MCC.&lt;/li&gt;
&lt;li&gt;The choice of metric depends on the nature of the dataset and the impact of errors.&lt;/li&gt;
&lt;li&gt;Regression models predict continuous values and use metrics like MAE, MSE, RMSE, and R²-score for evaluation.&lt;/li&gt;
&lt;li&gt;Understanding these metrics ensures better model performance and more reliable results.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Chi-square Tests &amp; Calculating Degrees of Freedom.</title>
      <dc:creator>Michelle Njuguna</dc:creator>
      <pubDate>Mon, 10 Mar 2025 20:18:44 +0000</pubDate>
      <link>https://forem.com/michellenjeriscientist/chi-square-tests-calculating-degrees-of-freedom-24gb</link>
      <guid>https://forem.com/michellenjeriscientist/chi-square-tests-calculating-degrees-of-freedom-24gb</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let's learn Chi square tests with a twist. Are you a fan of Formula one? If yes then this will be a perfect article for you, if not it will help you learn a lot so don't be scared.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;What's a chi square test?&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;From Wikipedia ,&lt;strong&gt;Chi-Square test&lt;/strong&gt; is a non parametric statistical procedure for determining the difference between observed and expected data. &lt;br&gt;
It can also be used to decide whether the data correlates with our categorical variables. Thus helps to determine whether a difference between two categorical variables is due to chance or a relationship between them.&lt;/p&gt;

&lt;p&gt;It is one of the most widely used techniques for hypothesis testing. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Chi-square tests&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;The chi-square goodness of fit test&lt;/em&gt; is used to test whether the frequency distribution of a categorical variable is different from your expectations.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;The chi-square test of independence&lt;/em&gt; is used to test whether two categorical variables are related to each other.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The two types of Pearson’s chi-square tests test whether the observed frequency distribution of a categorical variable is significantly different from its expected frequency distribution. &lt;br&gt;
A frequency distribution describes how observations are distributed between different groups.&lt;br&gt;
&lt;em&gt;Frequency distributions&lt;/em&gt; are often displayed using frequency distribution tables. A frequency distribution table shows the number of observations in each group. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When to use a chi-square test&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Testing a hypothesis about one or more categorical variables. If one or more of your variables is quantitative, you should use a different statistical test. &lt;/li&gt;
&lt;li&gt;The sample was randomly selected from the population.&lt;/li&gt;
&lt;li&gt;There are a minimum of five observations expected in each group or combination of groups.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;How to Solve Chi-Square Problems?&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;State the Hypotheses&lt;br&gt;
Null hypothesis (H0): There is no association between the variables&lt;br&gt;
Alternative hypothesis (H1): There is an association between the variables.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Calculate the Expected Frequencies&lt;br&gt;
Use the formula: E=(Row Total×Column Total)Grand TotalE = \frac{(Row \ Total \times Column \ Total)}{Grand \ Total}E=Grand Total(Row Total×Column Total)​&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Compute the Chi-Square Statistic&lt;br&gt;
Use the formula: χ2=∑(O−E)2E\chi^2 = \sum \frac{(O - E)^2}{E}χ2=∑E(O−E)2, where O is the observed frequency and E is the expected frequency.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Determine the Degrees of Freedom (df)&lt;br&gt;
Use the formula: df=(number of rows−1)×(number of columns−1)df = (number \ of \ rows - 1) \times (number \ of \ columns - 1)df=(number of rows−1)×(number of columns−1)&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Find the Critical Value and Compare&lt;br&gt;
Use the chi-square distribution table to find the critical value for the given df and significance level (usually 0.05).&lt;br&gt;
Compare the chi-square statistic to the critical value to decide whether to reject the null hypothesis.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Example of Use with Formula One&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Why We Use the Chi-Square Test&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;To analyze categorical data&lt;/strong&gt; - Many factors in Formula 1, such as tire choices, pit stop strategies and driver performance are categorical variables.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;To test independence&lt;/strong&gt; - The Chi-Square test can be used to determine if two categorical factors are related, such as whether race outcomes are dependent on specific tire strategies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;To compare expected vs. observed outcomes&lt;/strong&gt; - This helps determine if trends in Formula 1 results occur by chance or if they are statistically significant.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;When We Use the Chi-Square Test&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Team Performance vs. Engine Supplier&lt;/strong&gt;: Testing if certain engine suppliers (e.g., Mercedes, Ferrari, Honda) correlate with better race performance.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pit Stop Strategy vs. Race Results&lt;/strong&gt;: Checking if a team's pit stop strategy significantly affects their final position.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Driver Nationality vs. Team Preference&lt;/strong&gt;: Investigating if specific nationalities are more likely to be hired by particular teams.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Degrees of Freedom in Chi-Square Tests&lt;/strong&gt;&lt;br&gt;
Degrees of freedom play a crucial role in determining the validity of the Chi-Square test. In Formula 1, there are three main ways to calculate this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Contingency Tables (df = (rows - 1) * (columns - 1))&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Example: If we analyze tire choices (soft, medium, hard) across three different teams, the degrees of freedom would be (3-1) * (3-1) = 4.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Goodness-of-Fit Test (df = categories - 1)&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Example: If we test whether the distribution of podium finishes among 5 teams is as expected, the degrees of freedom would be 5-1 = 4.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Homogeneity Test (df = (number of groups - 1) * (number of categories - 1))&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Example: If we test whether wet weather races impact finishing positions differently across four different seasons, we calculate df as (4-1) * (2-1) = 3.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
The Chi-Square test is a valuable statistical tool for analyzing trends and associations in Formula 1. Whether it’s evaluating pit stop strategies or comparing team performance across different seasons, this method helps uncover patterns beyond random chance.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>datascience</category>
      <category>machinelearning</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Hypothesis Testing.</title>
      <dc:creator>Michelle Njuguna</dc:creator>
      <pubDate>Mon, 10 Mar 2025 20:15:45 +0000</pubDate>
      <link>https://forem.com/michellenjeriscientist/hypothesis-testing-2822</link>
      <guid>https://forem.com/michellenjeriscientist/hypothesis-testing-2822</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Have you ever disliked a dish yet you still have to eat it sometimes? Most of people dislike vegetables and would prefer not eating then yet  they are really good for our bodies. Now imagine machine learning and AI as a body and guess what the vegetables in question are, Mathematics specifically statistics.&lt;/p&gt;

&lt;p&gt;I know statistics might not be the most exciting part of AI for many people, but it’s the foundation of how machines learn and process data. I will try as much as I can to help you understand statistics and how major concepts work so that as we code ,we actually know what we are doing.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hypothesis Testing&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I believe hypothesis testing is the backbone of all models. It helps determine whether the problem you're solving is truly significant and proves if your solution is actually viable.&lt;/p&gt;

&lt;p&gt;From Wikipedia, Hypothesis Testing is a type of statistical analysis in which you put your assumptions about a population parameter to the test. It is used to estimate the relationship between 2 statistical variables.&lt;/p&gt;

&lt;p&gt;Example: In my intro, I made an assumption that most people do not like eating vegetables. I could perform tests to validate what I said by collecting and evaluating a representative sample from the data set under study. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Importance of Hypothesis Testing&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Avoiding Misleading Conclusions and Making Smart Decisions.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Imagine you're an oncologist with a new method for testing cancer. Two patients, Patient A and Patient B, come in for testing. Patient A is actually healthy, but your test incorrectly diagnoses them with cancer—this is a Type I error (false positive). On the other hand, Patient B does have cancer, but your test fails to detect it, and you send them home thinking they're fine—this is a Type II error (false negative).&lt;/p&gt;

&lt;p&gt;2.Optimizing Business Tactics.&lt;/p&gt;

&lt;p&gt;It is invaluable for testing new ideas and strategies before fully committing to them. Example: Checking whether investing in a model that predicts early signs of cancer would bring a heath institution more patients who would want to be screened. Hence bringing new clients.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Hypothesis Testing Formula&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Z = ( x̅ – μ0 ) / (σ /√n)&lt;/p&gt;

&lt;p&gt;x̅ = sample mean,&lt;br&gt;
μ0= population mean,&lt;br&gt;
σ = standard deviation,&lt;br&gt;
n= sample size.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Formulating a Hypothesis&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Null Hypothesis (H0): This is the default assumption that there is no effect or difference.&lt;br&gt;
Alternative Hypothesis (Ha): This is the hypothesis that there is an effect or difference.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choose the Significance Level (α)&lt;/strong&gt;&lt;br&gt;
The significance level, often denoted by alpha (α), is the probability of rejecting the null hypothesis when it is true. Common choices for α are 0.05 (5%), 0.01 (1%), and 0.10 (10%).&lt;/p&gt;

&lt;p&gt;The significance level (α) directly controls the probability of a Type I error. Decreasing α reduces the chance of Type I errors but increases the risk of Type II errors.&lt;/p&gt;

&lt;p&gt;To balance these errors:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Adjust the significance level based on the consequences of each error type.&lt;/li&gt;
&lt;li&gt;Increase sample size to improve the power of the test.&lt;/li&gt;
&lt;li&gt;Use one-tailed tests when appropriate.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;2. Select the Appropriate Test&lt;/strong&gt;&lt;br&gt;
Choose a statistical test based on the type of data and the hypothesis. Common tests include t-tests, chi-square tests, ANOVA, and regression analysis. The selection depends on data type, distribution, sample size, and whether the hypothesis is one-tailed or two-tailed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Collect Data&lt;/strong&gt;&lt;br&gt;
Gather the data that will be analyzed in the test.This data should be representative of the population.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4.Calculate the Test Statistic&lt;/strong&gt;&lt;br&gt;
Based on the collected data and the chosen test, calculate a test statistic that reflects how much the observed data deviates from the null hypothesis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Determine the p-value&lt;/strong&gt;&lt;br&gt;
The p-value is the probability of observing test results at least as extreme as the results observed, assuming the null hypothesis is correct.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6. Make a Decision&lt;/strong&gt;&lt;br&gt;
Compare the p-value to the chosen significance level:&lt;br&gt;
If the p-value ≤ α: Reject the null hypothesis, suggesting sufficient evidence in the data supports the alternative hypothesis.&lt;br&gt;
If the p-value &amp;gt; α: Do not reject the null hypothesis, suggesting insufficient evidence to support the alternative hypothesis.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Report the Results&lt;/strong&gt;&lt;br&gt;
Present the findings from the hypothesis test, including the test statistic, p-value, and the conclusion about the hypotheses.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Types of Hypothesis Testing&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Z Test&lt;br&gt;
It usually checks to see if two means are the same (the null hypothesis). Only when the population standard deviation is known and the sample size is 30 data points or more can a z-test be applied.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;T Test&lt;br&gt;
Compares the means of two groups. To determine whether two groups differ or if a procedure or treatment affects the population of interest.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Chi-Square &lt;br&gt;
To determine if the expected and observed results are well-fitted, the Chi-square test analyzes the differences between categorical variables from a random sample. The test's fundamental premise is that the observed values in your data should be compared to the predicted values that would be present if the null hypothesis were true.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;ANOVA&lt;br&gt;
Analysis of Variance, is a statistical method used to compare the means of three or more groups. It’s particularly useful when you want to see if there are significant differences between multiple groups.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Modern Approaches to Hypothesis Testing&lt;/strong&gt;&lt;br&gt;
In addition to traditional hypothesis testing methods, there are several modern approaches:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Permutation or randomization tests&lt;br&gt;
These tests involve randomly shuffling the observed data many times to create a distribution of possible outcomes under the null hypothesis. They are particularly useful when dealing with small sample sizes or when the assumptions of parametric tests are not met.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bootstrapping&lt;br&gt;
Bootstrapping is a resampling technique that involves repeatedly sampling with replacement from the original dataset. It can be used to estimate the sampling distribution of a statistic and construct confidence intervals.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Jackknife &lt;br&gt;
Jackknife is a cross-validation technique and therefore, a form of resampling. It is especially useful for bias and variance estimation. &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Monte Carlo simulation&lt;br&gt;
Monte Carlo methods use repeated random sampling to obtain numerical results. In hypothesis testing, they can be used to estimate p-values for complex statistical models or when analytical solutions are difficult to obtain.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
While statistical findings are important, it's also crucial to apply common sense when working with hypothesis testing. The practicality of your ideas will lead to better tests and more reliable conclusions. I do hope I have helped you like vegetables a little bit. Remember, with statistics, practice makes perfect, so keep solving as many problems as you can.&lt;/p&gt;

</description>
      <category>ai</category>
      <category>beginners</category>
      <category>python</category>
      <category>machinelearning</category>
    </item>
    <item>
      <title>Data protection, privacy and ethics.</title>
      <dc:creator>Michelle Njuguna</dc:creator>
      <pubDate>Sun, 09 Feb 2025 07:24:30 +0000</pubDate>
      <link>https://forem.com/michellenjeriscientist/data-protection-privacy-and-ethics-5gpj</link>
      <guid>https://forem.com/michellenjeriscientist/data-protection-privacy-and-ethics-5gpj</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Let’s start with a simple but unsettling thought:&lt;/p&gt;

&lt;p&gt;By now, I think we all know I am a woman. My reproductive health is deeply personal and the data around it for me is very sensitive. To track my period and ovulation, I use Flo. It is an app that helps me understand my body better during the different hormonal stages. Now imagine I get a call from a new gynecologist from a  hospital I’ve never been to talking to me about my symptoms that I logged into my app and telling me there are some irregularities and I need to do some tests at their hospital to confirm everything is ok.&lt;/p&gt;

&lt;p&gt;How do they know that? I never shared my data with them. When I investigate further, I find Flo my tracking app sold my personal health data to the hospital without my consent. I’d feel betrayed. I might uninstall the app, warn my friends or even take legal action. This isn’t just a hypothetical scenario. It actually happened.&lt;/p&gt;

&lt;p&gt;From Wikipedia, Flo was caught sharing women's health data tracking their reproductive changes to data with Facebook and Google without asking for permission in 2021. This was quite disturbing because a lot of sensitive data is shared by women on these apps and the fact that this data was given to third parties without consent and there was no openness in what it was being used for. Flo had to settle a case with the Federal Trade Commission but the damage was already done, thousands of women’s sensitive health information was exposed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why Does This Matter?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In today’s digital world, data is currency. Every time we use an app, shop online, or even just browse, we leave behind a trail of data. You know how we visit sites and you are offered cookies, well that's just how we share our data with different sites. Companies collect this data to improve services but some sell it for profit—often without us even knowing.&lt;/p&gt;

&lt;p&gt;This is where data privacy, protection, and ethics come in.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Data Privacy: 
Privacy is about who gets access to your information and how it’s used. &lt;/li&gt;
&lt;li&gt;Data Protection: 
Protection is about preventing unauthorized access. &lt;/li&gt;
&lt;li&gt;Data Ethics:
Ethics is about responsible data use. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Importance of Data Ethics&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Builds Trust&lt;/em&gt; – Ethical data practices strengthen customer and stakeholder trust.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Legal Compliance&lt;/em&gt; – Helps organizations follow laws like GDPR and CCPA avoiding penalties.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Risk Prevention&lt;/em&gt; – Reduces data breaches and misuse, preventing financial and reputational harm.&lt;/li&gt;
&lt;li&gt;_Social Responsibility _– Protects individuals from harm, bias or discrimination.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Principles of Data Ethics&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;_Privacy _– Collect and use personal data only with explicit consent.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Transparency&lt;/em&gt; – Be open about data collection, usage and policies.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Accountability&lt;/em&gt; – Take responsibility for data protection and any misuse.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Fairness&lt;/em&gt; – Ensure data practices are unbiased and do not discriminate.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Security&lt;/em&gt; – Protect data from unauthorized access or modifications.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Benefits of Ethical Data Practices&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;em&gt;Customer Loyalty&lt;/em&gt; – People trust and stay loyal to ethical businesses.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Competitive Edge&lt;/em&gt; – Ethical companies stand out from competitors.&lt;/li&gt;
&lt;li&gt;_Better Data Quality _– Ensures accuracy and accountability in data management.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Risk Reduction&lt;/em&gt; – Minimizes legal issues and reputational damage.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Encourages Innovation&lt;/em&gt; – A culture of integrity leads to long-term success.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;In an age where data is a powerful asset, ethical data practices are not just a legal requirement but a moral obligation. Organizations that prioritize privacy, transparency, accountability, fairness, and security not only build trust with their customers but also gain a competitive advantage in the long run. I hope you've gained some knowledge on data privacy, protection and ethics. Till next time!&lt;/p&gt;

</description>
      <category>data</category>
      <category>datascience</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
    <item>
      <title>Feature Engineering</title>
      <dc:creator>Michelle Njuguna</dc:creator>
      <pubDate>Wed, 11 Sep 2024 13:22:54 +0000</pubDate>
      <link>https://forem.com/michellenjeriscientist/feature-engineering-f4a</link>
      <guid>https://forem.com/michellenjeriscientist/feature-engineering-f4a</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hey there, today we are going to demystify feature engineering. It seems like a tough topic to cover but I hope at the end of this article you will at least understand the basics of it.&lt;/p&gt;

&lt;p&gt;From Wikipedia, &lt;strong&gt;Feature engineering&lt;/strong&gt; is a machine learning method that uses data to create new variables that are not included in the training set. &lt;br&gt;
It can generate new features for both supervised and unsupervised learning. &lt;br&gt;
Makes data transformations easier and faster while improving model's accuracy.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Feature engineering Techniques&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;Data Cleaning&lt;/em&gt;:  this is tidying up your data. You address missing information, correct errors, and remove any inconsistencies.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Data Transformation&lt;/em&gt;: this is data  reshaping or adjusting. Example:  scaling large numbers down or normalizing data so that it fits within a certain range. 
The important factor  is to make these changes without altering the data meaning.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Feature Extraction&lt;/em&gt;: This is where we explore existing data and create new features that can offer new insights. This makes the model simpler and faster without losing useful details.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Feature Selection&lt;/em&gt;:  involves picking out the pieces of data that are most closely related to your target prediction. This gets rid of unnecessary information, making the model more focused.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Feature Iteration&lt;/em&gt;: This is all about trial and error. The process of adding or removing certain features, test how they impact the model, and keep the ones that improve the model’s performance.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Types of Features in Machine Learning&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;em&gt;Numerical Features&lt;/em&gt;: These are numbers that can be measured, are straightforward and continuous in nature. Example : age.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Categorical Features&lt;/em&gt;: These are categorical. Example, eye color.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Time-series Features&lt;/em&gt;: data that is recorded over time. Example; Stocks.&lt;/li&gt;
&lt;li&gt;
&lt;em&gt;Text Features&lt;/em&gt;: these are features made from words or text. Example : Customer reviews&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
I hope I explained the terms well, I do believe this are the few things you need to know as a beginner theoretically. Next time we discuss feature engineering it will be on more practical terms.&lt;br&gt;
Till next time!&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>ai</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Movie Dataset Exploration and Visualization</title>
      <dc:creator>Michelle Njuguna</dc:creator>
      <pubDate>Tue, 10 Sep 2024 13:04:46 +0000</pubDate>
      <link>https://forem.com/michellenjeriscientist/movie-dataset-exploration-and-visualization-2cbc</link>
      <guid>https://forem.com/michellenjeriscientist/movie-dataset-exploration-and-visualization-2cbc</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Practice makes perfect&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Something that has a lot in common with being a data scientist. Theory is only one aspect of the equation; the most crucial aspect is putting theory into practice. I will make an effort to record today's entire process of developing my capstone project, which will involve studying a movie dataset. &lt;/p&gt;

&lt;p&gt;These are the objectives:&lt;br&gt;
&lt;strong&gt;Objective:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Download a movie dataset from Kaggle or retrieve it using the TMDb API.&lt;/li&gt;
&lt;li&gt;Explore various aspects such as movie genres, ratings, director popularity, and release year trends.&lt;/li&gt;
&lt;li&gt;Create dashboards that visualize these trends and optionally recommend movies based on user preferences.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;1. Data Collection&lt;/strong&gt;&lt;br&gt;
I decided to use Kaggle to find my dataset.It is crucial to keep in mind the crucial variables you will want for the dataset you are working with. Importantly, my dataset ought to include the following: trends in release year, popularity of directors, ratings, and movie genres. As a result, I must make sure the dataset I choose has the following, at the very least.&lt;br&gt;
My dataset was located on Kaggle, and I'll provide the link below. You can obtain the CSV version of the file by downloading the dataset, unzipping it, and extracting it. You can look over it to comprehend what you already have and to truly realize what kinds of insights you hope to obtain from the data you will be examining.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.kaggle.com/datasets/shivamb/netflix-shows" rel="noopener noreferrer"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Describing the data&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;First, we must import the required libraries and load the necessary data. I'm using the Python programming language and Jupyter Notebooks for my project so that I can write and see my code more efficiently.&lt;br&gt;
You will import the libraries that we will be using and load the data as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flq0osn5maiym61mnlzdw.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flq0osn5maiym61mnlzdw.JPG" alt="Image description" width="800" height="278"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We will then run the following command to get more details about our dataset.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data.head() # dispalys the first rows of the dataset.
data.tail() # displays the last rows of the dataset.
data.shape # Shows the total number of rows and columns.
len(data.columns)  # Shows the total number of columns.
data.columns # Describes different column names.
data.dtypes # Describes different data types.


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

&lt;/div&gt;



&lt;p&gt;We now know what the dataset comprises and the insights we hope to extract after obtaining all the descriptions we require. Example: Using my dataset, I wish to investigate patterns in the popularity of directors, ratings distribution, and movie genres. I also want to suggest movies depending on user-selected preferences, such as preferred directors and genres.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Data Cleaning&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This phase involves finding any null values and removing them. In order to move on with data visualization, we will also examine our dataset for duplicates and remove any that we find. To do this, we'll run the code that follows:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;1. data['show_id'].value_counts().sum() # Checks for the total number of rows in my dataset
2. data.isna().sum() # Checks for null values(I found null values in director, cast and country columns)
3. data[['director', 'cast', 'country']] = data[['director', 'cast', 'country']].replace(np.nan, "Unknown ") # Fill null values with unknown.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We will then drop the rows with unknown values and confirm we have dropped all of them. We will also check the number of rows remaining that have cleaned data.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm3lvxkq1jjyf4zktq0ln.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm3lvxkq1jjyf4zktq0ln.JPG" alt="Image description" width="800" height="261"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code that follows looks for unique characteristics and duplicates. Although there are no duplicates in my dataset, you might still need to utilize it in case future datasets do.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;data.duplicated().sum() # Checks for duplicates
data.nunique() # Checks for unique features
data.info # Confirms if nan values are present and also shows datatypes.
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;My date/time data type is an object and I would like for it  to be in the proper date/time format so I used&lt;code&gt;&lt;br&gt;
data['date_added']=data['date_added'].astype('datetime64[ms]')&lt;/code&gt;to convert it to the proper format.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Data Visualization&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;My dataset has two types of variables namely the TV shows and Movies in the types and I used a bar graph to present the categorical data with the values that they represent. &lt;br&gt;
&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7hib0lo1yinu497cgxu.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fq7hib0lo1yinu497cgxu.JPG" alt="Image description" width="800" height="658"&gt;&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;I also used a pie chart to represent the same as above. The code used is as follows and the outcome expected shown below.&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;## Pie chart display
plt.figure(figsize=(8, 8))  
data['type'].value_counts().plot(
    kind='pie', 
    autopct='%1.1f%%',  
    colors=['skyblue', 'lightgreen'], 
    startangle=90, 
    explode=(0.05, 0) 
)
plt.title('Distribution of Content Types (Movies vs. TV Shows)')
plt.ylabel('')
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;


&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F92l1hado46an72swajpw.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F92l1hado46an72swajpw.JPG" alt="Image description" width="800" height="789"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I then did a tabled comparison using &lt;code&gt;pd.crosstab(data.type, data.country)&lt;/code&gt; to create a tabled comparison of the types based on release dates, countries, and other factors (you can try changing the columns in the code independently). Below are the code to use and the expected comparison. I also checked the first 20 countries leading in the production of Tv Shows and and visualized them in a bar graph.You can copy the code in the image and ensure the outcome is almost similar to mine.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm5nrhg2zd9mazt7rsiu3.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm5nrhg2zd9mazt7rsiu3.JPG" alt="Image description" width="800" height="451"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3lx9dz9pwyf30lib1o70.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3lx9dz9pwyf30lib1o70.JPG" alt="Image description" width="800" height="808"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I then checked for the top 10 movie genre as shown below. You can also use the code to check for TV shows. Just substitute with proper variable names.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyo8m0o6r1170yr34xs51.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fyo8m0o6r1170yr34xs51.JPG" alt="Image description" width="800" height="472"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;I extracted months and years separately from the dates provided so that I could visualize some histogram plots over the years.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8pj6b9bkxvgjvzhyvf0n.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8pj6b9bkxvgjvzhyvf0n.JPG" alt="Image description" width="800" height="835"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3c89mpmy2cgu527h148z.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3c89mpmy2cgu527h148z.JPG" alt="Image description" width="800" height="323"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27byj1sdtfbrdnq9i6qz.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F27byj1sdtfbrdnq9i6qz.JPG" alt="Image description" width="800" height="499"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checked for the top 10 directors with the most movies and compared them using a bar graph.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1kcicshseuivtf76m57u.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1kcicshseuivtf76m57u.JPG" alt="Image description" width="800" height="558"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Checked for the cast with the highest rating and visualized them.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0erjncptampoyux9lskn.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0erjncptampoyux9lskn.JPG" alt="Image description" width="800" height="518"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5. Recommendation System&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I then built a recommendation system that takes in genre or director's name as input and produces a list of movies as per the user's preference. If the input cannot be matched by the algorithm then the user is notified.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flrdoozlnkx680i8ivm05.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flrdoozlnkx680i8ivm05.JPG" alt="Image description" width="800" height="743"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The code for the above is 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;def recommend_movies(genre=None, director=None):
    recommendations = data
    if genre:
        recommendations = recommendations[recommendations['listed_in'].str.contains(genre, case=False, na=False)]
    if director:
        recommendations = recommendations[recommendations['director'].str.contains(director, case=False, na=False)]
    if not recommendations.empty:
        return recommendations[['title', 'director', 'listed_in', 'release_year', 'rating']].head(10)
    else:
        return "No movies found matching your preferences."
print("Welcome to the Movie Recommendation System!")
print("You can filter movies by Genre or Director (or both).")
user_genre = input("Enter your preferred genre (or press Enter to skip): ")
user_director = input("Enter your preferred director (or press Enter to skip): ")
recommendations = recommend_movies(genre=user_genre, director=user_director)
print("\nRecommended Movies:")
print(recommendations)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;My goals were achieved, and I had a great time taking on this challenge since it helped me realize that, even though learning is a process, there are days when I succeed and fail. This was definitely a success. Here, we celebrate victories as well as defeats since, in the end, each teach us something. Do let me know if you attempt this.&lt;br&gt;
Till next time!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Note!!&lt;/strong&gt;&lt;br&gt;
The code is in my GitHub:&lt;br&gt;
&lt;a href="https://github.com/MichelleNjeri-scientist/Movie-Dataset-Exploration-and-Visualization" rel="noopener noreferrer"&gt;https://github.com/MichelleNjeri-scientist/Movie-Dataset-Exploration-and-Visualization&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Kaggle dataset is:&lt;br&gt;
&lt;a href="https://www.kaggle.com/datasets/shivamb/netflix-shows" rel="noopener noreferrer"&gt;https://www.kaggle.com/datasets/shivamb/netflix-shows&lt;/a&gt;&lt;/p&gt;

</description>
      <category>python</category>
      <category>beginners</category>
      <category>machinelearning</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Demystifying Data Science: The Ultimate Guide!</title>
      <dc:creator>Michelle Njuguna</dc:creator>
      <pubDate>Tue, 10 Sep 2024 11:22:02 +0000</pubDate>
      <link>https://forem.com/michellenjeriscientist/demystifying-data-science-5gf5</link>
      <guid>https://forem.com/michellenjeriscientist/demystifying-data-science-5gf5</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hey there! Today I will be sharing what I believe to be the key skills an expert in Data Science should posses. This will be a follow through to the article I did for the beginner's guide so if you missed it, I will share the link below.&lt;/p&gt;

&lt;p&gt;[(&lt;a href="https://dev.to/michellenjeriscientist/demystifying-data-science-a-beginners-guide-pa6)"&gt;https://dev.to/michellenjeriscientist/demystifying-data-science-a-beginners-guide-pa6)&lt;/a&gt;]&lt;/p&gt;

&lt;p&gt;According to Wikipedia ,Data Science &lt;em&gt;is an interdisciplinary field focused on extracting knowledge from typically large data sets and applying the knowledge and insights from that data to solve problems in a wide range of application domains.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;A Data Scientist is responsible for many roles in an organization like business analytics, building data products, developing visualizations, ML algorithms and more. I do believe the first step is to actually understand the different roles of different data specialists so that you know what peaks your interest. These data specializations are; data analyst, data scientist, data administrator, data architect, business analyst, business intelligence manager, data/analytics manager.&lt;/p&gt;

&lt;p&gt;The following are important skills you must have as a data scientist:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Mastering programming languages like R or Python&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Python and R are both free, open-source languages. They both, run smoothly on most common operating systems i.e. Linus, macOS and Windows. Both languages have a long list of functionalities and can easily take on any data analysis task. Beginner or expert, the languages are easy to learn and execute. &lt;br&gt;
Python is a general-purpose, object-oriented programming language. Its easy syntax makes it perfect for collaborations. It ensures smooth execution of tasks with flexibility, stability and code readability.&lt;br&gt;
R is a popular statistical programming language that is built to facilitate computing and data visualization. R has numerous abilities, including statistical analysis, visualization of data and manipulating data.&lt;br&gt;
You can compare the two and choose what best works for you.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Statistics and Applied Mathematics.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Statistics and data science are fields of applied mathematics designed to interpret data in all its many forms. This is done by applying mathematical models and statistical theory that relate the data at hand to the underlying questions and often hidden features of interest. A key advantage of statistical science is the ability to quantify the uncertainty in a prediction or decision and for decision making this aspect is often as important as the estimate itself. &lt;/p&gt;

&lt;p&gt;A simpler summary of this from Wikipedia &lt;em&gt;From hypothesis testing to regression analysis, statistical methods enable professionals to validate hypotheses, quantify uncertainties, and draw conclusions with confidence.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Working Knowledge of Hadoop and Spark.&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Apache Hadoop&lt;/strong&gt; is an open-source software utility that allows users to manage big data sets by enabling a network of computers to solve vast and intricate data problems. &lt;br&gt;
It is a highly scalable, cost-effective solution that stores and processes structured, semi-structured and unstructured data.&lt;/p&gt;

&lt;p&gt;Benefits of the Hadoop framework include the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Data protection amid a hardware failure.&lt;/li&gt;
&lt;li&gt;Vast scalability from a single server to thousands of machines.&lt;/li&gt;
&lt;li&gt;Real-time analytics for historical analyses and decision-making processes.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Apache Spark&lt;/strong&gt; is a data processing engine for big data sets. Like Hadoop, Spark splits up large tasks across different nodes. However, it tends to perform faster than Hadoop and it uses random access memory ( to cache and process data instead of a file system. This enables Spark to handle use cases that Hadoop cannot.&lt;/p&gt;

&lt;p&gt;Benefits of the Spark framework include the following:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A unified engine that supports SQL queries, streaming data, machine learning (ML) and graph processing.&lt;/li&gt;
&lt;li&gt;Can be 100x faster than Hadoop for smaller workloads via in-memory processing, disk data storage, etc.&lt;/li&gt;
&lt;li&gt;APIs designed for ease of use when manipulating semi-structured data and transforming data&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These systems are two of the most prominent distributed systems for processing data on the market today. Hadoop is used mainly for disk-heavy operations with the MapReduce paradigm, and Spark is a more flexible, but more costly in-memory processing architecture. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Databases: SQL and NoSQL.&lt;/strong&gt;&lt;br&gt;
As a data scientist, it is generally recommended to learn both SQL and NoSQL databases, as they serve different purposes and are often used in complementary ways.&lt;/p&gt;

&lt;p&gt;SQL (Structured Query Language) databases, such as PostgreSQL, MySQL, and Oracle, are well-suited for structured, tabular data and are widely used for data storage, management, and retrieval. They excel at performing complex queries, ensuring data integrity, and supporting transactions.&lt;br&gt;
NoSQL databases, such as MongoDB, Cassandra, and Elasticsearch, are designed to handle unstructured, semi-structured, or rapidly changing data that does not fit well into the rigid structure of traditional SQL databases. NoSQL databases offer features like horizontal scalability, flexible schema, and high availability.&lt;/p&gt;

&lt;p&gt;As a data scientist, having expertise in both SQL and NoSQL databases can be advantageous, as it allows you to choose the appropriate database technology for a given problem or dataset. By learning both SQL and NoSQL, data scientists can:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Gain a deeper understanding of data storage and management techniques.&lt;/li&gt;
&lt;li&gt;Become more versatile in adapting to different data requirements and use cases.&lt;/li&gt;
&lt;li&gt;Leverage the strengths of each database type to build robust and scalable data solutions.&lt;/li&gt;
&lt;li&gt;Seamlessly integrate SQL and NoSQL databases within their data architecture.&lt;/li&gt;
&lt;li&gt;Enhance their ability to work with diverse data sources and formats.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;5. Machine Learning and Neural Networks.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Machine learning and data science are inextricably linked. Machine learning is defined as a machine's ability to extract knowledge from data. Machines can't learn much if they don't have any data. If anything, the growing use of machine learning in a variety of industries will act as a catalyst for data science to grow dramatically. Data scientists are expected to have a basic understanding of machine learning.&lt;/p&gt;

&lt;p&gt;From Wikipedia &lt;em&gt;a neural network is a method for performing machine learning tasks, training a computer with labelled training data.&lt;/em&gt; In other words, a computer program can learn to make decisions based on a model it builds from a training dataset._ A common goal for data scientists in artificial intelligence is to be able to classify data and associate data to different categories. Neural networks help us develop powerful algorithms that can achieve this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;6.Proficiency in Deep Learning Frameworks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Deep learning is a subset of ML that has been proven successful in helping recognize data patterns. It’s termed as a neural network-based approach that will allow computers to learn to do things independently rather than being programmed by humans. &lt;br&gt;
Experts forecast deep learning to become the dominant technique for data analysis in the coming few years. Its impact on data science will be significant. &lt;br&gt;
Deep Learning algorithms can learn more from data than traditional ML analytics and algorithms, because they can learn not only from data input but also from the hidden layers of data that will present higher-level concepts.&lt;br&gt;
In addition, deep learning algorithms would be trained on massive datasets, which gives them an advantage over traditional ML algorithms which are struggling with big data. &lt;br&gt;
Deep learning is likely to become the dominant data analysis technique across all domains in the near future.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;7. Creative Thinking &amp;amp; Industry Knowledge.&lt;/strong&gt;&lt;br&gt;
A data scientist requires a foundation of technical skills. These include the ability to interpret, manipulate, and extract meaning from data, and then use it to build predictive models and generate business insights. Creativity in data science can be seen in anything from innovative modeling, thinking up original ways to collect data, developing new tools, and being able to visualize data process a few years down the line. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Learning all these skills will take time, but they are definitely essential for wholesome growth in the Data Science field. Take your time, learn your track, put in the work and watch the magic unfold.&lt;br&gt;
Till next time!&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>machinelearning</category>
      <category>python</category>
      <category>learning</category>
    </item>
    <item>
      <title>Demystifying Data Science: The Ultimate Guide!</title>
      <dc:creator>Michelle Njuguna</dc:creator>
      <pubDate>Sat, 24 Aug 2024 08:52:53 +0000</pubDate>
      <link>https://forem.com/michellenjeriscientist/demystifying-data-science-the-ultimate-guide-2gco</link>
      <guid>https://forem.com/michellenjeriscientist/demystifying-data-science-the-ultimate-guide-2gco</guid>
      <description></description>
    </item>
    <item>
      <title>Understanding Your Data: The Essentials of Exploratory Data Analysis</title>
      <dc:creator>Michelle Njuguna</dc:creator>
      <pubDate>Sun, 11 Aug 2024 20:17:32 +0000</pubDate>
      <link>https://forem.com/michellenjeriscientist/understanding-your-data-the-essentials-of-exploratory-data-analysis-1l1c</link>
      <guid>https://forem.com/michellenjeriscientist/understanding-your-data-the-essentials-of-exploratory-data-analysis-1l1c</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;According to Wikipedia, &lt;em&gt;Exploratory data analysis is an analysis approach that identifies general patterns in the data. These patterns include outliers and features of the data that might be unexpected.&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;EDA is an approach to data in order to:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Summarize the main characteristics of data&lt;/li&gt;
&lt;li&gt;Gain better understanding of the dataset&lt;/li&gt;
&lt;li&gt;Uncover relationships between different variables and extract important variables in the problems we are trying to solve.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Important EDA techniques that we will discuss are as follows:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Descriptive Statistics.&lt;/li&gt;
&lt;li&gt;Grouping data by use of Group by to transform the dataset.&lt;/li&gt;
&lt;li&gt;Correlation.&lt;/li&gt;
&lt;li&gt;Advanced Correlation.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;1. Descriptive Statistics&lt;/strong&gt;&lt;br&gt;
This is a branch of statistics that involves summarizing, organizing, and presenting data meaningfully and concisely.&lt;br&gt;
Before understanding our dataset, we must first import the relevant libraries we are to use and load the data. Mine was an excel sheet so I loaded it as shown below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb25hwo9fjn3kc3kkjj0d.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb25hwo9fjn3kc3kkjj0d.JPG" alt="Image description" width="800" height="234"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Before building models, we need to first understand the data we have. This is why we do descriptive statistics. The following functions are important as they help with the process:&lt;br&gt;
&lt;code&gt;**data.describe**&lt;/code&gt; - helps us take a look at all the numerical functions of the dataset. As per my dataset below, you can see what output it gives. I have added include all to also check on the categorical variable summary.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gffe8j8uohwc5lfgyor.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F6gffe8j8uohwc5lfgyor.JPG" alt="Image description" width="800" height="437"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;**value_counts**&lt;/code&gt;- Checks categorical variables in our dataset. These variables are those that can be divided into different groups and have discrete values. When you run the code, it will show you the outcome of your dataset as below.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgl2uerwime5f4aoqd0g7.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fgl2uerwime5f4aoqd0g7.JPG" alt="Image description" width="800" height="410"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Boxplots&lt;/strong&gt;&lt;br&gt;
A great way to visualize numeric data since you can visualize various distribution of the data. A box plot shows a set of five descriptive statistics of the data: the minimum and maximum values (excluding the outliers), the median, and the first and third quartiles. Optionally, it can also show the mean value. &lt;br&gt;
It is the right choice if you're interested only in these statistics, without digging into the real underlying data distribution.Here is how I generated my boxplot. You can substitute with the details in your dataset.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Assuming 'data' is your DataFrame and 'Temp_C' is the column for temperature
plt.figure(figsize=(8, 6))
sns.boxplot(y=data['Temp_C'])
plt.title('Boxplot of Temperature (°C)')
plt.ylabel('Temperature (°C)')
plt.grid(True)
plt.show()

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Scatter Plot&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;We use scatter plots to visualize continuous variables.Each value in the data set is represented by a dot.&lt;/p&gt;

&lt;p&gt;Lets draw a simple scatter plot where x represents the age of the car and y the speed of the car.(Remember to import all the libraries to be used, for this, you'll need Matplotlib.)&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
x = [5,7,8,7,2,17,2,9,4,11,12,9,6]-independent variable
y = [99,86,87,88,111,86,103,87,94,78,77,85,86] - dependent variable
plt.scatter(x, y)
plt.show()

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

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;2. Group By&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Works with categorical variables. It is used for grouping the data according to the categories and applying a function to the categories. It helps to aggregate data efficiently.&lt;br&gt;
It makes the task of splitting the Dataframe over some criteria really easy and efficient. &lt;br&gt;
In my dataset below, I needed the mean of the weather_conditions for all the elements in my dataset.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0wvpedaentw6xqt2itfp.JPG" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F0wvpedaentw6xqt2itfp.JPG" alt="Image description" width="800" height="515"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Heatmap Plot&lt;/strong&gt;&lt;br&gt;
A heatmap is a table-style data visualization type where each numeric data point is depicted based on a selected color scale and according to the data point's magnitude within the dataset.&lt;br&gt;
These plots illustrate potential hot and cold spots of the data that may require special attention.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;plt.pcolor(df_pivot, cmap="RdBu")
plt.colorbar()
plt.show()
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Correlation&lt;/strong&gt;&lt;br&gt;
We use correlation to check the level of interdependence of variables.&lt;br&gt;
&lt;strong&gt;Correlation&lt;/strong&gt; is a statistical metric for measuring to what extent different variables are interdependent. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Advanced Correlation&lt;/strong&gt;&lt;br&gt;
We can measure the strength of the correlation between continuous numerical variables is by using Pearson Correlation.&lt;br&gt;
Pearson Correlation method gives you two values;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;&lt;u&gt;correlation coefficient&lt;/u&gt;&lt;/strong&gt;
&lt;em&gt;a value close to 1 shows a large positive correlation, while a value close to -1 implies a large negative correlation, and a value close to 0 implies no correlation between the variables.&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;&lt;u&gt;p-value&lt;/u&gt;&lt;/strong&gt;
&lt;em&gt;tells us how certain we are about the correlation that we calculated.
For the p-value, a value less than 0.001 gives us a strong certainty about the correlation coefficient that we calculated, a value between 0.001 and 0.05 gives us moderate certainty, a value between 0.05 and 0.1 will give us a weak certainty, and a p-value larger than 0.1 will give us no certainty of correlation at all.&lt;/em&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We can say that there is a strong correlation when the correlation coefficient is close to one or -1 and the p-value is less than 0.001.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>datascience</category>
      <category>computerscience</category>
      <category>python</category>
    </item>
    <item>
      <title>Demystifying Data Science: A Beginner’s Guide!</title>
      <dc:creator>Michelle Njuguna</dc:creator>
      <pubDate>Sun, 04 Aug 2024 09:32:03 +0000</pubDate>
      <link>https://forem.com/michellenjeriscientist/demystifying-data-science-a-beginners-guide-pa6</link>
      <guid>https://forem.com/michellenjeriscientist/demystifying-data-science-a-beginners-guide-pa6</guid>
      <description>&lt;p&gt;&lt;strong&gt;Introduction&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Hey there! I'm Michelle, and I like to call myself a data enthusiast! Data science might sound intimidating, but it’s not. I’ve been where you are now, staring at the screen with that “where do I even begin?” look. But don’t worry, I’m here to guide you through this journey.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What Is Data Science?&lt;/strong&gt;&lt;br&gt;
We first need to understand data. &lt;strong&gt;&lt;u&gt;Data &lt;/u&gt;&lt;/strong&gt;is a very broad term that can refer to raw facts, process data or information. &lt;br&gt;
There are two types of data:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Traditional data- structured data.&lt;/li&gt;
&lt;li&gt;Big data- unstructured data. With Big Data came the evolution of Data analysis roles like Data Science and Machine learning.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;According to Wikipedia, &lt;em&gt;Data science is an interdisciplinary academic field that uses statistics, scientific computing, scientific methods, processes, scientific visualization, algorithms and systems to extract or extrapolate knowledge and insights from potentially noisy, structured, or unstructured data.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;In simpler terms, data science is all about discovering hidden insights in data and making predictions for the future.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Data Science&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;u&gt;Business Intelligence&lt;/u&gt; (BI): studies the numbers and explains where and why some things went well and others not so well. Having the business context in mind, the business intelligence analyst will present the data in the form of reports and dashboards(translates raw data).&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Traditional Methods&lt;/u&gt;: were designed prior to the existence of big data, where the technology simply wasn't as advanced as it is today. They involve applying statistical approaches to create predictive models.
3.&lt;u&gt;Machine Learning&lt;/u&gt; (ML): utilizing unconventional methods or A.I., to predict behavior in unprecedented ways, using machine learning techniques and tools.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Traditional Data&lt;/strong&gt;&lt;br&gt;
A a quick run-down of how to handle traditional data:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;u&gt;Data Collection&lt;/u&gt;: Start with gathering your raw data. This could be survey responses, sales records etc. &lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Data Preprocessing&lt;/u&gt;: Now that you’ve got your data, it’s time to clean it up. This is like sorting through a pile of maize after harvesting. For example, sales numbers are numerical data, while customer feedback is categorical.
3.
&lt;u&gt; Data Cleansing&lt;/u&gt;: Sometimes, your data is messy—maybe someone wrote "two" instead of "2" or mistyped a name. Cleansing is all about fixing inconsistencies. &lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Balancing&lt;/u&gt;: If you’ve got uneven data you need to balance it out so your results aren’t skewed or bias. &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Big Data&lt;/strong&gt;&lt;br&gt;
Wikipedia states that &lt;em&gt;With 619 million active users, X creates around 12 TB daily. X, formerly known as Twitter, generates about 4.3 PB annually. The social media platform amasses around 500 million tweets daily, amounting to 560 GB of data.&lt;/em&gt; &lt;br&gt;
This is just twitter so you can imagine how much data is put out there on other platforms on a daily! And it is growing everyday. The data has different forms hence it is unstructured and maybe now you can understand why Data is classified under 3 V’s namely;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Volume refers to the amount of data. &lt;/li&gt;
&lt;li&gt;Velocity refers to the speed of data processing.&lt;/li&gt;
&lt;li&gt;Variety refers to the number of types of data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;How to handle Big Data&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Text Mining: the process of deriving valuable, unstructured data from a text. &lt;/li&gt;
&lt;li&gt;Data Masking: maintaining a credible business or governmental activity by preserving confidential information.&lt;/li&gt;
&lt;li&gt;Predictive Analytics
Predictive analytics is looking into the future using data. You can do this with traditional statistical methods or with machine learning.
&lt;u&gt;Traditional Methods&lt;/u&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;ul&gt;
&lt;li&gt;Regression: is a model used for quantifying causal relationships among the different variables included in your analysis.&lt;/li&gt;
&lt;li&gt;Clustering: Grouping similar things together.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;Machine Learning&lt;/strong&gt;&lt;br&gt;
Training computers to learn from data and make predictions without being explicitly programmed.&lt;/p&gt;

&lt;p&gt;There are three main types of ML:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;u&gt;Supervised Learning&lt;/u&gt;: Works with labeled data to predict outcomes. Examples; support vector machines, neural networks, deep learning, random forest models and Bayesian networks are all types of supervised learning.&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Unsupervised Learning&lt;/u&gt;: works with unlabeled data to predict outcomes. Examples; There are neural networks that can be applied to an unsupervised type of machine learning, but K-means is the most common unsupervised approach.&lt;/li&gt;
&lt;li&gt;
&lt;u&gt;Reinforcement Learning&lt;/u&gt;: Training models with rewards and punishments.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;em&gt;Deep learning is divided in supervised, unsupervised and reinforcement learning.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Wrapping Up&lt;/strong&gt;&lt;br&gt;
I know—it’s a lot. But remember, every expert was once a beginner. Keep experimenting, and don’t be afraid to make mistakes. That’s how you learn!&lt;/p&gt;

&lt;p&gt;That’s it for now! Stay tuned for more articles where we’ll dive deeper into these topics. &lt;/p&gt;

</description>
      <category>beginners</category>
      <category>bigdata</category>
      <category>ai</category>
      <category>deeplearning</category>
    </item>
  </channel>
</rss>
