Skip to content

Handling of error when calling get_surrogate_values with no points to predict #41

Description

@marshallmcdonnell

Currently , this is the output from a fail like that:
ERROR:dial_service.dial_service:get_surrogate_values exception (primary logic) for 6a24964fbc355556959d697f
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/dial_service/dial_service.py", line 321, in get_surrogate_values
return_data = core.get_surrogate_values(data, model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/dial_service/core.py", line 102, in get_surrogate_values
means, stddevs = module.predict(model, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/dial_service/backends/sklearn_backend.py", line 122, in predict
means, stddevs = model.predict(data.x_predict.reshape(-1, dim), return_std=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/sklearn/gaussian_process/_gpr.py", line 418, in predict
X = validate_data(self, X, ensure_2d=ensure_2d, dtype=dtype, reset=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/sklearn/utils/validation.py", line 2902, in validate_data
out = check_array(X, input_name="X", **check_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/sklearn/utils/validation.py", line 1097, in check_array
raise ValueError(
ValueError: Found array with 0 sample(s) (shape=(0, 2)) while a minimum of 1 is required by GaussianProcessRegressor.
WARNING:intersect-sdk:Capability raised explicit exception:
Traceback (most recent call last):
File "/app/.venv/lib/python3.12/site-packages/dial_service/dial_service.py", line 321, in get_surrogate_values
return_data = core.get_surrogate_values(data, model)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/dial_service/core.py", line 102, in get_surrogate_values
means, stddevs = module.predict(model, data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/dial_service/backends/sklearn_backend.py", line 122, in predict
means, stddevs = model.predict(data.x_predict.reshape(-1, dim), return_std=True)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/sklearn/gaussian_process/_gpr.py", line 418, in predict
X = validate_data(self, X, ensure_2d=ensure_2d, dtype=dtype, reset=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/sklearn/utils/validation.py", line 2902, in validate_data
out = check_array(X, input_name="X", **check_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/app/.venv/lib/python3.12/site-packages/sklearn/utils/validation.py", line 1097, in check_array
raise ValueError(
ValueError: Found array with 0 sample(s) (shape=(0, 2)) while a minimum of 1 is required by GaussianProcessRegressor.

yet, we should probably handle this more gracefully / sooner before it backends.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions