1 Star 2 Fork 0

李波/LearnPython

Create your Gitee Account
Explore and code with more than 14 million developers,Free private repositories !:)
Sign up
文件
This repository doesn't specify license. Please pay attention to the specific project description and its upstream code dependency when using it.
Clone or Download
test.py 496 Bytes
Copy Edit Raw Blame History
李波 authored 2020-08-24 14:25 +08:00 . partialfullstack
import numpy as np
import pandas as pd
N_STATES = 6
ACTIONS = ['left', 'right']
state = 2
def build_q_table(n_states, actions):
table = pd.DataFrame(
np.zeros((n_states, len(actions))), # q_table initial values
columns=actions, # actions's name
)
# print(table) # show table
return table
q_table = build_q_table(N_STATES, ACTIONS)
state_actions = q_table.iloc(state)
max = q_table.idxmax()
print(q_table)
print()
print(state_actions)
print()
print(max)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/libo-sober/learn-python.git
git@gitee.com:libo-sober/learn-python.git
libo-sober
learn-python
LearnPython
master

Search