简体   繁体   English

Pylab情节不显示?

[英]Pylab Plot Not Showing Up?

I am trying to implement Q Learning but the plot is not showing up anywhere. 我正在尝试实施Q Learning,但情节并没有出现在任何地方。 I am trying it out in PyCharm Windows with Python 2.7.5 . 我正在使用Python 2.7.5PyCharm Windows中尝试它。

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()

Expected Output: The Plot should come. 预期产出:情节应该到来。

I have the following installed in my Windows Machine. 我在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

Current Output: Nothing Displays. 电流输出:无显示。 Process just ends successfully. 流程刚刚成功结束。

How to get it to work. 如何让它工作。 Help it guys. 帮助它们。

You need to start the gui threat. 你需要启动gui威胁。 You do this by either go to interactive mode or use 您可以通过转到交互模式或使用来完成此操作

pylab.show ()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM