-
-
Notifications
You must be signed in to change notification settings - Fork 26.2k
Closed
Description
Like the title says. Would it be possible to add an option, say "independent = True" to OneHotEncoder that would return a 1 of k-1 encoding instead of a 1 of k encoding. This would be very useful to me when I am encoding categorical variables since the 1 of k encoding adds an extra (non-independent) degree of freedom to the model. It would also be nice if I could specify which category to keep as the baseline.
Something like:
X = np.array([12,24,36]).reshape(-1,1)
OneHotEncoder(sparse=False, independent=True, baseline=24).fit_transform(X)
Output: array([[ 1., 0.],
[ 0., 0.],
[ 0., 1.]])
jnothman and Ruairi-osul
Metadata
Metadata
Assignees
Labels
No labels