def binaryClassify_DNN(units,steps,trainingFilePath,testingFilePath,modelPath):
# Data sets
# Load datasets.
training_set = tf.contrib.learn.datasets.base.load_csv(filename=trainingFilePath,target_dtype=np.float)
test_set = tf.contrib.learn.datasets.base.load_csv(filename=testingFilePath,target_dtype=np.float)
# Build 3 layer DNN with 10, 20, 10 units respectively.
classifier = tf.contrib.learn.DNNClassifier(hidden_units=units,n_classes=2,model_dir=modelPath,optimizer=tf.train.ProximalAdagradOptimizer(learning_rate=0.1))
# Fit model.
classifier.fit(x=training_set.data,
y=training_set.target,
steps=steps)
# Evaluate accuracy.
accuracy_score = classifier.evaluate(x=test_set.data,
y=test_set.target)["accuracy"]
print('Accuracy: {0:f}'.format(accuracy_score))
我已经对上面的源代码进行了编码,与https://www.tensorflow.org/versions/r0.10/tutorials/tflearn/index.html#tf-contrib-learn-quickstart相比变化不大
如您所见,我没有为batch_size
添加参数,我可以将其添加到classifier.fi()
我试着执行这段代码,它似乎没有批量大小循环。 我的意思是,它看起来像是用全尺寸的数据进行培训,而不是小批量。在
是真的吗?在
我想知道批量大小的默认设置是什么。在
提前谢谢。在
我很抱歉,我应该在发布之前查看源代码
如您所见,默认批处理大小是“x”的第一个维度
相关问题 更多 >
编程相关推荐