我有兩個數據集,這是這樣的:數據結構差異/ TFLearn
input:
array([[[ 0.99309823],
...
[ 0. ]]])
shape : (1, 2501)
output:
array([[0, 0, 0, ..., 0, 0, 1],
...,
[0, 0, 0, ..., 0, 0, 0]])
shape : (2501, 9)
我與TFLearn處理它;作爲
input_layer = tflearn.input_data(shape=[None,2501])
hidden1 = tflearn.fully_connected(input_layer,1205,activation='ReLU', regularizer='L2', weight_decay=0.001)
dropout1 = tflearn.dropout(hidden1,0.8)
hidden2 = tflearn.fully_connected(dropout1,1205,activation='ReLU', regularizer='L2', weight_decay=0.001)
dropout2 = tflearn.dropout(hidden2,0.8)
softmax = tflearn.fully_connected(dropout2,9,activation='softmax')
# Regression with SGD
sgd = tflearn.SGD(learning_rate=0.1,lr_decay=0.96, decay_step=1000)
top_k=tflearn.metrics.Top_k(3)
net = tflearn.regression(softmax,optimizer=sgd,metric=top_k,loss='categorical_crossentropy')
model = tflearn.DNN(net)
model.fit(input,output,n_epoch=10,show_metric=True, run_id='dense_model')
它的工作原理,但不是我想要的方式。這是一個DNN模型。我希望當我輸入0.95時,模型必須給出相應的預測,例如[0,0,0,0,0,0,0,0,1]。然而,當我想進入0.95,它說,
ValueError: Cannot feed value of shape (1,) for Tensor 'InputData/X:0', which has shape '(?, 2501)'
當我試圖瞭解我意識到我需要(1,2501)形狀的數據來預測我錯了基於模型。
我想要的是輸入中的每個元素,預測輸出中的相應元素。如您所見,在實例數據集中,對於[0.99309823],實例數據集中的
,相應的輸出爲[0,0,0,0,0,0,0,0,1]。我想要這樣訓練自己。
我可能有錯誤的結構化數據或模型(可能是數據集),我解釋了所有的東西,我需要幫助,我真的不知道。
你是對的,謝謝rcmalli。 –