我使用此代码加载keras模型以测试数据。
sc = StandardScaler()
X = sc.fit_transform(df.astype(float))
print(X)
model = load_model('my_model.h5')
p =model.predict(X)
print(p)
real_pred = sc.inverse_transform(p)
print(real_pred)
当我运行这段代码时,它显示错误。
ValueError: non-broadcastable output operand with shape (2100,1) doesn't match the broadcast shape (2100,5)
我尝试编辑这样的代码。
sc.inverse_transform(p)[:,0]
sc.inverse_transform(p)[:,[0]]
但是它仍然不起作用。如何解决?