Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with return types of evaluation functions #118

Closed
ronald-jaepel opened this issue Mar 25, 2024 · 1 comment
Closed

Issue with return types of evaluation functions #118

ronald-jaepel opened this issue Mar 25, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@ronald-jaepel
Copy link
Collaborator

ronald-jaepel commented Mar 25, 2024

This issue is to collect my notes and thoughts to look over tomorrow.

ax.NEHVI is broken with

[INFO 03-25 16:44:05] ax.core.experiment: No trials are in a state expecting data.
C:\Users\ronal\mambaforge\envs\cadet-process-debug\Lib\site-packages\CADETProcess\optimization\axAdapater.py:395: UserWarning: Initial population smaller than popsize. Creating missing entries.
  warnings.warn(
Traceback (most recent call last):
  File "C:\Users\ronal\mambaforge\envs\cadet-process-debug\Lib\site-packages\IPython\core\interactiveshell.py", line 3577, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-de9f0bd67ea9>", line 1, in <module>
    runfile('C:\\Users\\ronal\\PycharmProjects\\pamenter\\code\\MSSMA_3comp_3grad_UCL.py', wdir='C:\\Users\\ronal\\PycharmProjects\\pamenter\\code')
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_umd.py", line 197, in runfile
    pydev_imports.execfile(filename, global_vars, local_vars)  # execute the script
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2023.2.3\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:\Users\ronal\PycharmProjects\pamenter\code\MSSMA_3comp_3grad_UCL.py", line 293, in <module>
    optimization_results = optimizer.optimize(
                           ^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ronal\mambaforge\envs\cadet-process-debug\Lib\site-packages\CADETProcess\optimization\optimizer.py", line 254, in optimize
    self.run(self.optimization_problem, x0, *args, **kwargs)
  File "C:\Users\ronal\mambaforge\envs\cadet-process-debug\Lib\site-packages\CADETProcess\optimization\axAdapater.py", line 418, in run
    self._create_manual_trial(x0_init_transformed)
  File "C:\Users\ronal\mambaforge\envs\cadet-process-debug\Lib\site-packages\CADETProcess\optimization\axAdapater.py", line 274, in _create_manual_trial
    trial.run()
  File "C:\Users\ronal\mambaforge\envs\cadet-process-debug\Lib\site-packages\ax\core\base_trial.py", line 408, in run
    self._run_metadata = not_none(self._runner).run(self)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\ronal\mambaforge\envs\cadet-process-debug\Lib\site-packages\CADETProcess\optimization\axAdapater.py", line 129, in run
    trial_metadata = self.get_metadata(
                     ^^^^^^^^^^^^^^^^^^
  File "C:\Users\ronal\mambaforge\envs\cadet-process-debug\Lib\site-packages\CADETProcess\optimization\axAdapater.py", line 143, in get_metadata
    for metric, f_metric in zip(objective_labels, F.T)
                                                  ^^^
AttributeError: 'list' object has no attribute 'T'

Git bisect shows commit f765f3f to be the first commit with that issue.

I think, axAdapter.get_metadata() expects F (the objectives) to be a numpy array and have a .T transformed attribute.
The new transform_maximization returns a list

s = np.multiply(factors, s).tolist()

return s

@schmoelder let's discuss tomorrow.

@ronald-jaepel ronald-jaepel added the bug Something isn't working label Mar 25, 2024
@ronald-jaepel
Copy link
Collaborator Author

Plan is to always return np.ndarrays as F.

@schmoelder schmoelder changed the title Commit f765f3fe breaks Ax.NEHVI Issue with return types of evaluation functions. Apr 11, 2024
@schmoelder schmoelder changed the title Issue with return types of evaluation functions. Issue with return types of evaluation functions Apr 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants