|View source on GitHub|
Solves isotonic regression problems along the given axis.
tf.nn.isotonic_regression( inputs, decreasing=True, axis=-1 )
For each vector x, the problem solved is
As the solution is component-wise constant, a second tensor is returned that encodes the segments. The problems are solved over the given axis.
Consider the following example, where we solve a batch of two problems. The first input is [3, 1, 2], while the second 1, 3, 4.
x = tf.constant([[3, 1, 2], [1, 3, 4]], dtype=tf.float32) y, segments = tf.nn.isotonic_regression(x, axis=1) y # The solution.
Note that the first solution has two blocks  and [1.5, 1.5]. The second solution is constant, and thus has a single segment. These segments are exactly what the second returned tensor encodes:
<tf.Tensor: shape=(2, 3), dtype=int32, numpy=
array([[0, 1, 1],
[0, 0, 0]], dtype=int32)>
||A tensor holding the inputs.|
||If set to False, the inequalities in the optimizing constrained are flipped.|
||The axis along which the problems should be solved.|
||The solutions, same shape as type as the input.|
||An int32 tensor, same shape as the input indicating the segments that have the same value. Specifically, those positions that have the same value correspond to the same segment. These values start at zero, and are monotonously increasing for each solution.|