|
Download README.md from KibleLab/Quoridor-Zero: direct link, hf CLI and curl.
- Browser
- Download file 3.96 kB
-
https://huggingface.co/datasets/KibleLab/Quoridor-Zero/resolve/main/README.md
- Command line
-
hf download hf://datasets/KibleLab/Quoridor-Zero/README.md
-
curl -L -o README.md https://huggingface.co/datasets/KibleLab/Quoridor-Zero/resolve/main/README.md
3.96 kB
metadata
license: unknown
데이터셋 요약 (Quoridor AI Training Dataset)
이 데이터셋은 강화 학습 기반 Quoridor AI 훈련을 위한 Self-Play 게임 기록으로 구성되어 있습니다.
각 샘플은 게임 중 하나의 상태(state), 해당 상태에서의 정책(policy), 그리고 그 상태의 가치(value)를 포함합니다.
컬럼 설명
| 컬럼 이름 | 설명 | 데이터 타입 |
|---|---|---|
state |
게임 상태를 나타내는 3차원 배열 | list[list[list[int]]] |
policies |
각 행동에 대한 확률 분포 (정책), 총합은 1 | list[float] |
value |
해당 상태의 승리 가치: 승리 1, 패배 -1, 무승부 0 |
int (1, -1, 0) |
게임 진행 및 라벨링 기준
- 승리한 에이전트의 모든
state샘플에는value = 1 - 패배한 에이전트의 모든
state샘플에는value = -1 - 무승부로 간주된 게임의 모든
state샘플에는value = 0
(무승부 기준 : 100 Turn이 넘어도 승리한 에이전트가 존재하지 않을 때)
정책(policies)
- 고정된 행동 수에 따른 확률 분포
- quoridor-mini: 44개 행동
- quoridor: 140개 행동
- 각 값은 해당 행동이 선택될 확률이며, 총합은 항상 1
예시:
[0.0, 0.0, 0.6, 0.0, 0.3, 0.0, 0.1, ...]
→ 세 번째, 다섯 번째, 일곱 번째 행동에 대해 확률 분포가 주어짐.
행동 인덱스 규칙 (일부 예시)
| 행동 방향 | 인덱스 번호 |
|---|---|
| ↑ up | 0 |
| → right | 2 |
| ↓ down | 4 |
| ← left | 6 |
| ... | 기타 벽 설치 및 특수 행동 등 |
분석 코드 예시
from pathlib import Path
import pickle
import pandas as pd
import numpy as np
history_file = Path('./20240502082822-10K.history')
# history 파일 불러오기
with open(history_file, 'rb') as f:
history_data = pickle.load(f)
# 데이터 프레임 생성
df = pd.DataFrame(history_data, columns = ['state','policies','value'])
'''
curr_player : 1
curr_wall : 3
oppo_player : 2
opppo_player : 4
'''
def convert_board(state):
# quoridor size : 17
# quoridor mini size : 9
size = 17
board = [[0 for _ in range(size)] for _ in range(size)]
curr = np.array(state[0][0])
curr = np.where(curr == 1)[0]
currRow = (curr // size)[0]
currCol = (curr % size)[0]
board[currRow][currCol] = 1
curr_Wall = np.array(state[0][1])
curr_Wall = np.where(curr_Wall == 1)[0]
for wall in curr_Wall:
currRow = wall // size
currCol = wall % size
board[currRow][currCol] = 3
oppo = np.array(state[1][0])
oppo = np.where(oppo == 1)[0]
oppoRow = (size - 1) - (oppo // size)[0]
oppoCol = (size - 1) - (oppo % size)[0]
board[oppoRow][oppoCol] = 2
oppo_Wall = np.array(state[1][1])
oppo_Wall = np.where(oppo_Wall == 1)[0]
for wall in oppo_Wall:
oppoRow = (size - 1) - wall // size
oppoCol = (size - 1) - wall % size
board[oppoRow][oppoCol] = 4
return board
# n번째 행 가져오기
nth_row = 0
# state 표시
state = df.iloc[[nth_row],[0]] # DataFrame df의 n번째 행과 0번째 열에서 값을 선택
stateNP = state.to_numpy()[0][0] # DataFrame을 NumPy 배열로 변환
board = convert_board(stateNP)
# board 표시
board_np = np.array(board)
np.set_printoptions(linewidth=200) # 줄바꿈 방지
policies = df.iloc[[nth_row],[1]].to_numpy()[0][0]
value = df.iloc[[nth_row],[2]].to_numpy()[0][0]
print('=== state ===')
print(board_np)
print('=== policies ===')
print(policies)
print('=== value ===')
print(value)