r""" Compute the values of the lower and upper bounding potentials at the input points Y, using the potential optimal values phi at X and their gradients G at X. The 'lower' potential corresponds to the method from :ref:`[58]`, Equation 2, while the bounding property and 'upper' potentia
(
X,
phi,
G,
Y,
X_classes=None,
Y_classes=None,
strongly_convex_constant=0.6,
gradient_lipschitz_constant=1.4,
log=False,
solver=None,
)
| 226 | |
| 227 | |
| 228 | def nearest_brenier_potential_predict_bounds( |
| 229 | X, |
| 230 | phi, |
| 231 | G, |
| 232 | Y, |
| 233 | X_classes=None, |
| 234 | Y_classes=None, |
| 235 | strongly_convex_constant=0.6, |
| 236 | gradient_lipschitz_constant=1.4, |
| 237 | log=False, |
| 238 | solver=None, |
| 239 | ): |
| 240 | r""" |
| 241 | Compute the values of the lower and upper bounding potentials at the input points Y, using the potential optimal |
| 242 | values phi at X and their gradients G at X. The 'lower' potential corresponds to the method from :ref:`[58]`, |
| 243 | Equation 2, while the bounding property and 'upper' potential come from :ref:`[59]`, Theorem 3.14 (taking into |
| 244 | account the fact that this theorem's statement has a min instead of a max, which is a typo). Both potentials are |
| 245 | optimal for the SSNB problem. |
| 246 | |
| 247 | If :math:`I_k` is the subset of :math:`[n]` of the i such that :math:`x_i` is in the partition (or class) |
| 248 | :math:`E_k`, for each :math:`y \in E_k`, this function solves the convex QCQP problems, |
| 249 | respectively for l: 'lower' and u: 'upper': |
| 250 | |
| 251 | .. math:: |
| 252 | :nowrap: |
| 253 | |
| 254 | \begin{gather*} |
| 255 | (\varphi_{l}(x), \nabla \varphi_l(x)) = \text{argmin}\ t, \\ |
| 256 | t\in \mathbb{R},\; g\in \mathbb{R}^d, \\ |
| 257 | \text{s.t.} \forall j \in I_k,\; t-\varphi_j - \langle g_j, y-x_j \rangle \geq c_1\|g - g_j\|_2^2 |
| 258 | + c_2\|y-x_j\|_2^2 - c_3\langle g_j-g, x_j -y \rangle. |
| 259 | \end{gather*} |
| 260 | |
| 261 | .. math:: |
| 262 | :nowrap: |
| 263 | |
| 264 | \begin{gather*} |
| 265 | (\varphi_{u}(x), \nabla \varphi_u(x)) = \text{argmax}\ t, \\ |
| 266 | t\in \mathbb{R},\; g\in \mathbb{R}^d, \\ |
| 267 | \text{s.t.} \forall i \in I_k,\; \varphi_i^* -t - \langle g, x_i-y \rangle \geq c_1\|g_i - g\|_2^2 |
| 268 | + c_2\|x_i-y\|_2^2 - c_3\langle g-g_i, y -x_i \rangle. |
| 269 | \end{gather*} |
| 270 | |
| 271 | The constants :math:`c_1, c_2, c_3` only depend on `strongly_convex_constant` and `gradient_lipschitz_constant`. |
| 272 | |
| 273 | .. warning:: This function requires the CVXPY library |
| 274 | .. warning:: Accepts any backend but will convert to Numpy then back to the backend. |
| 275 | |
| 276 | Parameters |
| 277 | ---------- |
| 278 | X : array-like (n, d) |
| 279 | reference points used to compute the optimal values phi and G |
| 280 | X_classes : array-like (n,) |
| 281 | classes of the reference points |
| 282 | phi : array-like (n,) |
| 283 | optimal values of the potential at the points X |
| 284 | G : array-like (n, d) |
| 285 | optimal values of the gradients at the points X |
no test coverage detected