<?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: Zima Blue</title>
    <description>The latest articles on Forem by Zima Blue (@nderitugichuki).</description>
    <link>https://forem.com/nderitugichuki</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%2F1754813%2F7b5f95fc-b834-42a8-924e-895dfe972f4a.JPG</url>
      <title>Forem: Zima Blue</title>
      <link>https://forem.com/nderitugichuki</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/nderitugichuki"/>
    <language>en</language>
    <item>
      <title>Why Most ML Projects Stay Idle in Notebooks: Overcoming Deployment Challenges and Taking Your Models to Production</title>
      <dc:creator>Zima Blue</dc:creator>
      <pubDate>Sat, 30 Nov 2024 18:43:53 +0000</pubDate>
      <link>https://forem.com/nderitugichuki/why-most-ml-projects-stay-idle-in-notebooks-overcoming-deployment-challenges-and-taking-your-4ego</link>
      <guid>https://forem.com/nderitugichuki/why-most-ml-projects-stay-idle-in-notebooks-overcoming-deployment-challenges-and-taking-your-4ego</guid>
      <description>&lt;h3&gt;
  
  
  Introduction:
&lt;/h3&gt;

&lt;p&gt;Machine learning (ML) has taken the world by storm, with data scientists and engineers developing powerful models that promise to solve some of the most pressing challenges across industries. The possibilities seem endless, whether it’s predicting customer churn, classifying images, or analyzing medical data. However, despite the excitement of creating these models, many ML projects often remain idle, stuck in Jupyter notebooks and never make it to production.&lt;/p&gt;

&lt;p&gt;As an ML engineer, you’ve probably found yourself in this situation—where you've spent countless hours fine-tuning a model and testing it in your local environment, only to have it sit untouched in a notebook, never deployed for real-world use. If this sounds familiar, you're not alone. It’s a common issue faced by many professionals in the field. &lt;/p&gt;

&lt;p&gt;In this article, we’ll explore the reasons why most ML projects stay idle and what prevents them from being deployed. We’ll also explore actionable solutions to counter these challenges, helping you easily move your models from the notebook to production.&lt;/p&gt;

&lt;h3&gt;
  
  
  1. The Excitement of Development vs. The Roadblock of Deployment
&lt;/h3&gt;

&lt;p&gt;As ML practitioners, we all know the excitement of starting a new project—cleaning the data, training models, and iterating on algorithms. But, at some point, that excitement begins to fade when faced with the complexities of deployment. The notebook that served as a playground for experimentation becomes a barrier to taking the model into real-world applications.&lt;/p&gt;

&lt;h4&gt;
  
  
  The Challenge of Transitioning from Research to Production
&lt;/h4&gt;

&lt;p&gt;In the world of ML, it’s easy to get caught up in the technical details of model development. The focus is often on finding the best-performing algorithm, tweaking hyperparameters, and ensuring the model achieves a high score on validation data. But deployment requires a different skill that involves system architecture, API development, cloud infrastructure, and scalability. &lt;/p&gt;

&lt;p&gt;Unfortunately, many data scientists and machine learning engineers are not well-versed in these areas, leading to the project stagnating in a notebook rather than moving forward into production.&lt;/p&gt;

&lt;h4&gt;
  
  
  Notebooks Aren’t Built for Production
&lt;/h4&gt;

&lt;p&gt;Jupyter notebooks are great for experimenting and testing ideas but they weren’t designed with deployment in mind. Code in a notebook is often messy, lacks modularity, and may depend on specific environments or datasets that don’t scale well in production. As a result, models developed in notebooks often need significant refactoring before they can be deployed in real-world systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. Why Do ML Projects Stay Idle in Notebooks?
&lt;/h3&gt;

&lt;h5&gt;
  
  
  Lack of Deployment Skills
&lt;/h5&gt;

&lt;p&gt;The gap between model development and deployment is primarily due to the lack of deployment skills. Many data scientists focus their energy on improving models and fine-tuning hyperparameters, but they don’t have the experience or knowledge to take their models to production.&lt;/p&gt;

&lt;p&gt;To deploy a model, ML engineers need expertise in several areas that aren't typically covered in machine learning coursework:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Containerization&lt;/strong&gt;: Docker helps package a model and its dependencies into a container, making it portable and scalable across different environments.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Development&lt;/strong&gt;: Frameworks like &lt;strong&gt;Flask&lt;/strong&gt; or &lt;strong&gt;FastAPI&lt;/strong&gt; are used to create web applications that serve ML models as APIs, allowing other systems or users to interact with them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Deployment&lt;/strong&gt;: Understanding cloud platforms (AWS, Google Cloud, Azure) and services (like Kubernetes for orchestration) is crucial for deploying models at scale.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD&lt;/strong&gt;: Implementing continuous integration and continuous deployment (CI/CD) pipelines ensures that models can be tested and deployed automatically when updates are made.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;However, many data scientists lack these skills, and as a result, they may avoid deployment altogether, leading to projects that never leave the notebook.&lt;/p&gt;

&lt;h5&gt;
  
  
  The Complexity of Deployment
&lt;/h5&gt;

&lt;p&gt;Deploying a machine learning model is often more complicated than simply running it in a notebook. Here’s a breakdown of what’s involved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Infrastructure Setup&lt;/strong&gt;: Deploying a model often requires setting up cloud infrastructure or servers, configuring databases, and ensuring data pipelines are set up correctly.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Model Serving&lt;/strong&gt;: You’ll need to expose your model as a service (usually via an API) so that it can accept inputs and return predictions. This is typically done with Flask or FastAPI.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Scalability&lt;/strong&gt;: Production environments need to handle traffic spikes, data storage, and real-time predictions, which requires knowledge of how to scale systems.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring and Maintenance&lt;/strong&gt;: In production, models need to be monitored for performance degradation over time, as real-world data may differ from the training data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This complexity often causes developers to hesitate, choosing to leave models in notebooks where things seem simpler.&lt;/p&gt;

&lt;h5&gt;
  
  
  Time and Resource Constraints
&lt;/h5&gt;

&lt;p&gt;Deploying a machine learning model requires more than just writing code; it demands a significant investment of time and resources. Here’s what’s typically involved:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Time&lt;/strong&gt;: From setting up the environment to testing and debugging, deployment is time-consuming.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Resources&lt;/strong&gt;: You need access to cloud resources, databases, and potentially a DevOps team to set up the infrastructure and ensure scalability.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Ongoing Maintenance&lt;/strong&gt;: Once deployed, models require regular updates and retraining to account for data drift or changing requirements.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;These constraints can make deployment seem like an afterthought—especially when the model is already performing well in a local environment.&lt;/p&gt;

&lt;h5&gt;
  
  
  Fear of Model Failure in Production
&lt;/h5&gt;

&lt;p&gt;It’s natural to worry about whether a model will perform as well in production as it did during testing. Models that work well on historical data can encounter issues when exposed to real-time data or new, unseen scenarios. As a result, some engineers delay deployment to avoid the risk of model failure in production.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Overcoming the Deployment Challenges: A Step-by-Step Guide
&lt;/h3&gt;

&lt;p&gt;Deploying ML models doesn’t have to be a daunting task. By following a systematic approach and leveraging the right tools, you can streamline the deployment process and ensure that your models go from development to production smoothly.&lt;/p&gt;

&lt;h5&gt;
  
  
  Adopt a "Deployable by Design" Approach
&lt;/h5&gt;

