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.MSE.rst 969 B

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