Binary bool features now remain binary in one hot encoding for ANMs in gcm
Signed-off-by: Patrick Bloebaum <bloebp@amazon.com>
This commit is contained in:
Родитель
38bb7231dc
Коммит
e3f1d9b4a5
|
@ -61,7 +61,7 @@ def fit_one_hot_encoders(X: np.ndarray) -> Dict[int, OneHotEncoder]:
|
||||||
one_hot_encoders = {}
|
one_hot_encoders = {}
|
||||||
for column in range(X.shape[1]):
|
for column in range(X.shape[1]):
|
||||||
if isinstance(X[0, column], str):
|
if isinstance(X[0, column], str):
|
||||||
one_hot_encoders[column] = OneHotEncoder(handle_unknown="ignore")
|
one_hot_encoders[column] = OneHotEncoder(handle_unknown="ignore", drop="if_binary")
|
||||||
one_hot_encoders[column].fit(X[:, column].reshape(-1, 1))
|
one_hot_encoders[column].fit(X[:, column].reshape(-1, 1))
|
||||||
|
|
||||||
return one_hot_encoders
|
return one_hot_encoders
|
||||||
|
|
Загрузка…
Ссылка в новой задаче