We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 580610b commit 23d69ecCopy full SHA for 23d69ec
sklbench/datasets/downloaders.py
@@ -109,7 +109,11 @@ def fetch_and_correct_openml(
109
if isinstance(y, pd.Series):
110
if isinstance(y.dtype, pd.CategoricalDtype):
111
y = y.cat.codes
112
- y = y.values
+ # Use to_numpy() for sparse arrays to densify them, otherwise use values
113
+ if pd.api.types.is_sparse(y):
114
+ y = y.to_numpy()
115
+ else:
116
+ y = y.values
117
elif not isinstance(y, np.ndarray):
118
raise ValueError(f'Unknown y type "{type(y)}" returned from openml')
119
0 commit comments