&lt;p&gt;To avoid falling into the trap of only focusing on model accuracy, it’s essential to adopt a mindset where &lt;strong&gt;deployment is considered from the beginning&lt;/strong&gt; of the project. Here’s how you can do this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Modular Code&lt;/strong&gt;: Write clean, reusable code that is easy to maintain and refactor. Avoid tightly coupling your model to your notebook; instead, separate data processing, model training, and evaluation into different modules.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Version Control&lt;/strong&gt;: Use Git for version control to track changes in your code and model, making it easier to manage deployments and rollback when necessary.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Master Key Deployment Tools
&lt;/h5&gt;

&lt;p&gt;Learning the right tools for model deployment will equip you with the skills you need to get your models into production. Here are the essential tools you should master:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Docker&lt;/strong&gt;: Use Docker to containerize your models and ensure they work seamlessly across different environments. This makes it easier to deploy models to cloud platforms like AWS, Google Cloud, or Azure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;FastAPI/Flask&lt;/strong&gt;: These Python frameworks allow you to serve your models as RESTful APIs, enabling other applications to interact with them.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CI/CD Pipelines&lt;/strong&gt;: Set up pipelines with tools like GitHub Actions, Jenkins, or CircleCI to automate the testing and deployment of your models.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Start Small with Simple Deployments
&lt;/h5&gt;

&lt;p&gt;Instead of diving into complex projects, start with simpler models that are easy to deploy. For example, create a basic classification model and deploy it using FastAPI or Flask. This gives you hands-on experience with deployment tools and helps build your confidence.&lt;/p&gt;

&lt;h5&gt;
  
  
  Automate Model Management
&lt;/h5&gt;

&lt;p&gt;Deploying models is an ongoing task. To avoid manual interventions, automate as much of the process as possible:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Use tools like &lt;strong&gt;MLflow&lt;/strong&gt; or &lt;strong&gt;Kubeflow&lt;/strong&gt; to automate the tracking, versioning, and deployment of models.&lt;/li&gt;
&lt;li&gt;Set up model monitoring to track performance and alert you when the model starts to degrade.&lt;/li&gt;
&lt;/ul&gt;

&lt;h5&gt;
  
  
  Collaborate with DevOps for Production-Ready Infrastructure
&lt;/h5&gt;

&lt;p&gt;If you’re not familiar with cloud services or server infrastructure, collaborate with DevOps engineers to set up the necessary infrastructure. They can help you with:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Setting up cloud-based servers or containers&lt;/li&gt;
&lt;li&gt;Ensuring the infrastructure is scalable to handle high-traffic&lt;/li&gt;
&lt;li&gt;Integrating the model into a larger production system&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  4. Real-World Example: From Notebook to Production
&lt;/h3&gt;

&lt;p&gt;Let’s look at a real-world example: A customer churn prediction model. After developing the model in a Jupyter Notebook, the next step is to deploy it so the business can use it for real-time decision-making. Here’s how you could go about it:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Containerization&lt;/strong&gt;: Use Docker to package the model and its dependencies.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;API Development&lt;/strong&gt;: Expose the model as an API using FastAPI, so that it can receive customer data and provide churn predictions in real-time.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Cloud Deployment&lt;/strong&gt;: Deploy the model to AWS using a simple EC2 instance and set up auto-scaling for heavy traffic.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Monitoring&lt;/strong&gt;: Implement monitoring tools to track the model’s performance and set up alerts for when retraining is needed.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Conclusion:
&lt;/h3&gt;

&lt;p&gt;The journey from building a machine learning model to deploying it in a real-world application doesn’t have to be overwhelming. By adopting a deployable-by-design mindset, mastering deployment tools, and collaborating with DevOps, you can easily move your models from notebooks to production.&lt;/p&gt;

&lt;p&gt;The true value of machine learning lies in its ability to solve real-world problems, not in how well it performs in isolated environments. It’s time to stop leaving your models idle in notebooks and take the leap into production. With the right tools and mindset, you can turn your machine-learning projects into valuable, scalable solutions.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Overfitting and Underfitting in Machine Learning: Finding the Right Balance for Your Models</title>
      <dc:creator>Zima Blue</dc:creator>
      <pubDate>Wed, 09 Oct 2024 10:28:26 +0000</pubDate>
      <link>https://forem.com/nderitugichuki/overfitting-and-underfitting-in-machine-learning-finding-the-right-balance-for-your-models-22lc</link>
      <guid>https://forem.com/nderitugichuki/overfitting-and-underfitting-in-machine-learning-finding-the-right-balance-for-your-models-22lc</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In the ever growing world of machine learning, building effective models is an art that involves careful consideration of data, algorithms, and the goal at hand. As a machine learning enthusiast, you may have encountered the terms "overfitting" and "underfitting," which can spell the difference between success and failure. This article will break down these concepts, explain why they matter, and show you how to prevent them keeping it simple and relatable.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Overfitting?
&lt;/h2&gt;

&lt;p&gt;Imagine you're studying for an exam. Instead of learning the general concepts, you memorize every question from last year's exam paper. When the exam changes slightly, you’re left confused and unable to adapt. This is what happens when a machine learning model overfits.&lt;/p&gt;

&lt;p&gt;A model is said to be overfitted when the model does not make accurate predictions on testing data. When a model gets trained with so much data, it starts learning from the noise and inaccurate data entries in our data set and when testing with test data results in high variance. The model tends to not categorize the data correctly, because of too many details, features and noise in the data. The causes of overfitting are the non-parametric and non-linear methods because these types of machine learning algorithms have more freedom in building the model based on the dataset and therefore they can build unrealistic models. A solution to avoid overfitting is using a linear algorithm if we have linear data or using parameters like the maximal depth if we are using decision trees. &lt;/p&gt;

&lt;p&gt;For example, let’s say you have a model trying to predict house prices. If it’s overfitted, it might fixate on specific outliers like an unusually cheap mansion due to damage and learning patterns that are irrelevant for future predictions.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Underfitting?
&lt;/h2&gt;

&lt;p&gt;Now, think of underfitting like being too lazy in your exam prep. Instead of diving into the details, you skim through the notes and hope for the best. When the exam day arrives, you’re unprepared for even the basic questions. That’s how an &lt;strong&gt;underfitted&lt;/strong&gt; model behaves.&lt;/p&gt;

&lt;p&gt;A statistical model experiences underfitting when it lacks the complexity needed to capture the underlying patterns in the data. This means the model struggles to learn from the training set, resulting in subpar performance on both the training and test datasets. An underfitted model produces inaccurate predictions, especially when applied to new, unseen data. Underfitting usually occurs when we rely on overly simple models with unrealistic assumptions. To fix this issue, we should use more sophisticated models, improve feature representation, and reduce the use of regularization.&lt;br&gt;
Imagine using a linear regression model to predict house prices in a market where prices don’t follow a straight-line pattern your predictions would be way off.&lt;/p&gt;

&lt;h2&gt;
  
  
  Causes of Overfitting
&lt;/h2&gt;

&lt;p&gt;Overfitting is caused by several factors. The most common factors  include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Model Complexity&lt;/strong&gt;: Complex models, such as those with too many features or layers in a neural network, can fit the noise in your data, mistaking it for useful information.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Small Datasets&lt;/strong&gt;: Lack of enough data leads the model to try too hard in extracting every detail from the few examples, leading to overfitting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Noisy Data&lt;/strong&gt;: Data with too much noise, outliers, inconsistencies, or irrelevant details can easily confuse the model into learning patterns that don’t matter.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;A tip to keep in mind during model building is that when your model becomes a perfectionist and tries to be too clever, it stops being useful for the real world.&lt;/p&gt;

&lt;h2&gt;
  
  
  Causes of Underfitting
&lt;/h2&gt;

