# GridSearchCV with one-hot y: prediction yields 1-dim array

I run a classification by means of a neural network, thus my y-values are converted to a one-hot matrix:

from sklearn.preprocessing import OneHotEncoder
encoder = OneHotEncoder(categories='auto')
y = encoder.fit_transform(y.reshape(-1,1), ).toarray()


When I do a single model run (like in the following), I get my predictions in the format of a (samples, classes) matrix containing class probabilities.

fit = model.fit(
train,
train_label,
epochs = 250,
batch_size = 128)
pred = model.predict(test)
pred.shape
Out[285]: (1420, 67)


When I do a grid search (like in the following), then do a prediction based on grid_result.best_estimator_, however, I get my predictions in the format of a single-dimensional array with numbers:

grid = GridSearchCV(estimator = model,
param_grid = param_grid,
cv = 10)
grid_result = grid.fit(train, train_label,
shuffle = True)
pred = grid_result.best_estimator_.predict(test)
pred.shape
Out[289]: (1420,)


Why does GridSearchCV output a single-dimensional array instead of a (samples, classes) matrix, which is the format of the "observed" y-values? Is there a possibility to let GridSearchCV output a (sample, classes) matrix, thus circumvent the procedure to use e.g. label_binarizer() to transform the output to the desired format?