New answers tagged

2

Where ever you don't have an entry just make that to a null value or a random unique value. an then create another column, make that column data equal to 1 if data is present 0 otherwise so, the model may learn about that unique imputation and data using another column we are adding.


0

The first question we must ask is “why are these values missing?” Skip the feature if it's > 25% Try to know the reason from the data source/provider. They might give a clue and you may use that e.g. One city has Power failure during data collection. Simply create a new category for the missing and check the result. This will only work when there is an ...


0

How about training a ML classification model where all the features are used as an input and label is your categorical values. In that way we can predict the missing value.


1

First of all I would look how many missing values there are in the column. If there are too much (~20%, generally its difficult to say how much is too much), I would drop the column because imputing 20 % of your data (without prior expert knowledge) or even more probably does not give you meaningful information anymore. Secondly I would look at ...


1

Depends a bit on the model you are going to run. I will explain a bit for Linear Models and for Decision trees ensembling (gradient boosting and random forest) Decision tree Not much to do, when the tree is built each branch will choose a split. If there is any information gain with a large value, it will choose it and make a split. Some implementations, ...


0

from sklearn.impute import SimpleImputer import numpy as np imputer = SimpleImputer(missing_values = np.nan, strategy = 'mean') imputer.fit([[7, 2, 3], [4, np.nan, 6], [10, 5, 9]]) there is an error in using the parameters, should be missing_values missing_values : number, string, np.nan (default) or None


Top 50 recent answers are included