&lt;p&gt;On the flip side, underfitting happens when your model is too simplistic to capture the complexities of the data. Some common reasons are:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Oversimplified Models&lt;/strong&gt;: Using models that don’t have enough parameters to grasp the data’s intricacies. For instance, using a linear model to predict non-linear data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Insufficient Training&lt;/strong&gt;: Your model might not be trained long enough or effectively, resulting in poor learning.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Wrong Algorithm Choice&lt;/strong&gt;: Certain algorithms aren’t suited for specific types of data and hence using an outdated or wrong algorithm for a cutting-edge problem is a recipe for underfitting.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;So basically, when your model is too basic, it lacks the depth to understand what’s happening in the data.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;How to Detect Overfitting and Underfitting&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Now that we know what overfitting and underfitting are, the next question is: How do we spot them?&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cross-validation&lt;/strong&gt;: This can be likened to giving your model a pop quiz before the final exam. By splitting your data into multiple parts and testing the model on unseen portions, you can check whether the model performs consistently well on new data. If the model aces the training set but fails miserably on the test set, you’re likely dealing with overfitting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Training vs. Validation Performance&lt;/strong&gt;: A huge red flag for overfitting is when your model performs excellently on the training data but poorly on the validation or test set. This disparity shows that the model learned too well from the training data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Learning Curves&lt;/strong&gt;: These curves visually represent how the model’s performance changes periodically. For overfitting, you’ll see the training error decrease significantly, while the validation error increases. In underfitting, both the training and validation errors will be high.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Solutions to Overfitting&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you realize your model is overfitting, there are several ways to deal with it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Regularization&lt;/strong&gt;: This technique adds a penalty to the complexity of the model hence discouraging the model from becoming overly complex by penalizing large weights. L1 and L2 regularization are common methods that help in controlling overfitting.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Pruning&lt;/strong&gt;: For decision trees, you can prune or cut back unnecessary branches that contribute to overfitting, simplifying the model and focusing on meaningful patterns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Dropout&lt;/strong&gt;: In neural networks, dropout randomly turns off some neurons during training, preventing the network from becoming too specialized on specific features.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cross-validation and Early Stopping&lt;/strong&gt;: Stop training your model before it starts memorizing the training data too well. Cross-validation helps identify the point at which the model starts to overfit, allowing you to stop training early.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;More Data&lt;/strong&gt;: If possible, feed your model with as much data as possible since the more examples your model has, the less likely it is to overfit the training set.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Solutions to Underfitting&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;On the other hand, if your model is underfitting, here are some ways to improve it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Increase Model Complexity&lt;/strong&gt;: Adding more features, layers, or parameters to your model helps it learn the more complicated patterns in the data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Use a Better Algorithm&lt;/strong&gt;: At times the solution is as simple as switching to a more powerful algorithm that better suits your data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Train Longer&lt;/strong&gt;: If your model hasn’t had enough time to learn, give it more training epochs or iterations.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Balancing Model Complexity&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Finding the sweet spot between overfitting and underfitting is all about balance and your model's ability to generalize on new data. This balance is called the &lt;strong&gt;bias-variance tradeoff&lt;/strong&gt;. High bias tends to lead your model to underfitting whereas high variance leads to overfitting of the model. Tuning your hyperparameters, such as the depth of a decision tree or the number of layers in a neural network, helps you find the middle ground.&lt;/p&gt;

&lt;p&gt;The goal is to build a model that generalizes well on unseen data. It’s not about being perfect on the training set, it’s about being good enough on new, real-world data.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Examples of Real-World Applications&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Overfitting and underfitting are not just theoretical problems they do happen in real world scenarios. Examples of such kind of problems include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Healthcare&lt;/strong&gt;: Imagine an AI system trained to diagnose diseases based on patient data. If it overfits, it might perform perfectly on the hospital’s data but fail when tested on patients from different regions.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Finance&lt;/strong&gt;: Predicting stock prices or fraud detection requires careful model tuning. Overfit models might perform well on historical data but fail in dynamic, real-time market conditions.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Overfitting and underfitting are two sides of the same coin, both of which can lead to poor model performance if not handled correctly. The key is to strike a good balance ensuring your model is complex enough to capture important patterns but not so overly complex that it becomes sensitive to noise. With regularization, better algorithms, and careful cross-validation, you can avoid these common pitfalls and create models that generalize well to new data.&lt;/p&gt;

&lt;p&gt;In the end, remember that machine learning is a continuous learning process not only just for your models but also for you as a data enthusiast. So keep testing, iterating, and finding that sweet spot where your model shines!&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>algorithms</category>
      <category>ai</category>
    </item>
    <item>
      <title>Mastering Machine Learning: A Detailed, Step-by-Step Guide to Solving ML Problems</title>
      <dc:creator>Zima Blue</dc:creator>
      <pubDate>Sun, 29 Sep 2024 19:24:06 +0000</pubDate>
      <link>https://forem.com/nderitugichuki/mastering-machine-learning-a-detailed-step-by-step-guide-to-solving-ml-problems-1fii</link>
      <guid>https://forem.com/nderitugichuki/mastering-machine-learning-a-detailed-step-by-step-guide-to-solving-ml-problems-1fii</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Machine learning can be exciting, holding endless possibilities. However, it can be intimidating if you do not have a clear strategy in place. Before making any move into algorithms and data, you will first need to set the stage. Harking back to building a house, your machine learning project needs a solid foundation to hold up all of the intricate steps that follow.&lt;/p&gt;

&lt;p&gt;In this article, we will cover the full process from interpreting the business problems to deploying the model itself and its maintenance. Be it a regression problem, a model for classification, or unsupervised learning tasks like clustering, this step-by-step approach will give you the structure needed to ace those topics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Understand the Business Requirements and Available Data
&lt;/h2&gt;

&lt;p&gt;Before you even think about opening a Jupyter notebook or writing code, pause and ask yourself: &lt;em&gt;What problem am I solving?&lt;/em&gt; &lt;/p&gt;

&lt;p&gt;The answer to this question isn’t just about the data, it's about understanding how the model you're building will solve a real-world business issue. For example, are you predicting customer churn, identifying fraudulent transactions, or optimizing supply chains? Each business problem has unique requirements that will shape your approach to data collection, model building, and evaluation.&lt;br&gt;
Establishing the success metrics early on before is essential as one gets to understand the problem at hand well. Does the business care more about accuracy, speed, or interpretability? Knowing this from the start will shape your modelling choices.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 2: Classify the Problem Type
&lt;/h3&gt;

&lt;p&gt;Once you get to understand the business context, the next step is to classify the type of problem you're working on. Is it a supervised or unsupervised problem? If it is a supervised learning, is it a regression or a classification problem?&lt;/p&gt;

&lt;p&gt;Supervised Learning involves training the model on labelled data e.g. predicting bitcoin prices based on historical sales while unsupervised Learning involves finding patterns in unlabeled data e.g. segmenting customers into different groups based on buying behaviour.&lt;/p&gt;

&lt;p&gt;If the problem at hand is a classification problem, you'll need to predict discrete outcomes, such as whether a customer will churn or not and as for regression, you'll predict a continuous variable like temperature or sales. &lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Clean, Explore, and Engineer the Data
&lt;/h2&gt;

&lt;p&gt;Data tends to be rarely perfect with the presence of missing values, outliers, or irrelevant features that hinder the performance of your model. The next step is to clean the data by handling missing values, eliminating duplicates, and correcting errors. &lt;br&gt;
Exploratory Data Analysis (EDA) helps you get a feel for your data this is where you’ll discover correlations, trends, and patterns that might not be obvious at first glance. Visualization techniques like histograms, scatter plots, and heat maps are invaluable for understanding the distribution of your data.&lt;/p&gt;

