Skip to content

Commit 461fbf3

Browse files
authored
Example title two times removed in regression_metrics.py (#20565)
1 parent 1d5774e commit 461fbf3

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

keras/src/metrics/regression_metrics.py

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ class MeanSquaredError(reduction_metrics.MeanMetricWrapper):
2828
dtype: (Optional) data type of the metric result.
2929
3030
Example:
31-
3231
>>> m = keras.metrics.MeanSquaredError()
3332
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]])
3433
>>> m.result()
@@ -64,6 +63,7 @@ class MeanAbsoluteError(reduction_metrics.MeanMetricWrapper):
6463
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]])
6564
>>> m.result()
6665
0.25
66+
6767
>>> m.reset_state()
6868
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]],
6969
... sample_weight=[1, 0])
@@ -103,14 +103,12 @@ class MeanAbsolutePercentageError(reduction_metrics.MeanMetricWrapper):
103103
name: (Optional) string name of the metric instance.
104104
dtype: (Optional) data type of the metric result.
105105
106-
Example:
107-
108-
Example:
109-
106+
Examples:
110107
>>> m = keras.metrics.MeanAbsolutePercentageError()
111108
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]])
112109
>>> m.result()
113110
250000000.0
111+
114112
>>> m.reset_state()
115113
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]],
116114
... sample_weight=[1, 0])
@@ -150,14 +148,13 @@ class MeanSquaredLogarithmicError(reduction_metrics.MeanMetricWrapper):
150148
name: (Optional) string name of the metric instance.
151149
dtype: (Optional) data type of the metric result.
152150
153-
Example:
154-
155-
Example:
151+
Examples:
156152
157153
>>> m = keras.metrics.MeanSquaredLogarithmicError()
158154
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]])
159155
>>> m.result()
160156
0.12011322
157+
161158
>>> m.reset_state()
162159
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]],
163160
... sample_weight=[1, 0])
@@ -197,9 +194,7 @@ class RootMeanSquaredError(reduction_metrics.Mean):
197194
name: (Optional) string name of the metric instance.
198195
dtype: (Optional) data type of the metric result.
199196
200-
Example:
201-
202-
Example:
197+
Examples:
203198
204199
>>> m = keras.metrics.RootMeanSquaredError()
205200
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]])
@@ -270,8 +265,7 @@ class CosineSimilarity(reduction_metrics.MeanMetricWrapper):
270265
axis: (Optional) Defaults to `-1`. The dimension along which the cosine
271266
similarity is computed.
272267
273-
274-
Example:
268+
Examples:
275269
276270
>>> # l2_norm(y_true) = [[0., 1.], [1./1.414, 1./1.414]]
277271
>>> # l2_norm(y_pred) = [[1., 0.], [1./1.414, 1./1.414]]
@@ -282,6 +276,7 @@ class CosineSimilarity(reduction_metrics.MeanMetricWrapper):
282276
>>> m.update_state([[0., 1.], [1., 1.]], [[1., 0.], [1., 1.]])
283277
>>> m.result()
284278
0.49999997
279+
285280
>>> m.reset_state()
286281
>>> m.update_state([[0., 1.], [1., 1.]], [[1., 0.], [1., 1.]],
287282
... sample_weight=[0.3, 0.7])
@@ -322,14 +317,13 @@ class LogCoshError(reduction_metrics.MeanMetricWrapper):
322317
name: (Optional) string name of the metric instance.
323318
dtype: (Optional) data type of the metric result.
324319
325-
Example:
326-
327-
Example:
320+
Examples:
328321
329322
>>> m = keras.metrics.LogCoshError()
330323
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]])
331324
>>> m.result()
332325
0.10844523
326+
333327
>>> m.reset_state()
334328
>>> m.update_state([[0, 1], [0, 0]], [[1, 1], [0, 0]],
335329
... sample_weight=[1, 0])

0 commit comments

Comments
 (0)