tfmri.math.project_onto_ball

project_onto_ball(x, order=2, radius=1.0, name=None)[source]

Projects an input vector onto the Lp ball.

Parameters
  • x – A tf.Tensor of shape [..., n].

  • order – A float. The order of the norm. Must be 1, 2, or np.inf.

  • radius

    A scalar tf.Tensor of type x.dtype.real_dtype. The radius of the ball. Defaults to 1.0.

  • name – A str. The name of this operation.

Returns

A tf.Tensor of shape [..., n] and dtype equal to x.dtype.

Raises
  • NotImplementedError

    If order is not 1, 2, or np.inf.

  • ValueError – If inputs are invalid.

References

1

Parikh, N., & Boyd, S. (2014). Proximal algorithms. Foundations and Trends in optimization, 1(3), 127-239.

2

Duchi, J., Shalev-Shwartz, S., Singer, Y., & Chandra, T. (2008). Efficient projections onto the l1-ball for learning in high dimensions. In Proceedings of the 25th International Conference on Machine Learning (pp. 272-279).