&lt;p&gt;Feature engineering is a powerful step in ML. This is where you create new features that improve the predictive power of your model. For instance, extracting the day of the week from a timestamp might give your model an edge when predicting sales patterns.&lt;br&gt;
It is advisable not to just rely on raw data since sometimes the most powerful predictors come from thoughtfully engineered features.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Split the Data into Training, Validation, and Test Sets
&lt;/h2&gt;

&lt;p&gt;A common mistake in machine learning is evaluating a model’s performance on the same data it was trained on, leading to overly optimistic results. Instead, divide your dataset into three parts:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Training Set which is used to train the model.&lt;/li&gt;
&lt;li&gt;Validation Set which helps tune hyperparameters and make model adjustments.&lt;/li&gt;
&lt;li&gt;Test Set which is the final set used to evaluate how well the model performs on unseen data.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Ensuring that these sets are representative of the entire dataset is crucial for getting reliable results. If you’re working on a classification problem, use stratified sampling to ensure each split has a balanced representation of classes by using the Starify function.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 5: Build a Simple Baseline Model
&lt;/h2&gt;

&lt;p&gt;Before diving into complex algorithms, it is best to start with a simple baseline model such as a linear regression or decision tree which is straightforward. The goal here isn’t to create the best model right away but to set a benchmark. It allows you to measure improvement in future models and serves as a quick sanity check.&lt;/p&gt;

&lt;p&gt;A quick baseline model can save you hours of frustration down the line, helping you to identify major data or problem-specific issues early on.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 6: Train the Model and Tune Hyperparameters
&lt;/h2&gt;

&lt;p&gt;After creating a baseline, it's time to build a more sophisticated model. This could involve decision trees, random forests, gradient boosting, or even deep learning models. At this stage, focus on training the model, tuning hyperparameters, and testing different configurations to optimize its performance.&lt;/p&gt;

&lt;p&gt;For hyperparameter tuning, consider using grid search or random search to explore different combinations. The goal is to strike the right balance between model complexity and generalization.&lt;br&gt;
The model can be assimple as possible as a complex model isn’t always better, a well-tuned, simple model can outperform more complicated architectures.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 7: Experiment with Multiple Strategies
&lt;/h2&gt;

&lt;p&gt;Machine learning is an iterative process and at times a single model won’t give you the best results. This is where ensemble methods like bagging, boosting, and stacking come into play. By combining multiple models, you can achieve better performance and more robust predictions.&lt;/p&gt;

&lt;p&gt;For example, using bagging models like random forests, you can train multiple models in parallel and average their predictions to reduce variance. On the other hand, boosting methods like XGBoost repeatedly train models, focusing on correcting errors made by previous ones.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 8: Interpret the Model and Present Your Findings
&lt;/h2&gt;

&lt;p&gt;A model is only as good as the insights it provides. Once you have a working model, you need to interpret it—this means understanding feature importance, individual predictions, and how the model reaches its conclusions.&lt;/p&gt;

&lt;p&gt;Visualization tools like SHAP values or LIME can help explain complex models, especially if one is dealing with stakeholders who need interpretable insights. Your final presentation should be clear, concise, and focused on how the model aligns with business goals.&lt;br&gt;
It is always advisable to relate your findings to business objectives as stakeholders tend to care more about actionable insights, not just technical jargon.&lt;/p&gt;

&lt;h3&gt;
  
  
  Step 9: Deploy and Maintain the Model
&lt;/h3&gt;

&lt;p&gt;Once you’ve built and validated your model, now comes the crucial final step deployment of the model. Whether your model will be integrated into a web service, mobile app, or enterprise system, it needs to be deployed in a way that stakeholders can use.&lt;/p&gt;

&lt;p&gt;Deployment is just the beginning and over time, your model’s performance may degrade due to changing data distributions which is referred to as model drift. It is preferably good to make sure to monitor the model, retrain it periodically, and adjust as needed to keep it performing at its best as continuous model evaluation and improvement are key to long-term success.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion: The Path to Success in Machine Learning
&lt;/h2&gt;

&lt;p&gt;Solving machine learning problems isn’t just about writing code or training models, it’s about following a structured, well-thought-out process that begins with understanding the business problem and ends with deploying a reliable, interpretable, and efficient model.&lt;/p&gt;

&lt;p&gt;By following these steps, you will not only improve your technical skills but also become more effective at solving real-world problems. Whether you're new to machine learning or looking to refine your approach, this guide provides a solid framework for achieving success in your ML journey.&lt;/p&gt;

&lt;p&gt;So, the next time you tackle an ML problem, remember patience, iteration, and a clear roadmap are your keys to the success of machine learning problems.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>ai</category>
      <category>algorithms</category>
    </item>
    <item>
      <title>Model Selection Demystified: How to Pick the Right Algorithm For Your Data</title>
      <dc:creator>Zima Blue</dc:creator>
      <pubDate>Thu, 12 Sep 2024 11:31:32 +0000</pubDate>
      <link>https://forem.com/nderitugichuki/model-selection-demystified-how-to-pick-the-right-algorithm-for-your-data-3ej8</link>
      <guid>https://forem.com/nderitugichuki/model-selection-demystified-how-to-pick-the-right-algorithm-for-your-data-3ej8</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In the world of machine learning, choosing the right model can make or break your project. With so many algorithms available, it can be overwhelming to figure out where to start. Should you go for something simple like linear regression, or dive into deep learning with neural networks? The truth is, there’s no one-size-fits-all approach. The best model depends on your data, the problem you’re trying to solve, and how much time and resources you have. In this article, we’ll explore the key factors to consider when selecting a model, helping you make a more informed decision for your next project. Here’s a step-by-step guide on how to determine the right algorithm for your model:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Identify Problem Type
&lt;/h2&gt;

&lt;p&gt;You should get to understand if this is a problem of supervised, unsupervised, or reinforcement learning.&lt;/p&gt;

&lt;h3&gt;
  
  
  Supervised Learning:
&lt;/h3&gt;

&lt;p&gt;In this type of learning you are given labelled data pairs of inputs and their corresponding outputs. The goal will be to learn from a mapping between inputs and outputs. Algorithms used in this type of learning include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Regression: For predicting continuous output values, such as the prediction of house prices.&lt;/li&gt;
&lt;li&gt;Classification: It is a supervised learning in which the outputs are categories; for instance, spam detection or disease diagnosis.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Unsupervised Learning:
&lt;/h3&gt;

&lt;p&gt;In this type of learning, you are given unlabeled data. The goal is to find meaningful patterns, relationships, or groupings within the data. Algorithms used in this type of learning include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Clustering: This is the separation of data into groups of similar objects; for instance, customer segmentation.&lt;/li&gt;
&lt;li&gt;Dimensionality reduction: This technique reduces the number of input features while maintaining significant information about the data; for example, using PCA or t-SNE.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Reinforcement Learning:
&lt;/h3&gt;

