Search code examples
pythonnumpyscipymaze

Pybrains Maze tutorial gets Error


I am trying to do Maze question by using pybrains here is my question: I followed the tutorial and run example

envmatrix = [[...]]
env = Maze(envmatrix, (1, 8))
task = MDPMazeTask(env)
table = ActionValueTable(states_nr, actions_nr)
table.initialize(0.)
learner = Q()
agent = LearningAgent(table, learner)
experiment = Experiment(task, agent)

when I run and showed

assert self.lastobs != None
FutureWarning: comparison to `None` will result in an elementwise object comparison in the future.

Could anyone helps me? Thanks a lot


Solution

  • To avoid this specific warning I would suggest using numpy.not_equal:

    np.not_equal(self.lastobs, None)
    

    Anyway the problem arises from the fact that you are comparing a list of objects with None which will cause an element-wise comparison (each object will be compared with None in turn). This is it's warning you about. You can also ignore it.