Skip to content

[Bug]: CrossValidation is broken, fails with ValueError #4879

@marnu35

Description

@marnu35

What happened?

The CrossValidation plot fails with ValueError.

Please provide a minimal, reproducible example of the unexpected behavior.

Steps to reproduce, use e.g. the tutorial sample here:

https://github.com/facebook/ax/blob/main/tutorials/getting_started/getting_started.ipynb

The last step, compute analyses fails with the error:

Please paste any relevant traceback/logs produced by the example provided.

[ERROR 02-10 17:56:12] ax.analysis.analysis: Failed to compute CrossValidationPlot
[ERROR 02-10 17:56:12] ax.analysis.analysis: Traceback (most recent call last):
  File "/home/marnu/projects/botorch-optimization-test/.boptest-env/lib/python3.12/site-packages/ax/analysis/analysis.py", line 107, in compute_result
    card = self.compute(
           ^^^^^^^^^^^^^
  File "/home/marnu/projects/botorch-optimization-test/.boptest-env/lib/python3.12/site-packages/ax/analysis/plotly/cross_validation.py", line 134, in compute
    cv_results = cross_validate(
                 ^^^^^^^^^^^^^^^
  File "/home/marnu/projects/botorch-optimization-test/.boptest-env/lib/python3.12/site-packages/ax/adapter/cross_validation.py", line 166, in cross_validate
    cv_test_observations = t.transform_observations(
                           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/marnu/projects/botorch-optimization-test/.boptest-env/lib/python3.12/site-packages/ax/adapter/transforms/base.py", line 146, in transform_observations
    obs_data = self._transform_observation_data(observation_data=obs_data)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/marnu/projects/botorch-optimization-test/.boptest-env/lib/python3.12/site-packages/ax/adapter/transforms/winsorize.py", line 144, in _transform_observation_data
    obsd.means[idx] = max(
    ~~~~~~~~~~^^^^^
ValueError: assignment destination is read-only

odict_values([<ax.adapter.transforms.fill_missing_parameters.FillMissingParameters object at 0x774418326ed0>, <ax.adapter.transforms.cast.Cast object at 0x774418327770>, <ax.adapter.transforms.map_key_to_float.MapKeyToFloat object at 0x774418327590>, <ax.adapter.transforms.remove_fixed.RemoveFixed object at 0x774418324ec0>, <ax.adapter.transforms.choice_encode.OrderedChoiceToIntegerRange object at 0x774418325130>, <ax.adapter.transforms.one_hot.OneHot object at 0x774418324590>, <ax.adapter.transforms.log.Log object at 0x774418324e60>, <ax.adapter.transforms.logit.Logit object at 0x774418325bb0>, <ax.adapter.transforms.derelativize.Derelativize object at 0x7744183250d0>, <ax.adapter.transforms.winsorize.Winsorize object at 0x7744183273b0>, <ax.adapter.transforms.bilog_y.BilogY object at 0x774418327290>, <ax.adapter.transforms.standardize_y.StandardizeY object at 0x774418325880>])

Ax Version

1.2.1

Python Version

3.12.12

Operating System

WSL Ubuntu

(Optional) Describe any potential fixes you've considered to the issue outlined above.

No response

Pull Request

Yes

Code of Conduct

  • I agree to follow Ax's Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type
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