r"""Evaluate the constraint function. Parameters ---------- \*\*kwargs : any Function arguments to evaluate the constraint function on. Returns ------- Value of the constraint function. Raises ------ TypeError
(self, **kwargs: Any)
| 96 | return self._model |
| 97 | |
| 98 | def eval(self, **kwargs: Any) -> float | NDArray[Float]: # noqa: D417 |
| 99 | r"""Evaluate the constraint function. |
| 100 | |
| 101 | Parameters |
| 102 | ---------- |
| 103 | \*\*kwargs : any |
| 104 | Function arguments to evaluate the constraint function on. |
| 105 | |
| 106 | |
| 107 | Returns |
| 108 | ------- |
| 109 | Value of the constraint function. |
| 110 | |
| 111 | Raises |
| 112 | ------ |
| 113 | TypeError |
| 114 | If the kwargs' keys don't match the function argument names. |
| 115 | """ |
| 116 | if self.fun is None: |
| 117 | error_msg = "No constraint function was provided." |
| 118 | raise ValueError(error_msg) |
| 119 | |
| 120 | try: |
| 121 | return self.fun(**kwargs) |
| 122 | except TypeError as e: |
| 123 | msg = ( |
| 124 | "Encountered TypeError when evaluating constraint " |
| 125 | "function. This could be because your constraint function " |
| 126 | "doesn't use the same keyword arguments as the target " |
| 127 | f"function. Original error message:\n\n{e}" |
| 128 | ) |
| 129 | e.args = (msg,) |
| 130 | raise |
| 131 | |
| 132 | def fit(self, X: NDArray[Float], Y: NDArray[Float]) -> None: |
| 133 | """Fit internal GPRs to the data. |
no outgoing calls