New answers tagged

1

The purpose of one-hot encoding is to assign numbers to categorical variables which does not create a false, meaningless numerical pattern. If you have categorical variables "Apple", "Orange", "Cherry", "Tomato" and you assign them numerical values 0, 1, 2, 3, then these numerical values have interpretations like "...


3

To complete the accepted answer : From what I encountered, the big advantage of sklearn.preprocessing.OneHotEncoder is that you can save it as an sklearn encoder, so you can train it on a train set, and apply it on your test based on what you train (you'll re-create the same columns). In the other side, pandas.get_dummies only applies directly on your ...


Top 50 recent answers are included