Skip to content

Commit

Permalink
Modified version conflict about scikit-learn.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangxjohn committed Feb 23, 2024
1 parent 6e4c2ff commit f095f19
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion hyperts/utils/transformers.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,12 @@ def __init__(self, label_encoder=None, onehot_encoder=None, copy=True):
else:
self.label_encoder = label_encoder
if onehot_encoder is None:
self.onehot_encoder = OneHotEncoder(sparse=False, categories="auto")
if hasattr(OneHotEncoder(), "sparse"):
self.onehot_encoder = OneHotEncoder(sparse=False, categories="auto")
elif hasattr(OneHotEncoder(), "sparse_output"):
self.onehot_encoder = OneHotEncoder(sparse_output=False, categories="auto")
else:
raise ValueError("please check the version of scikit-learn package.")
else:
self.onehot_encoder = onehot_encoder

Expand Down

0 comments on commit f095f19

Please sign in to comment.