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

incorrect default search_space for GridSearch on OCM #2229

Open
kmantel opened this issue Dec 7, 2021 · 0 comments
Open

incorrect default search_space for GridSearch on OCM #2229

kmantel opened this issue Dec 7, 2021 · 0 comments

Comments

@kmantel
Copy link
Collaborator

kmantel commented Dec 7, 2021

a = pnl.TransferMechanism(
    name='a',
    function=pnl.Linear(
        slope=(1, pnl.CONTROL),
    )
)

comp = pnl.Composition()
comp.add_node(a)

ocm = pnl.OptimizationControlMechanism(agent_rep=comp)
comp.add_controller(ocm)

produces the error

PsyNeuLink/psyneulink/core/components/functions/nonstateful/optimizationfunctions.py:593: UserWarning: The following arg(s) were not specified for GridSearch Function-0: objective_function, aggregation_function -- using default(s)
  format(self.name, ', '.join(self._unspecified_args)))
Traceback (most recent call last):
  File "", line 1789, in <module>
    agent_rep=comp,
  File "PsyNeuLink/psyneulink/core/globals/context.py", line 737, in wrapper
    return func(*args, context=context, **kwargs)
  File "~/.pyenv/versions/pnl377/lib/python3.7/site-packages/typecheck/decorators.py", line 76, in typecheck_invocation_proxy
    result = method(*args, **kwargs)
  File "PsyNeuLink/psyneulink/core/components/mechanisms/modulatory/control/optimizationcontrolmechanism.py", line 1396, in __init__
    **kwargs
  File "~/.pyenv/versions/pnl377/lib/python3.7/site-packages/typecheck/decorators.py", line 76, in typecheck_invocation_proxy
    result = method(*args, **kwargs)
  File "PsyNeuLink/psyneulink/core/components/mechanisms/modulatory/control/controlmechanism.py", line 1315, in __init__
    **kwargs
  File "PsyNeuLink/psyneulink/core/components/mechanisms/modulatory/modulatorymechanism.py", line 217, in __init__
    **kwargs
  File "PsyNeuLink/psyneulink/core/components/mechanisms/mechanism.py", line 1720, in __init__
    **kwargs
  File "PsyNeuLink/psyneulink/core/components/shellclasses.py", line 90, in __init__
    **kwargs)
  File "PsyNeuLink/psyneulink/core/components/component.py", line 1261, in __init__
    self._instantiate_attributes_after_function(context=context)
  File "PsyNeuLink/psyneulink/core/components/mechanisms/modulatory/control/optimizationcontrolmechanism.py", line 1810, in _instantiate_attributes_after_function
    RANDOMIZATION_DIMENSION: randomization_control_signal_index
  File "PsyNeuLink/psyneulink/core/globals/context.py", line 737, in wrapper
    return func(*args, context=context, **kwargs)
  File "PsyNeuLink/psyneulink/core/components/functions/nonstateful/optimizationfunctions.py", line 1471, in reset
    raise OptimizationFunctionError(f"Invalid {repr(SEARCH_SPACE)} arg for {self.name}{owner_str}; "
psyneulink.core.components.functions.nonstateful.optimizationfunctions.OptimizationFunctionError: Invalid 'search_space' arg for GridSearch Function-0 of OptimizationControlMechanism-0; every dimension must be assigned a SampleIterator.

Automatic setting of a valid search_space is expected

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant