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

LoggingAgent throws ValueError #234

Open
benjaminalt opened this issue Feb 13, 2018 · 1 comment
Open

LoggingAgent throws ValueError #234

benjaminalt opened this issue Feb 13, 2018 · 1 comment

Comments

@benjaminalt
Copy link

In the assertions in pybrain/rl/agents/logging.py in the getAction() method throw a ValueError if the state space is represented as a numpy array (or any array with more than one element):

Traceback (most recent call last):
  File "/media/data/Projects/hbp/hbpprak_locomotion/Nengo/main.py", line 32, in <module>
    main()
  File "/media/data/Projects/hbp/hbpprak_locomotion/Nengo/main.py", line 26, in main
    experiment.doInteractions(NUM_INTERACTIONS)
  File "/home/bal/Tools/nengo_rl/local/lib/python2.7/site-packages/pybrain/rl/experiments/experiment.py", line 18, in doInteractions
    self._oneInteraction()
  File "/home/bal/Tools/nengo_rl/local/lib/python2.7/site-packages/pybrain/rl/experiments/experiment.py", line 27, in _oneInteraction
    self.task.performAction(self.agent.getAction())
  File "/home/bal/Tools/nengo_rl/local/lib/python2.7/site-packages/pybrain/rl/agents/learning.py", line 48, in getAction
    LoggingAgent.getAction(self)
  File "/home/bal/Tools/nengo_rl/local/lib/python2.7/site-packages/pybrain/rl/agents/logging.py", line 42, in getAction
    assert self.lastobs != None
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

The documentation says that getSensors is supposed to return a numpy array of doubles, but the assertion failing tells me I made a programming mistake.

@drmargarido
Copy link

Try the fix I presented in the pull request #236 , should solve your problem.

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

2 participants