function.remote
function.remote
Functions
| Name | Description |
|---|---|
| objective_remote | Evaluates an objective function remotely via an HTTP POST request. |
objective_remote
function.remote.objective_remote(
X,
url=DEFAULT_SERVER_URL,
timeout=DEFAULT_TIMEOUT,
**kwargs,
)Evaluates an objective function remotely via an HTTP POST request.
Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| X | np.ndarray | Input data of shape (n_samples, n_features). | required |
| url | str | The URL of the remote computation server. Defaults to “http://139.6.66.164:8000/compute/”. | DEFAULT_SERVER_URL |
| timeout | float | tuple[float, float] | Request timeout in seconds as a single value or a (connect, read) tuple. Defaults to (10, 120); the bounded connect time prevents the call from hanging when the server is unreachable. |
DEFAULT_TIMEOUT |
| **kwargs | Any |
Additional arguments to include in the request payload (optional). | {} |
Returns
| Name | Type | Description |
|---|---|---|
| np.ndarray | np.ndarray: The computed objective values of shape (n_samples,). |
Raises
| Name | Type | Description |
|---|---|---|
requests.exceptions.RequestException |
If the remote request fails. |
Examples
>>> import numpy as np
>>> from spotoptim.function.remote import objective_remote
>>> X = np.array([[1, 2], [3, 4]])
>>> y = objective_remote(X)
>>> print(y)