私はUdacity Deep Learningクラスを勉強しています。その宿題は「過度の過度の場合を示します。トレーニングデータをほんの数バッチに制限してください。ステップ、バッチサイズin Gradient Descent Tensorflow
私の質問は:
1) はなぜはnum_steps, num_batches
がオーバーフィッティングを行うには何も持って減らすん?変数を追加したり、Wのサイズを増やしたりすることはありません。
以下のコードでは、num_stepsは3001、num_batchesは128であり、ソリューションではそれぞれ101と3に減少しています。
num_steps = 101
num_bacthes = 3
with tf.Session(graph=graph) as session:
tf.initialize_all_variables().run()
print("Initialized")
for step in range(num_steps):
# Pick an offset within the training data, which has been randomized.
# Note: we could use better randomization across epochs.
#offset = (step * batch_size) % (train_labels.shape[0] - batch_size)
offset = step % num_bacthes
# Generate a minibatch.
batch_data = train_dataset[offset:(offset + batch_size), :]
batch_labels = train_labels[offset:(offset + batch_size), :]
# Prepare a dictionary telling the session where to feed the minibatch.
# The key of the dictionary is the placeholder node of the graph to be fed,
# and the value is the numpy array to feed to it.
feed_dict = {tf_train_dataset : batch_data, tf_train_labels : batch_labels, beta_regul : 1e-3}
_, l, predictions = session.run(
[optimizer, loss, train_prediction], feed_dict=feed_dict)
if (step % 2 == 0):
print("Minibatch loss at step %d: %f" % (step, l))
print("Minibatch accuracy: %.1f%%" % accuracy(predictions, batch_labels))
print("Validation accuracy: %.1f%%" % accuracy(
valid_prediction.eval(), valid_labels))
print("Test accuracy: %.1f%%" % accuracy(test_prediction.eval(), test_labels))
このコードは、溶液からの抜粋です:https://github.com/rndbrtrnd/udacity-deep-learning/blob/master/3_regularization.ipynb
2)誰かが、勾配降下中に「オフセット」の概念を説明することはできますか?なぜそれを使わなければならないのですか?
3)私はnum_stepsを実験して、num_stepsを大きくすると精度が上がることを発見しました。どうして? num_stepを学習率でどのように解釈すればよいですか?