0

モデル入力 (x) として 2 次元配列がある TensorFlow の例では、MNIST データの代わりに独自のデータを交換しました。

[[379 1] [412 2] ... [205 1] [504 8]]

および 1d 出力 (y)、つまり:

[20, 24, ... 19, 27]

次のコードは[0.5, 0.5]、すべてのトレーニング ステップに対して 2 次元配列を生成し、テスト データに対する精度 (テスト データがランダムに生成される場合) に対して 1 を生成します。さらに、重みとバイアスはすべてゼロです。

for i in range(10):
  print 'iterator:'
  print i
  batch_ys = np.reshape(training_outputs, (300, 1))

  ## batch_xs.shape = (300, 2)
  batch_xs = training_inputs

  sess.run(train_step, feed_dict={x: batch_xs, y_: batch_ys})

  print 'softmax value'
  ## !! these are a all [ 0.5  0.5]  !!
  print(sess.run(y, feed_dict={x: batch_xs}))

correct_prediction = tf.equal(tf.argmax(y,1), tf.argmax(y_,1))

accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))

test_outputs = np.random.rand(300, 1)

## the following prints 1
print(sess.run(accuracy, feed_dict={x: test_inputs, y_: test_outputs}))

私は根本的に何かが欠けていますか?

4

0 に答える 0