&lt;p&gt;This is a type of model learning in which knowledge is built into the model by acting in an environment and drawing feedback through rewards and penalties.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Understand Your Data
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Nature of Target Variable:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Numerical Target: If the target variable is continuous, you have a problem at hand that calls for regression. Examples include stock price prediction and sales forecasting.&lt;/li&gt;
&lt;li&gt;Categorical Target: In the case of a discrete target variable, you have to go with classification. Examples include fraud detection and image classification.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Number of Features:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Depending on your problem, the size of your dataset, and the number of features, algorithms that handle high-dimensional data will suit you fine, such as decision trees, random forests, or SVM with suitable kernels.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Feature Type:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Categorical: Most algorithms directly support categorical variables, including decision trees, Naive Bayes, or ensemble methods like random forests.&lt;/li&gt;
&lt;li&gt;Numerical: Regression analyses, SVMs, and neural networks perform well in general on numerical data.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Data Size:
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Small datasets: Decision trees or logistic regression works pretty well in general.&lt;/li&gt;
&lt;li&gt;Large datasets, on the other hand, would be best dealt with using a neural network or techniques from gradient boosting, such as XGBoost, but this tends to be quite 
computationally expensive. &lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  3. Interpretability versus Model Complexity
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Interpretability: If there is a need for you or your team to interpret the results of the model to stakeholders, simpler models should be chosen because their meaning is relatively easy to understand, such as logistic regression, decision trees, or linear regression.&lt;/li&gt;
&lt;li&gt;Model complexity and accuracy: If the prime focus is accuracy and not much interpretation are required, sophisticated models such as random forests, XGBoost, SVM, or neural networks might be appropriate.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  4. Consider Specific Model Strengths
&lt;/h2&gt;

&lt;p&gt;Machine learning algorithms and when to use them about their strength.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Linear Regression: For simple linear relationships between features and a continuous target variable (regression).&lt;/li&gt;
&lt;li&gt;Logistic Regression: Binary classification problems-for example, yes/no predictions when the data is linearly separable.&lt;/li&gt;
&lt;li&gt;Decision Trees: When the model has to be interpretable and the data features are categorical and numerical.
&lt;/li&gt;
&lt;li&gt;Random Forest: When any robust model on high-dimensional data of categorical and numerical types is required, which reduces overfitting. &lt;/li&gt;
&lt;li&gt;Support Vector Machine: When you are working with high-dimensional data, a classification problem has to be solved with a well-defined margin between classes.&lt;/li&gt;
&lt;li&gt;K-Nearest Neighbors (KNN): For small datasets or nonlinear relationships of both classification and regression problems; it is easily understandable but computationally expensive for big datasets. &lt;/li&gt;
&lt;li&gt;XGBoost/ Gradient Boosting: When high accuracy is more desirable than interpretability, together with a big dataset and complex relationships.&lt;/li&gt;
&lt;li&gt;Naive Bayes: For problems of text classification, such as spam detection, and when the independence assumption among features is roughly satisfied. &lt;/li&gt;
&lt;li&gt;K-Means Clustering: For unsupervised tasks of clustering where one wants to group similar data points, such as customer segmentation.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  5. Comparison of Various Algorithm Performances
&lt;/h2&gt;

&lt;p&gt;Comparing the performances of various algorithms tried is a standard approach. After the algorithms are proposed, one has to come up with their performance metrics. These include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Accuracy for classification&lt;/li&gt;
&lt;li&gt;Precision, Recall, and F1-score for classification in case of an imbalanced dataset&lt;/li&gt;
&lt;li&gt;Mean Squared Error, R-squared for regression&lt;/li&gt;
&lt;li&gt;Silhouette Score, Davies-Bouldin Index for clustering.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;The process towards the model comparison is as follows:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Train-Test Split: Split your data into training and testing sets, so you can evaluate your model performance on unseen data.&lt;/li&gt;
&lt;li&gt;k-fold Cross-Validation: The data should be divided into k-folds, and each fold should serve to train and test the model so that it generalizes well on random subsets of the data.&lt;/li&gt;
&lt;li&gt;Metrics Selection: Appropriate metrics for evaluating a model will be chosen. This choice is dependent on the particular problem at hand classification, regression, or clustering.&lt;/li&gt;
&lt;li&gt;Hyperparameter Optimization: Grid search or random search techniques will be employed as a way of optimizing an algorithm's performance.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  6. Time and Resources
&lt;/h2&gt;

&lt;p&gt;Deep models, such as neural networks and ensemble-based methods like random forests and gradient boosting, are powerful tools in machine learning. These models are designed to capture complex patterns in data, making them highly effective for a range of tasks. However, with this complexity comes a trade-off these algorithms often take longer to train and require more computational resources compared to simpler models. The increased training time and resource demand are natural consequences of the sophisticated architecture and the large amount of data these models process.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Choosing the right model is essential for any successful machine learning project. It’s not just about picking the most advanced algorithm; it’s about finding the one that fits your data and the problem you're solving. Simpler models often work well and are easier to interpret, while more complex models like neural networks can offer higher accuracy but at the cost of training time and resources. The key is to strike a balance—know your data, understand your options, and choose a model that gives you both solid performance and practicality.&lt;/p&gt;

</description>
      <category>machinelearning</category>
      <category>datascience</category>
      <category>algorithms</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Feature Engineering Fundamentals: Best Practices and Practical Tips</title>
      <dc:creator>Zima Blue</dc:creator>
      <pubDate>Sat, 17 Aug 2024 12:36:00 +0000</pubDate>
      <link>https://forem.com/nderitugichuki/feature-engineering-fundamentals-best-practices-and-practical-tips-519o</link>
      <guid>https://forem.com/nderitugichuki/feature-engineering-fundamentals-best-practices-and-practical-tips-519o</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;Feature engineering is one of the most essential steps in the data science pipeline. It consists of reconstructing raw data into meaningful features that enhance machine learning models' performance.&lt;br&gt;
In this article, we will dive into the key techniques for effective feature engineering along with hands-on examples to assist you in getting started.&lt;/p&gt;
&lt;h2&gt;
  
  
  Roles of Features in Machine Learning
&lt;/h2&gt;

&lt;p&gt;In feature engineering, features refer to the measurable properties machine learning models use to make predictions or decisions, they are obtained from the primary data and modified to formats that can be used efficiently by algorithms.&lt;br&gt;
Some of these features include:&lt;/p&gt;
&lt;h3&gt;
  
  
  1.Raw Features
&lt;/h3&gt;

&lt;p&gt;These features are derived from the main dataset without any moderation. They include subject, grade, and class in a student's dataset. &lt;/p&gt;
&lt;h3&gt;
  
  
  2.Derived Features
&lt;/h3&gt;

&lt;p&gt;These are features that are generated from the already existing features through combinations for instance a Density feature from mass and volume.&lt;/p&gt;
&lt;h3&gt;
  
  
  3.Categorical Features
&lt;/h3&gt;

&lt;p&gt;These features represent discrete values or classifications such as brands or types. In most of the algorithms in machine learning, they need to be converted to numerical values.&lt;/p&gt;
&lt;h3&gt;
  
  
  4.Numerical Features
&lt;/h3&gt;

&lt;p&gt;They represent continuous or discrete data such as age, income, or weight.&lt;/p&gt;
&lt;h3&gt;
  
  
  5.Aggregated Features
&lt;/h3&gt;

&lt;p&gt;These features summarize information over groups of data, such as average&lt;/p&gt;
&lt;h3&gt;
  
  
  6.Spatial Features
&lt;/h3&gt;

&lt;p&gt;These features represent geographical or spatial information, such as the distance between different locations.&lt;/p&gt;
&lt;h2&gt;
  
  
  Techniques for Feature Engineering
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1.Handling Missing Data
&lt;/h3&gt;
&lt;h5&gt;
  
  
  Imputation
&lt;/h5&gt;

&lt;p&gt;This method replaces the missing values in the dataset with a statistic such as mean, median or mode. Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.impute&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SimpleImputer&lt;/span&gt;

