Skip to content

Question: extra outputs is not compatible with context manager with multiple context variables? #312

Open
@clairecp

Description

@clairecp

Hello everyone!

When using extra_outputs from the user_function, I was expecting extra_outputs to be directly usable as context? However in emukit.core.loop.user_function.py, the extra outputs have to be np.ndarrays of at least 2d and so the dictionary of extra_outputs that is returned is of the form {'key0': array([2.1]), 'key1': array([2.]), 'key2': array([1.])}.

By using this dictionary as context, when multiple context values are present, the expend_vector method in core.optimization.context_manager.py fails with a broadcast error because the context_values is no longer 1d.

This is not really an issue, as we can simply process the extra_outputs after getting them from the user_function_result to make them simple values instead of arrays. But I wanted to ask if the requirements for extra_outputs to be 2d numpy arrays is due to some functionality I am missing?
I was expecting the extra_outputs to be directly compatible with context_manager when used as context?

Looking forward to your answer,
Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions