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:
Patrick Bloebaum 2022-10-26 17:12:22 -07:00 коммит произвёл Patrick Blöbaum
Родитель 38bb7231dc
Коммит e3f1d9b4a5
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -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