&lt;span class="c1"&gt;# Sample DataFrame with missing values
&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="bp"&gt;None&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="c1"&gt;# Initialize the imputer
&lt;/span&gt;&lt;span class="n"&gt;imputer&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SimpleImputer&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;strategy&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;mean&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Impute missing values
&lt;/span&gt;&lt;span class="n"&gt;df_imputed&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;copy&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;col&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;select_dtypes&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;include&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;number&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;
    &lt;span class="n"&gt;df_imputed&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;imputer&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit_transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="n"&gt;col&lt;/span&gt;&lt;span class="p"&gt;]])&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df_imputed&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; 
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Flagging Missing values
&lt;/h5&gt;

&lt;p&gt;These techniques create a new feature which tends to indicate all the missing values in the dataset. Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A_missing&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;isnull&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;astype&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B_missing&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;isnull&lt;/span&gt;&lt;span class="p"&gt;().&lt;/span&gt;&lt;span class="nf"&gt;astype&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;int&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  2.Encoding Categorical Variables
&lt;/h3&gt;

&lt;h5&gt;
  
  
  One-Hot Encoding
&lt;/h5&gt;

&lt;p&gt;This method converts the categorical variables in the data into binary variables. Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;color&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;red&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;blue&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;green&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;blue&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="n"&gt;df_encoded&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_dummies&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;color&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df_encoded&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Label Encoding
&lt;/h5&gt;

&lt;p&gt;This method gives a unique integer to each category in the data. Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;color&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;red&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;blue&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;green&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;blue&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="n"&gt;df_encoded&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_dummies&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;color&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df_encoded&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3.Creating Interaction Features
&lt;/h3&gt;

&lt;h5&gt;
  
  
  Polynomial Features
&lt;/h5&gt;

&lt;p&gt;This technique generates new features by multiplying the existing ones together. Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.preprocessing&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;PolynomialFeatures&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="n"&gt;poly&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PolynomialFeatures&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;degree&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;include_bias&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;False&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df_poly&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;poly&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit_transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;poly&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;get_feature_names_out&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df_poly&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4.Binning and Discretization
&lt;/h3&gt;

&lt;h5&gt;
  
  
  Binning
&lt;/h5&gt;

&lt;p&gt;This method categorizes the data into bins. Example in Python code.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A_binned&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cut&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;bins&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;low&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;medium&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;high&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Discretization
&lt;/h5&gt;

&lt;p&gt;This technique encodes the continuous variables in the dataset into discrete categories. Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A_discretized&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;cut&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;q&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;labels&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;low&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;medium&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;high&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5.Feature Extraction
&lt;/h3&gt;

&lt;h5&gt;
  
  
  Principal Component Analysis(PCA)
&lt;/h5&gt;

&lt;p&gt;This technique minimizes the amplitude of the data. Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.decomposition&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;PCA&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="n"&gt;pca&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;PCA&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n_components&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df_pca&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;pca&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit_transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;PC1&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df_pca&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  t-SNE
&lt;/h5&gt;

&lt;p&gt;This technique visualizes the high-dimensional data.&lt;br&gt;
Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.manifold&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;TSNE&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;numpy&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;np&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;random&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;rand&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;100&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="n"&gt;tsne&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;TSNE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;n_components&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;df_tsne&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;tsne&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit_transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="n"&gt;columns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Dim1&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Dim2&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;df_tsne&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;head&lt;/span&gt;&lt;span class="p"&gt;())&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  6.Feature Selection
&lt;/h3&gt;

&lt;h5&gt;
  
  
  Filter Methods
&lt;/h5&gt;

&lt;p&gt;This type of technique tends to select features based on the statistical properties of the dataset. Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.feature_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;SelectKBest&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;f_classif&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;target&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="n"&gt;X&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;target&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;selector&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;SelectKBest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;score_func&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;f_classif&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;k&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;X_new&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;selector&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit_transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_new&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h5&gt;
  
  
  Wrapper
&lt;/h5&gt;

&lt;p&gt;This method uses a model to assess feature subsets. Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.feature_selection&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;RFE&lt;/span&gt;
&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="n"&gt;sklearn.linear_model&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;LogisticRegression&lt;/span&gt;

&lt;span class="n"&gt;df&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nc"&gt;DataFrame&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;2&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;4&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;5&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;6&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;7&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;8&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;target&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;
&lt;span class="p"&gt;})&lt;/span&gt;

&lt;span class="n"&gt;X&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;A&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;B&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]]&lt;/span&gt;
&lt;span class="n"&gt;y&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;df&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;target&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;

&lt;span class="n"&gt;model&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;LogisticRegression&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;rfe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;RFE&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;model&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;n_features_to_select&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;1&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;X_rfe&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;rfe&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;fit_transform&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;X_rfe&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Challenges in Feature Engineering
&lt;/h3&gt;

&lt;p&gt;While Feature engineering remains an important part of leveraging big datasets it also comes with its shortcomings. &lt;/p&gt;

&lt;h5&gt;
  
  
  1.Time Consuming
&lt;/h5&gt;

&lt;p&gt;The manual feature engineering process involves the data scientist thoroughly examining all available data. The goal is to identify potential combinations of columns and predictors that could yield valuable insights to address the business problem at hand. This ends up requiring a significant amount of time and effort to complete all these steps.&lt;/p&gt;

&lt;h5&gt;
  
  
  2.Field Expertise
&lt;/h5&gt;

&lt;p&gt;Having a deep understanding of the industry related to a machine learning project is crucial for identifying which features are pertinent and valuable. This knowledge also helps in visualizing how data points may interconnect in meaningful and predictive ways.&lt;/p&gt;

&lt;h5&gt;
  
  
  3.Advanced Technical Skillset
&lt;/h5&gt;

&lt;p&gt;Feature engineering necessitates advanced technical skills and a comprehensive understanding of data science as well as machine learning algorithms. It requires a specific skill set that includes programming abilities and familiarity with database management. Most feature engineering techniques rely heavily on Python coding skills. Additionally, evaluating the effectiveness of newly created features involves a process of repetitive trial and error.&lt;/p&gt;

&lt;h5&gt;
  
  
  4.Overfitting
&lt;/h5&gt;

&lt;p&gt;Generating an excessive number of features or overly complex features can result in overfitting. This occurs when the model excels on the training data but struggles to perform effectively on new, unseen data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Tools for Feature Engineering
&lt;/h3&gt;

&lt;h5&gt;
  
  
  Pandas
&lt;/h5&gt;

&lt;p&gt;This is a Python library for data manipulation and also for creating new features for data models.&lt;/p&gt;

&lt;h5&gt;
  
  
  Scikit-learn
&lt;/h5&gt;

&lt;p&gt;This is an open-source Python library that is designed to be in feature engineering.&lt;/p&gt;

&lt;h5&gt;
  
  
  Feature-Engine
&lt;/h5&gt;

&lt;p&gt;This is a Python library with multiple transformers to engineer and select features for machine learning models.&lt;/p&gt;

&lt;h5&gt;
  
  
  Featuretools
&lt;/h5&gt;

&lt;p&gt;This is an automated feature engineering library that can create new features from relational data.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Feature engineering is an essential step in data science. Through feature engineering, you can process your data, to discover hidden trends and boost the performance of the machine learning models.&lt;br&gt;
By mastering feature engineering, you enhance your models while also gaining a deeper insight into the underlying data and the specific problem you are addressing.&lt;/p&gt;

