【发布时间】:2022-01-22 05:47:13
【问题描述】:
我目前注册了Google Machine Learning crash course。在课程的特定部分,我们将介绍线性回归在 Python 代码中的实际应用。下面是相关代码(完整代码可以在here找到):-
my_feature = ([1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0])
my_label = ([5.0, 8.8, 9.6, 14.2, 18.8, 19.5, 21.4, 26.8, 28.9, 32.0, 33.8, 38.2])
learning_rate=0.05
epochs=100
my_batch_size= ? # Replace ? with an integer.
my_model = build_model(learning_rate)
trained_weight, trained_bias, epochs, rmse = train_model(my_model, my_feature,
my_label, epochs,
my_batch_size)
plot_the_model(trained_weight, trained_bias, my_feature, my_label)
plot_the_loss_curve(epochs, rmse)
这里假设包含所有必需的库并定义了函数(这里不感兴趣)。在上面的代码中,我无法理解 Hyperparameter batch_size。它在 ML Wiki 中被描述为 No。批量示例!?。它与 epochs (iterations?) 有关,因此 N/Batch_size 为我们提供了迭代次数(也无法理解 if batch_size
在我理解的三个超参数中
-
Learning_rate作为负梯度增量值,指向低损失区域。 -
epochs作为示例(完整数据集)被处理的次数 -
batch_size作为示例超集的子部分
请确认:-上述数据集的示例为{1.0, 5.0}。
问题:-当批大小小于N时,这些示例究竟如何处理?
P.S.:- batch_size 显然似乎对结果输出有很大影响,因为在后面的练习中,我们将对 17,000 个示例执行回归。当batch_size 为 30 时,我们得到 100+ 的 RMS 误差%,但在 batch_size 为 17000 时,RMS 误差% 为 1000+!!
【问题讨论】:
标签: python tensorflow linear-regression