optimize code docs about Loss and MSE
This commit is contained in:
parent
91d0897399
commit
fd363472a7
|
@ -97,7 +97,7 @@ class MSE(Metric):
|
|||
Measures the mean squared error(MSE).
|
||||
|
||||
Creates a criterion that measures the MSE (squared L2 norm) between
|
||||
each element in the predition and the ground truth: :math:`x` and: :math:`y`.
|
||||
each element in the prediction and the ground truth: :math:`x` and: :math:`y`.
|
||||
|
||||
.. math::
|
||||
\text{MSE}(x,\ y) = \frac{\sum_{i=1}^n(y_i - x_i)^2}{n}
|
||||
|
@ -106,6 +106,7 @@ class MSE(Metric):
|
|||
|
||||
Examples:
|
||||
>>> import numpy as np
|
||||
>>> import mindspore
|
||||
>>> from mindspore import nn, Tensor
|
||||
>>>
|
||||
>>> x = Tensor(np.array([0.1, 0.2, 0.6, 0.9]), mindspore.float32)
|
||||
|
@ -114,6 +115,8 @@ class MSE(Metric):
|
|||
>>> error.clear()
|
||||
>>> error.update(x, y)
|
||||
>>> result = error.eval()
|
||||
>>> print(result)
|
||||
0.0031250009778887033
|
||||
"""
|
||||
def __init__(self):
|
||||
super(MSE, self).__init__()
|
||||
|
|
|
@ -26,6 +26,7 @@ class Loss(Metric):
|
|||
|
||||
Examples:
|
||||
>>> import numpy as np
|
||||
>>> import mindspore
|
||||
>>> from mindspore import nn, Tensor
|
||||
>>>
|
||||
>>> x = Tensor(np.array(0.2), mindspore.float32)
|
||||
|
@ -33,6 +34,8 @@ class Loss(Metric):
|
|||
>>> loss.clear()
|
||||
>>> loss.update(x)
|
||||
>>> result = loss.eval()
|
||||
>>> print(result)
|
||||
0.20000000298023224
|
||||
"""
|
||||
def __init__(self):
|
||||
super(Loss, self).__init__()
|
||||
|
|
Loading…
Reference in New Issue