how can i solve the stacking deep learning problem

Viewed 28

I'm about to develop a stacking deep learning ensemble model.. I have a problem and I couldn't solve it.

def stacked_dataset(members, inputX):
    stackX = None
    for model in members:
        # make prediction
        yhat = model.predict(inputX, verbose=0)
        # stack predictions into [rows, members, probabilities]
        if stackX is None:
            stackX = yhat
        else:
            stackX = np.dstack((stackX, yhat))
    # flatten predictions to [rows, members x probabilities]
    stackX = stackX.reshape((stackX.shape[shape]))
    return stackX

the error is :

ValueError: y should be a 1d array, got an array of shape (42541, 11, 2) instead.

How can I solve it while I'm running the fitting model = fit_stacked_model(members, x_test, testy_enc)

I expect the it would fit the stacking model.

0 Answers
Related