sklearn.preprocessing.OneHotEncoder
In order to avoid the problem of false assumed relationships present with LabelEncoder, you can use OneHotEncoder to transform a column into a series of columns where each column represents the binary choice of 'did the original column contain value x'. This prevents the creation of false ordinal relationship. However, OneHotEncoder only takes columns of integer values greater than 1, but you can easily transform categorical variables using LabelEncoder or pd.get_dummies
0
1
Tags
Data Science
Related
sklearn.preprocessing.OneHotEncoder
sklearn.preprocessing.OneHotEncoder
sklearn.neighbors.KNeighborsClassifier
sklearn.dummy.DummyClassifier
sklearn.preprocessing.LabelEncoder
Train Test Split Function
sklearn.datasets.make_regression
sklearn.datasets.make_friedman1
sklearn.datasets.make_classification
sklearn.svm.SVC
sklearn.tree.DecisionTreeClassifier
sklearn.ensemble.RandomForestClassifier
sklearn.dummy.DummyRegressor
sklearn.model_selection.GridSearchCV
sklearn.ensemble.RandomForestRegressor
Cross-Validation in scikit-learn