详细内容或原文请订阅后点击阅览
用于机器学习工作流程的可视化调试工具
在本文中,我们涵盖三个主题:训练期间可视化的内容、提供这些可视化的工具以及使用挂钩和断点直接捕获模型计算的方法。
来源:KDnuggets简介
训练机器学习模型并观察损失的减少是一种进步的感觉,直到验证准确性达到稳定水平或损失开始飙升,并且您不确定是什么导致了它。 At that point, most people add more logging or start tuning hyperparameters, hoping something changes. What most analysts skip at this stage is actual visibility into what is happening inside the model during training. Visual debugging tools can provide useful insights at this stage.
在本文中,我们涵盖三个主题:训练期间可视化的内容(梯度、损失和嵌入)、提供这些可视化的工具(TensorBoard 及其主要替代方案)以及使用钩子和断点直接捕获模型计算的方法。
Visualizing Gradients, Losses, and Embeddings
损失曲线
When training a model, the loss curve is usually the first thing to check. When both the training loss and validation loss decline and remain close, it indicates that the training is progressing well. When validation loss starts rising while training loss keeps falling, the model is overfitting. When both curves plateau early, the model isn't learning, which typically indicates a problem with the data or learning rate.
In addition, gradient flow is also important.如果损失曲线平滑但太慢地下降,表明梯度在到达早期层时太小,则在实践中可能会出现梯度消失问题。
The plot shown below simulates a typical overfitting pattern. Both losses decrease together for the first ten epochs, and then the validation loss starts increasing while the training loss keeps falling.
红色虚线标记了分歧开始的位置:在实际运行中,这是开始研究正则化或早期停止的点。
它输出:
原始梯度幅值
渐变可视化
可以在此处找到相关代码。
