0
HEJ、IRISのための私のマルチクラスニューラルネットワークの最終段階ではテンソル「Placeholder_10:0」の(4)形状の値を養うことができない、形状をしている「(?、4)」
データセット、私は次のコードを実行しています:ここ
steps = 2500
with tf.Session() as sess:
sess.run(init)
for i in range(steps):
sess.run(train,feed_dict={X_data:X_train,y_target:y_train})
# PRINT OUT A MESSAGE EVERY 100 STEPS
if i%500 == 0:
print('Currently on step {}'.format(i))
print('Accuracy is:')
# Test the Train Model
matches = tf.equal(tf.argmax(final_output,1),tf.argmax(y_target,1))
acc = tf.reduce_mean(tf.cast(matches,tf.float32))
print(sess.run(acc,feed_dict={X_data:X_test,y_target:y_test}))
print('\n')
correct_prediction = tf.equal(tf.argmax(final_output,1), tf.argmax(y_target,1))
accuracy = tf.reduce_mean(tf.cast(correct_prediction, "float"))
print("Final accuracy: ", sess.run(accuracy, feed_dict={X_data: X_test, y_target: y_test}))
私の最後のステップは、手動で入力された値の出力を予測することです。私はこの試みた:
prediction=tf.argmax(final_output,1)
print("Predictions")
new = [5.1,3.5,1.4,0.2]
print(prediction.eval(feed_dict={X_data: new}))
を私は、私は本当に4マニュアルはこのプレースホルダ
の形式に収まるように値を入力してリストを作成する方法がわからないCannot feed value of shape (4,) for Tensor 'Placeholder_10:0', which has shape '(?, 4)'
次のエラーを取得します
X_data = tf.placeholder(shape=[None, 4], dtype=tf.float32)
ありがとうございます!
パーフェクトは、魔法のように動作します! – Schnurrberto