concept miss value in category machine learning

appears as: missing values, missing values, missing value, missing value
Machine Learning Bookcamp

This is an excerpt from Manning's book Machine Learning Bookcamp.

  • The number of missing values
  • The other option is filling the missing values with some other value. This way, we don't lose the information in other columns and still can make predictions even if the row has missing values. The simplest possible approach is to fill the missing values with zero. We can use the fillna method from Pandas:

    df_num = df_num.fillna(0)

    This method may not be the best way to deal with missing values, but often, it's good enough. If we set the missing feature value to zero, the respective feature is simply ignored.

    Figure 3.9 There is no need to handle missing values in the dataset: all the values in all the columns are present.
    Machine Learning with R, the tidyverse, and mlr

    This is an excerpt from Manning's book Machine Learning with R, the tidyverse, and mlr.

  • Imputation is a strategy for dealing with missing data, where some algorithm is used to estimate what the missing values would have been. You learned how to apply mean imputation for the Titanic dataset.
  • 9.2.2. Imputing missing values

    Linear regression can’t handle missing values. Therefore, to avoid having to throw away a large portion of our dataset, we’re going to use imputation to fill in the gaps. In chapter 4, we used mean imputation to replace missing values (NAs) with the mean of the variable. While this may work, it only uses the information within that single variable to predict missing values, and all missing values within a single variable will take the same value, potentially biasing the model. Instead, we can actually use machine learning algorithms to predict the value of a missing observation, using all of the other variables in the dataset! In this section, I’m going to show you how we can do this with mlr.

    If you run ?imputations, you’ll be able to see the imputation methods that come packaged with mlr. These include methods such as imputeMean(), imputeMedian(), and imputeMode() (for replacing missing values with the mean, median, and mode of each variable, respectively). But the most important method is the one last on the list: imputeLearner(). The imputeLearner() function lets us specify a supervised machine learning algorithm to predict what the missing values would have been, based on the information held in all the other variables. For example, if we want to impute missing values of a continuous variable, the process proceeds as follows:

    For our ozone data, we have missing values across several variables, and they’re all continuous variables. Therefore, I’m going to choose a regression algorithm that can handle missing data: rpart. Yep, you heard me right: we’re going to impute the missing values with the rpart decision tree algorithm. When we covered tree-based learners in chapter 7, we only considered them for classification problems; but decision trees can be used to predict continuous variables, too. I’ll show you how this works in detail in chapter 12; but for now, we’ll let rpart do its thing and impute our missing values for us.

    Listing 9.4. Using rpart to impute missing values
    imputeMethod <- imputeLearner("regr.rpart")
    
    ozoneImp <- impute(as.data.frame(ozoneClean),
                       classes = list(numeric = imputeMethod))

    We first use the imputeLearner() function to define what algorithm we’re going to use to impute the missing values. The only argument we supply to this function is the name of the learner, which in this case is "regr.rpart".

    Introducing Data Science: Big data, machine learning, and more, using Python tools

    This is an excerpt from Manning's book Introducing Data Science: Big data, machine learning, and more, using Python tools.

    Dealing with missing values

    Missing values aren’t necessarily wrong, but you still need to handle them separately; certain modeling techniques can’t handle missing values. They might be an indicator that something went wrong in your data collection or that an error happened in the ETL process. Common techniques data scientists use are listed in table 2.4.

    Table 2.4. An overview of techniques to handle missing data

    Technique

    Advantage

    Disadvantage

    Omit the values Easy to perform You lose the information from an observation
    Set value to null Easy to perform Not every modeling technique and/or implementation can handle null values
    Impute a static value such as 0 or the mean Easy to perform You don’t lose information from the other variables in the observation Can lead to false estimations from a model
    Impute a value from an estimated or theoretical distribution Does not disturb the model as much Harder to execute You make data assumptions
    Modeling the value (nondependent) Does not disturb the model too much Can lead to too much confidence in the model Can artificially raise dependence among the variables Harder to execute You make data assumptions

    Which technique to use at what time is dependent on your particular case. If, for instance, you don’t have observations to spare, omitting an observation is probably not an option. If the variable can be described by a stable distribution, you could impute based on this. However, maybe a missing value actually means “zero”? This can be the case in sales for instance: if no promotion is applied on a customer basket, that customer’s promo is missing, but most likely it’s also 0, no price cut.