提供的数据包含一个书面数字数据集(45000行,784列),一个语音数字数据集(45000行,1列)和一个包含带有值TRUE或FALSE(45000,布尔值)的标签的数据集。当语音和书面值对应于相同的数字时,label-value为TRUE。因此,我需要创建一个神经网络来预测结果是TRUE还是FALSE。
首先,我总结了数据(最小,最大,平均值,标准差)并应用了Perceptron,但错误率过高。因此,现在我正在尝试创建一个神经网络以应用于此问题。但是我被卡住了。
首先,我重塑了数据以使其正常工作:
written_train = written_train.reshape(45000,28,28)
spoken_train = spoken_train.reshape(45000,1,1)
之后,我想将此模型应用于数据:
def model(i,p,data_a,data_b,labels):
x=Input(shape=(28,28))
y=Input(shape=(1,1))
admi=LSTM(40,return_sequences=False)(x)
pla=LSTM(40,return_sequences=False)(y)
out=concatenate([admi,pla],axis=-1)
print(pla)
print(out)
output=Dense(1, activation='sigmoid')(out)
model = Model(inputs=[x, y], outputs=output)
model.compile(optimizer='rmsprop',
loss='binary_crossentropy',
metrics=['accuracy'])
n=model.fit([data_a, data_b],labels,batch_size=1, epochs=10)
return n
re=model(1,4,written_train,spoken_train,match_train)
print(re)
这将导致以下错误消息:
ValueError: setting an array element with a sequence.
所以我认为确实需要一些预处理,但是我不知道该如何做。 另外,这是我第一次使用Stackoverflow。因此,如果有任何需要改进的地方,请告诉我:)