0
我試圖實施Q學習但情節沒有出現在任何地方。我在PyCharm Windows與Python 2.7.5中試用。pylab情節不顯示?
from scipy import *
import pylab
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
from pybrain.rl.experiments import Experiment
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, 1, 0, 1],
[1, 0, 0, 1, 0, 1, 1, 0, 1],
[1, 0, 0, 0, 0, 0, 1, 0, 1],
[1, 1, 1, 1, 1, 1, 1, 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)
controller.initialize(1.)
learner = Q()
agent = LearningAgent(controller, learner)
task = MDPMazeTask(environment)
experiment = Experiment(task, agent)
while True:
experiment.doInteractions(100)
agent.learn()
agent.reset()
pylab.pcolor(controller.params.reshape(81,4).max(1).reshape(9,9))
pylab.draw()
預期輸出:情節應該來。
我在Windows機器上安裝了以下軟件。
PyBrain==0.3
PythonMagick==0.9.9
ipython==1.2.1
libsvm==3.17
matplotlib==1.3.1
numpy==1.8.0
pyparsing==2.0.1
pyreadline==2.0
python-dateutil==2.2
pytz==2013.9
scikit-learn==0.14.1
scipy==0.13.3
six==1.5.2
電流輸出:沒有顯示。進程只是成功結束。
如何讓它工作。幫助他們。