作家
登录

深度强化学习入门:用TensorFlow构建你的第一个游戏AI

作者: 来源: 2017-11-21 10:53:27 阅读 我要评论

action = np.argmax(q[0]) 
  •  
  •             # apply action, get rewards and new state 
  •             input_t, reward, game_over = env.act(action
  •             #If we managed to catch the fruit we add 1 to our win counter 
  •             if reward == 1: 
  •                 win_cnt += 1         
  •              
  •             #Uncomment this to render the game here 
  •             #display_screen(action,3000,inputs[0]) 
  •              
  •             ""
  •             The experiences < s, a, r, s’ > we make during gameplay are our training data. 
  •             Here we first save the last experience, and then load a batch of experiences to train our model 
  •             ""
  •              
  •             # store experience 
  •             exp_replay.remember([input_tm1, action, reward, input_t], game_over)     
  •              
  •             # Load batch of experiences 
  •             inputs, targets = exp_replay.get_batch(model, batch_size=batch_size) 
  •    
  •             # train model on experiences 
  •             batch_loss = model.train_on_batch(inputs, targets) 
  •              
  •             #sum up loss over all batches in an epoch 

      推荐阅读

      什么是云计算数据中心?云计算数据中心和传统IDC有何区别?

    Tech Neo技巧沙龙 | 11月25号,九州云/ZStack与您一路商量云时代收集界线治理实践 传统小IDC存活将更难,那么必>>>详细阅读


    本文标题:深度强化学习入门:用TensorFlow构建你的第一个游戏AI

    地址:http://www.17bianji.com/lsqh/39071.html

  • 关键词: 探索发现

    乐购科技部分新闻及文章转载自互联网,供读者交流和学习,若有涉及作者版权等问题请及时与我们联系,以便更正、删除或按规定办理。感谢所有提供资讯的网站,欢迎各类媒体与乐购科技进行文章共享合作。

    网友点评
    自媒体专栏

    评论

    热度

    精彩导读
    栏目ID=71的表不存在(操作类型=0)