</description>
      <category>beginners</category>
      <category>ai</category>
      <category>machinelearning</category>
      <category>datascience</category>
    </item>
    <item>
      <title>Understanding Your Data: The Essentials of Exploratory Data Analysis</title>
      <dc:creator>Zima Blue</dc:creator>
      <pubDate>Sun, 11 Aug 2024 18:07:00 +0000</pubDate>
      <link>https://forem.com/nderitugichuki/understanding-your-data-the-essentials-of-exploratory-data-analysis-400i</link>
      <guid>https://forem.com/nderitugichuki/understanding-your-data-the-essentials-of-exploratory-data-analysis-400i</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In the journey of learning data science, one of the most essential processes is understanding the data you're working with. Before building complex models it is critical first to perform Exploartury Data Analysis (EDA). EDA enables data scientists to make sense of their data, reveal patterns, and detect abnormalities. This article is aimed to guide you through the requisites of EDA, more importantly when you are just starting your data science journey.&lt;/p&gt;

&lt;h2&gt;
  
  
  What is Exploratory Data Analysis
&lt;/h2&gt;

&lt;p&gt;Exploratory data analysis (EDA) refers to an analysis approach used by data scientists to analyze and investigate data sets and summarize their main characteristics, often employing data visualization methods. it is an essential step in all data science projects as it brings out the insights that create the next process, whether determining the right model or comprehending the fundamental layout of the data.&lt;br&gt;
So in general we can declare that EDA is not only about just looking at numbers but also about gaining a deeper understanding of the data we have in hand.&lt;/p&gt;
&lt;h2&gt;
  
  
  Keys Steps in EDA
&lt;/h2&gt;
&lt;h3&gt;
  
  
  1. Data Collection and Cleaning
&lt;/h3&gt;

&lt;p&gt;Before you get to prospect your data, you need to first make sure it's clean and in an organized format. This necessitates handling null values, correcting inconsistencies, and making sure the data is in an organized format. &lt;/p&gt;
&lt;h3&gt;
  
  
  2. Descriptive Statistics
&lt;/h3&gt;

&lt;p&gt;The first process in EDA is to compute basic descriptive statistics such as mean, median, mode, and standard deviation. These statistics give us a synopsis of the data and help us comprehend its fundamental tendency and spread.&lt;br&gt;
Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;pandas&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;

&lt;span class="c1"&gt;# Load a sample dataset
&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;pd&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;read_csv&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;sample_data.csv&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Calculate descriptive statistics
&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;mean&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;median&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;median&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;mode&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;std_dev&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;std&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;span class="n"&gt;variance&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;var&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="nf"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sa"&gt;f&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="s"&gt;Mean: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;mean&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, Median: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;median&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, Mode: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;mode&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="mi"&gt;0&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, Standard Deviation: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;std_dev&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="s"&gt;, Variance: &lt;/span&gt;&lt;span class="si"&gt;{&lt;/span&gt;&lt;span class="n"&gt;variance&lt;/span&gt;&lt;span class="si"&gt;}&lt;/span&gt;&lt;span class="sh"&gt;"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  3. Data Visualization
&lt;/h3&gt;

&lt;p&gt;It is a method that helps discover new features and trends and draws relationships between the values in the data set. undefined&lt;/p&gt;

&lt;p&gt;Histograms: To distribute a single variable, therefore, is to illustrate the extent of the variable within a particular population.&lt;br&gt;
Box Plots: Emphasize value distribution and search for outliers.&lt;br&gt;
Scatter Plots: Use to examine the correlation between two variables that are both on a continuum.&lt;br&gt;
Bar Charts: To analyze the categorical data.&lt;br&gt;
Example in Python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;matplotlib.pyplot&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;plt&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;seaborn&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="n"&gt;sns&lt;/span&gt;

&lt;span class="c1"&gt;# Histogram
&lt;/span&gt;&lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;histplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="n"&gt;bins&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="mi"&gt;30&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Histogram of Column Name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;xlabel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Column Name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ylabel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Frequency&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Box Plot
&lt;/span&gt;&lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;boxplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Box Plot of Column Name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;xlabel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Column Name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Scatter Plot
&lt;/span&gt;&lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;scatterplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;x&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;variable_x&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;y&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;variable_y&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Scatter Plot of Variable X vs. Variable Y&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;xlabel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Variable X&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;ylabel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Variable Y&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  4. Correlation Analysis
&lt;/h3&gt;

&lt;p&gt;Correlation analysis looks at the co-variance between the variables and sees if this is positive or negative. This assist in determining degree of dependency and multicollinearity in the data set. Pearson Correlation: It is an older measure of association, that determine linear correlation between two continuous variables. Spearman Rank Correlation: For monotonic relationships, determines the strength and direction of a linear association.&lt;br&gt;
Example in python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Calculate Pearson correlation matrix
&lt;/span&gt;&lt;span class="n"&gt;correlation_matrix&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;corr&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Visualize the correlation matrix
&lt;/span&gt;&lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;heatmap&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;correlation_matrix&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;annot&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="bp"&gt;True&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;cmap&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;coolwarm&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Correlation Matrix&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  5. Detecting Outliers
&lt;/h3&gt;

&lt;p&gt;Outliers can distort the results and conclusions that are made from the analysis of collected data. In EDA, one finds peculiar values and determines if they should be retained as they are, altered, or removed. &lt;/p&gt;

&lt;p&gt;Z-Score Method: Find other values based on the measurement of variability, and standard deviation. &lt;br&gt;
 Interquartile Range (IQR): Find anomalous values according to the dispersion of the data.&lt;br&gt;
Example in python code:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight python"&gt;&lt;code&gt;&lt;span class="c1"&gt;# Detect outliers using IQR
&lt;/span&gt;&lt;span class="n"&gt;Q1&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;quantile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.25&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;Q3&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;].&lt;/span&gt;&lt;span class="nf"&gt;quantile&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mf"&gt;0.75&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;IQR&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;Q3&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="n"&gt;Q1&lt;/span&gt;

&lt;span class="n"&gt;outliers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;lt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Q1&lt;/span&gt; &lt;span class="o"&gt;-&lt;/span&gt; &lt;span class="mf"&gt;1.5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;IQR&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Q3&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="mf"&gt;1.5&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="n"&gt;IQR&lt;/span&gt;&lt;span class="p"&gt;))]&lt;/span&gt;

&lt;span class="c1"&gt;# Visualize outliers
&lt;/span&gt;&lt;span class="n"&gt;sns&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;boxplot&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;data&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;column_name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;])&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;title&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Box Plot with Outliers&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;xlabel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="s"&gt;Column Name&lt;/span&gt;&lt;span class="sh"&gt;'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="n"&gt;plt&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;show&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, it can be stated that Exploratory Data Analysis is a crucial step towards data analysis for the data scientist. It enables you to know what data are and make some important decisions; on top of it, it prepares the foundation for the subsequent analysis. However, for beginners, EDA is a fun exercise that is also useful for developing the skills of data science. In the subsequent chapters of this tutorial, you will discover that the more used you get to EDA, the easier it will be to work with more bigger and complex data and derive insights therefrom.&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>analytics</category>
      <category>python</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Breaking Into Data Science: A Comprehensive Guide for Aspiring Data Scientists</title>
      <dc:creator>Zima Blue</dc:creator>
      <pubDate>Sat, 03 Aug 2024 18:45:46 +0000</pubDate>
      <link>https://forem.com/nderitugichuki/-breaking-into-data-science-a-comprehensive-guide-for-aspiring-data-scientists-1h10</link>
      <guid>https://forem.com/nderitugichuki/-breaking-into-data-science-a-comprehensive-guide-for-aspiring-data-scientists-1h10</guid>
      <description>&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;In recent times, data science has come out as the most in-demand discipline this is because the world is slowly changing to a data-driven world. Data Science as a field has its implementation ranging from artificial intelligence, machine learning to predictive analytics.&lt;br&gt;
With all these applications it tends to offer a lot of opportunities to people who are willing to venture into the field. This article aims to help a beginner who is trying to get into data science.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is Data Science?
&lt;/h3&gt;

