January 2020
Beginner to intermediate
372 pages
10h
English
In this recipe, we performed binary encoding using the Category Encoders package. We first loaded the dataset and divided it into train and test sets using train_test_split() from scikit-learn. Next, we used BinaryEncoder() to encode the A7 variable. With the fit() method, BinaryEncoder() created a mapping from category to set of binary columns, and with the transform() method, the encoder encoded the A7 variable in both the train and test sets.
Read now
Unlock full access