Я получаю эту ошибку.
ValueError: Error when checking input: expected input_1 to have 3 dimensions, but got array with shape (860, 11)
Ниже приведены коды, которые я использую. df
имеет размерность 860x15
, поэтому datX
имеет размерность 860x11
# first neural network with keras tutorial
from numpy import loadtxt
from keras.models import Sequential
from keras.layers import Dense
import pandas as pd
from pandas import ExcelWriter
from pandas import ExcelFile
df =pd.read_excel('C:/Users/ASUS/Documents/Script/Simulation.Machine.V1/Final.xlsx', sheetname= "C0")
datX = df.drop(['C0', 'C1', 'C2', 'C3'], axis=1)
import numpy as np
datY = df['C1'] / df['C0']
datW = df['C0']**(1/2)
datZ = df['C1']
q=20
p= len(datX.columns)
from keras import backend as K
# define the keras model
model = Sequential()
model.add(Dense(q, input_dim=p, activation='tanh'))
model.add(Dense(1, activation= K.exp))
# define the keras model
offset = Sequential()
offset.add(Dense(1, input_dim=1, activation='linear'))
from keras.layers import Input
tweet_a = Input(shape=(860, 11))
tweet_b = Input(shape=(860, 1))
tweetx = model(tweet_a)
tweety = offset(tweet_b)
from keras.layers import Multiply, add
output = Multiply()([tweetx, tweety])
from keras.models import Model
modelnew = Model(inputs=[tweet_a, tweet_b], outputs=output)
modelnew.compile(optimizer='rmsprop',loss='mse',metrics=['accuracy'])
modelnew.fit([datX, datW], datY, epochs=100, batch_size=10000)
Я ожидаю, что выход будет иметь 1 измерение и будет иметь вход 11 измерений