&lt;p&gt;Data science is the domain of study that deals with vast volumes of data using modern tools and techniques, to find unseen patterns, derive meaningful information, and make solve real-world problems.&lt;/p&gt;

&lt;h3&gt;
  
  
  Key Components of Data Science
&lt;/h3&gt;

&lt;p&gt;Data science has some key components that must be followed to achieve the end goal. These include:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Data Collection: This refers to gathering data from&lt;br&gt;
various sources such as databases, web scraping, or even field data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Cleaning: After data is collected it is cleaned this is by getting rid of duplicates, handling null values, and also removing any inconsistencies.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data Analysis: This involves using statistical methods to try and understand if there are any data patterns or trends in the data.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Machine Learning: This involves building models that can learn from the data we have and make predictions and also decisions through the patterns.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Data visualization: This part involves presenting data in an informative and interactive way using visuals such as charts and graphs which can tell more about our data.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Getting Started with Data Science
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1.Building a strong foundation
&lt;/h3&gt;

&lt;p&gt;For one to become a data scientist, you'll need to have a firm understanding of these skills:&lt;/p&gt;

&lt;h4&gt;
  
  
  Programming:
&lt;/h4&gt;

&lt;p&gt;In programming, one needs to have an understanding of Python. It is a popular programming language known for its simplicity and versatility. It comes along with its libraries such as Pandas, Numpy, Seaborn, Matplotlib, and scikit-learn which come in handy when it comes to data manipulation and machine learning.&lt;br&gt;
Another programming language is R which is essential and can be substituted for Python and comes along with its statistical capabilities.&lt;/p&gt;

&lt;h4&gt;
  
  
  Statistics:
&lt;/h4&gt;

&lt;p&gt;Under statistics, one needs to have a good comprehension of linear algebra which is crucial for matrices and vectors which are needed for machine learning algorithms.&lt;br&gt;
We also have probability and statistics which is vitally important for hypothesis testing.&lt;/p&gt;

&lt;h4&gt;
  
  
  Data Manipulation:
&lt;/h4&gt;

&lt;p&gt;In data manipulation, we have Python libraries like pandas which are required for data analysis.&lt;br&gt;
We also have a Structured Query Language(SQL) which is necessary for managing and querying databases.&lt;/p&gt;

&lt;h3&gt;
  
  
  2.Learning Tools and Technologies
&lt;/h3&gt;

&lt;p&gt;Data science requires one to always be in the know all the time and it is good for one to be conversant with the tools, techniques, and libraries that are commonly used in the field.&lt;/p&gt;

&lt;h5&gt;
  
  
  Data Visualization:
&lt;/h5&gt;

&lt;p&gt;~ Matplotlib&amp;amp;Seaborn: These are Python libraries that are used by data scientists to create interactive visualizations.&lt;br&gt;
~ Power BI &amp;amp; Tableau: These are two important Business Intelligence (BI) technologies for the collection, integration, analysis, and presentation of dashboards and visualizations.&lt;/p&gt;

&lt;h5&gt;
  
  
  Machine Learning
&lt;/h5&gt;

&lt;p&gt;~ Scikit-learn: This is a machine-learning library that supports supervised and unsupervised algorithms.&lt;br&gt;
~ TensorFLow&amp;amp;PyTorch: These are Python libraries for developing machine learning applications and neural networks.&lt;/p&gt;

&lt;h3&gt;
  
  
  3.Exploring Online Courses and Other Resources
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Online Courses:
&lt;/h4&gt;

&lt;p&gt;There are plenty of resources on the internet that are available to help one kickstart their learning journey.&lt;/p&gt;

&lt;h5&gt;
  
  
  Online Courses:
&lt;/h5&gt;

&lt;p&gt;There are several online courses offered by different platforms. They include &lt;br&gt;
~ Google Coursera by Google which offers courses like "Data Science Specialization".&lt;br&gt;
~ Edx which provides plenty of data science courses from leading universities around the world.&lt;br&gt;
~ Udemy which features courses like "Python for Data Science and Machine Learning".&lt;br&gt;
~ ALX is another platform that offers data science boot camps to students willing to venture into data science.&lt;/p&gt;

&lt;h5&gt;
  
  
  Books
&lt;/h5&gt;

&lt;p&gt;~ "Python for Data Analysis" by Wes McKinney giving is an extensive book that gives beginners a full guide to using Python for data manipulation and analysis.&lt;br&gt;
~ "Introduction to Statistical Learning" by Gareth James is also an accessible introduction to statistical learning techniques and methods.&lt;/p&gt;

&lt;h5&gt;
  
  
  Tutorials and Blogs
&lt;/h5&gt;

&lt;p&gt;~Kaggle: This is one of the world's largest data science communities with powerful tools and resources to help you achieve your data science goals.&lt;/p&gt;

&lt;h5&gt;
  
  
  Joining Communities
&lt;/h5&gt;

&lt;p&gt;Becoming part of a data science community can provide one with extremely useful support and networking opportunities. Some of the ways to get entailed are through;&lt;br&gt;
~ Online Communities: These communities tend to offer great platforms for enthusiasts to discuss topics and seek advice. They include LinkedIn groups, stack overflow&lt;/p&gt;

&lt;p&gt;~ Meets and Conferences&lt;br&gt;
They tend to offer a stage where one can interact and connect with like-minded individuals and also a chance to learn from the experts in the field. They can also be a good place for one to catch up with the latest trends and innovations in the domain.&lt;/p&gt;

&lt;h3&gt;
  
  
  4.Job Searching
&lt;/h3&gt;

&lt;p&gt;Once one has built a solid foundation in data science, it's time to start considering job opportunities.&lt;br&gt;
Some steps to help one secure your data science position include:&lt;/p&gt;

&lt;h4&gt;
  
  
  1.Building a strong portfolio
&lt;/h4&gt;

&lt;p&gt;Creating a well-compiled portfolio showcasing your projects and skills can set you apart from other candidates. Some of the ways to go about this are through;&lt;br&gt;
~ Github: Create a GitHub repository where you share your projects and code to display your technical skills.&lt;br&gt;
~ Kaggle: Create a Kaggle profile engage in Kaggle competitions and showcase your solutions to different problems.&lt;br&gt;
~ Blog Posts: Write and document your projects on platforms like dev.to and Medium to demonstrate your communication skills.&lt;/p&gt;

&lt;h4&gt;
  
  
  2.Creating a good resume
&lt;/h4&gt;

&lt;p&gt;A good and impressive resume should underscore your skills, projects, and experiences which are affiliated with data science.&lt;/p&gt;

&lt;h4&gt;
  
  
  3.Networking and Building Connections
&lt;/h4&gt;

&lt;p&gt;Networking can open doors to job opportunities and come up with awareness of the field. ways how to build connections include;&lt;br&gt;
~ LinkedIn Engage and connect with professionals in data science and join relevant groups&lt;br&gt;
~ Mentorship: Reach out to data scientists who are already in the field for informational interviews and get to learn about their career paths.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;Getting into data science as a beginner can seem challenging especially with no prior experience but with with the right resources, consistency, and dedication, you can attain your goals. By setting a solid foundation, gaining practical experience with online and physical resources, and also networking within the community, you will be good for a lucrative career in data science.&lt;br&gt;
Data science is a dynamic field and is constantly evolving, so it's good to stay always in the know and learn while traversing more possibilities that data can offer. Good luck on your data science journey!&lt;/p&gt;

</description>
      <category>datascience</category>
      <category>dataengineering</category>
      <category>devops</category>
      <category>machinelearning</category>
    </item>
  </channel>
</rss>
