You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following code is rl.py that implements mdp maze in pybrain:
from scipy import * #@UnusedWildImport
import matplotlib.pyplot as plt
from pybrain.rl.environments.mazes import Maze, MDPMazeTask
from pybrain.rl.learners.valuebased import ActionValueTable
from pybrain.rl.agents import LearningAgent
from pybrain.rl.learners import Q, SARSA #@UnusedImport
from pybrain.rl.experiments import Experiment
I tried to change it to pomdp maze by replacing 'task = MDPMazeTask(environment)' with 'task = TrivialMaze()
'
but this encountered the following errors :
Traceback (most recent call last):
File "/home/web/pybrain-master/docs/tutorials/rl.py", line 140, in
experiment.doInteractions(100)# speed of learning
File "/home/web/pybrain-master/pybrain/rl/experiments/experiment.py", line 18, in doInteractions
self._oneInteraction()
File "/home/web/pybrain-master/pybrain/rl/experiments/experiment.py", line 27, in _oneInteraction
self.task.performAction(self.agent.getAction())
File "/home/web/pybrain-master/pybrain/rl/agents/learning.py", line 50, in getAction
self.lastaction = self.module.activate(self.lastobs)
File "/home/web/pybrain-master/pybrain/structure/modules/module.py", line 121, in activate
assert len(self.inputbuffer[self.offset]) == len(inpt), str((len(self.inputbuffer[self.offset]), len(inpt)))
AssertionError: (1, 4)
Can anyone help me please?
The text was updated successfully, but these errors were encountered:
semolnahali
changed the title
POMDP Maze cannot be run
POMDP Maze cannot be run in Pybrain
Jun 7, 2018
The following code is rl.py that implements mdp maze in pybrain:
from scipy import * #@UnusedWildImport
import matplotlib.pyplot as plt
from pybrain.rl.environments.mazes import Maze, MDPMazeTask
from pybrain.rl.learners.valuebased import ActionValueTable
from pybrain.rl.agents import LearningAgent
from pybrain.rl.learners import Q, SARSA #@UnusedImport
from pybrain.rl.experiments import Experiment
plt.gray()
plt.ion()
structure = array([[1, 1, 1, 1, 1, 1, 1, 1, 1],
[1, 0, 0, 1, 0, 0, 0, 0, 1],
[1, 0, 0, 1, 0, 0, 1, 0, 1],
[1, 0, 0, 1, 0, 0, 0, 0, 1],
[1, 0, 0, 1, 0, 1, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 0, 0, 0, 0, 0, 0, 0, 1],
[1, 1, 1, 1, 1, 1, 1, 1, 1]])
environment = Maze(structure, (7, 7))
controller = ActionValueTable(81, 4)
learner = Q()
agent = LearningAgent(controller, learner)
task = MDPMazeTask(environment)
experiment = Experiment(task, agent)
while True:
experiment.doInteractions(100)
agent.learn()
agent.reset()
plt.pcolor(controller.params.reshape(81,4).max(1).reshape(9,9))
plt.show()
plt.pause(0.1)
I tried to change it to pomdp maze by replacing 'task = MDPMazeTask(environment)' with 'task = TrivialMaze()
'
but this encountered the following errors :
Traceback (most recent call last):
File "/home/web/pybrain-master/docs/tutorials/rl.py", line 140, in
experiment.doInteractions(100)# speed of learning
File "/home/web/pybrain-master/pybrain/rl/experiments/experiment.py", line 18, in doInteractions
self._oneInteraction()
File "/home/web/pybrain-master/pybrain/rl/experiments/experiment.py", line 27, in _oneInteraction
self.task.performAction(self.agent.getAction())
File "/home/web/pybrain-master/pybrain/rl/agents/learning.py", line 50, in getAction
self.lastaction = self.module.activate(self.lastobs)
File "/home/web/pybrain-master/pybrain/structure/modules/module.py", line 121, in activate
assert len(self.inputbuffer[self.offset]) == len(inpt), str((len(self.inputbuffer[self.offset]), len(inpt)))
AssertionError: (1, 4)
Can anyone help me please?
The text was updated successfully, but these errors were encountered: