You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

mindspore.nn.MAE.rst 979 B

4 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041
  1. mindspore.nn.MAE
  2. ================
  3. .. py:class:: mindspore.nn.MAE
  4. 计算平均绝对误差MAE(Mean Absolute Error)。
  5. 计算输入 :math:`x` 和目标 :math:`y` 各元素之间的平均绝对误差。
  6. .. math::
  7. \text{MAE} = \frac{\sum_{i=1}^n \|{y\_pred}_i - y_i\|}{n}
  8. 这里, :math:`n` 是batch size。
  9. .. py:method:: clear()
  10. 内部评估结果清零。
  11. .. py:method:: eval()
  12. 计算平均绝对差(MAE)。
  13. **返回:**
  14. numpy.float64,计算的MAE的结果。
  15. **异常:**
  16. - **RuntimeError** - 样本总数为0。
  17. .. py:method:: update(*inputs)
  18. 使用预测值 :math:`y_{pred}` 和真实值 :math:`y` 更新局部变量。
  19. **参数:**
  20. - **inputs** - 输入 `y_pred` 和 `y` 来计算MAE,其中 `y_pred` 和 `y` 的shape都是N-D,它们的shape相同。
  21. **异常:**
  22. - **ValueError** - `inputs` 的数量不等于2。