五月天青色头像情侣网名,国产亚洲av片在线观看18女人,黑人巨茎大战俄罗斯美女,扒下她的小内裤打屁股

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

【莫煩Python】強化學習 Reinforcement Learning

2023-02-05 20:25 作者:嘻嘻000001  | 我要投稿

幾種算法

不斷嘗試達到目標

import numpy as np

import pandas as pd

class qlearning_table:

def__init__(self,actions,learning_rate=0.01,reward_decay=0.9,e_greedy=0.9)

self.actions=actions

self.lr=learning_rate

self.gamma=reward_decay

self.epsilon=e_greedy

self.q_table=pd.DataFrame(columns=self.actions)


def choose_action(self,observation):

self.check_state_exist(observation)


#choose action selection

np.random.uniform()<self.epsilon:

#choose best action

state_action=self.q_table.ix[observation,:]

state_action=state_action.reindex(np.random.permutation(state_action.index))

action=state_action.argmax()

else:

action=np.random.choice(self.action)

return action

def learn(self,s,a,r,s_):

self.check_state_exist(s_)

q_predict=self.q_table.ix[s,a]

if s_ !='terminal':

q_target=r+self.gamma*self.q_table

else:

q_target=r#next state is terminal

self.q_table.ix[s,a]+=self.lr*(q_target-q_predict)#update

def check_state_exist(self,state):

if state not in self.q_table.append(

pd.Series(

[0]*len(self.action),

index=self.q_table.columns,

name=state,))























def check_state_exist(self,state):



【莫煩Python】強化學習 Reinforcement Learning的評論 (共 條)

分享到微博請遵守國家法律
咸宁市| 酉阳| 白银市| 韶山市| 五常市| 南充市| 穆棱市| 尼玛县| 饶河县| 宁津县| 双牌县| 昂仁县| 建阳市| 邵阳县| 望谟县| 新余市| 宿迁市| 应用必备| 华容县| 新乐市| 扶风县| 永修县| 南丹县| 南昌县| 兰西县| 墨江| 寿光市| 肇州县| 林甸县| 苏尼特左旗| 迁西县| 宁陵县| 马边| 二连浩特市| 大方县| 雷山县| 江达县| 深圳市| 伊金霍洛旗| 上饶市| 海城市|