Variable encoding
In order to build machine learning models using the scikit-learn package in Python, all the features in the dataset need to have numerical values. However, in the dataset, we have numerous columns that have non-numerical values. For example, the target variable, Response, which is what we are going to try to predict with machine learning models, is non-numeric. It contains two string values—Yes and No. We will need to encode this Response target variable with numerical values in order to be able to build machine learning models. For another example, the column Gender, which we can use as one of the features for our predictive model, also does not have numerical values. It contains two string values—F for female and M for ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access