Can anyone explain me why I get the following error:
ValueError: non-broadcastable output operand with shape (1,1)
doesn't match the broadcast shape (1,2)
while executing:
X = np.array([[i, j] for i, j in zip(dati['a'], dati['b'])],
dtype = float) #np.shape(X) is (23, 2)
scaler = MinMaxScaler(feature_range=(0, 1))
X = scaler.fit_transform(X) #np.shape(X) is (23, 2)
X = np.reshape(X, (X.shape[0], X.shape[1], 1)) #np.shape(X) is (23, 2, 1)
X = f(X) #np.shape(X) is (23, 1)
X = scaler.inverse_transform(X)
p = np.array([dati[['a','b']].iloc[-1]], dtype = float) #np.shape(X) is (1, 2)
scaler = MinMaxScaler(feature_range=(0, 1))
p = scaler.fit_transform(p) #np.shape(X) is (1, 2)
p = np.reshape(p, (p.shape[0], p.shape[1], 1)) #np.shape(X) is (1, 2, 1)
p = f(p) #np.shape(p) is (1, 1)
p = scaler.inverse_transform(p) #Here the error
I really do not understand why applying the inverse_transform on the result of f(X) which has different dimensions than X everything is fine and while doing the same on f(p) which has different dimensions than p I get the error.