2016-02-23 16 views
3

我試圖做的迷宮問題是我的問題: 我也跟着教程和運行例子Pybrains迷宮教程使用pybrains 這裏得到錯誤

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) 

當我運行和顯示

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

任何人都可以幫助我嗎? 非常感謝

回答

2

爲了避免這種特定的警告我會建議使用numpy.not_equal

np.not_equal(self.lastobs, None) 

但無論如何,問題的事實,你與None比較對象的名單出現,這將導致逐元素比較(每個對象將依次與None進行比較)。這是警告你。你也可以忽略它。

+0

謝謝你的回答! 我注意到另一個是「assert self.lastaction!= None」 像lastobs這樣的想法,我可以重寫嗎? – Benny

+0

@Benny是的,你可以重新寫他們兩個沒問題。 (或者像我說的那樣忽略它們) – Idos