File size: 2,907 Bytes
c15d41d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# Go Games Dataset for PyTorch Neural Network Training

## Overview

This dataset contains Go game positions extracted from high-quality SGF files for training neural networks. The positions are organized into three strength categories based on game quality.

## Dataset Statistics

- **Total SGF Files Processed**: 61149
- **Valid SGF Files**: 0
- **Total Positions**: 29884
- **Processing Time**: 14.90 seconds

## Strength Categories

The dataset is divided into three strength categories:

- **Standard** (Quality 80-85): 2704 games, 9934 positions
- **Strong** (Quality 86-92): 3397 games, 9958 positions
- **Elite** (Quality 93-100): 55048 games, 9992 positions

## Directory Structure

```

dataset/

├── train/

│   ├── boards.pt      # Board state tensors (N, C, H, W)

│   ├── moves.pt       # Move labels (N,)

│   ├── colors.pt      # Player colors (N,)

│   └── metadata.json  # Additional information

├── val/

│   ├── boards.pt

│   ├── moves.pt

│   ├── colors.pt

│   └── metadata.json

├── test/

│   ├── boards.pt

│   ├── moves.pt

│   ├── colors.pt

│   └── metadata.json

├── stats.json         # Processing statistics

└── README.md          # This file

```

## Board Representation

The board state is represented as a tensor with 3 channels:
1. Black stones (1 where black stone is present, 0 elsewhere)
2. White stones (1 where white stone is present, 0 elsewhere)
3. Next player (all 1s if black to play, all 0s if white to play)

## Usage with PyTorch

```python

import torch

import json

import os

from torch.utils.data import Dataset, DataLoader



class GoDataset(Dataset):

    def __init__(self, data_dir):

        self.boards = torch.load(os.path.join(data_dir, "boards.pt"))

        self.moves = torch.load(os.path.join(data_dir, "moves.pt"))

        self.colors = torch.load(os.path.join(data_dir, "colors.pt"))

        

        with open(os.path.join(data_dir, "metadata.json"), 'r', encoding='utf-8') as f:

            self.metadata = json.load(f)

    

    def __len__(self):

        return len(self.moves)

    

    def __getitem__(self, idx):

        return {

            'board': self.boards[idx],

            'move': self.moves[idx],

            'color': self.colors[idx]

        }



# Create datasets

train_dataset = GoDataset('dataset/train')

val_dataset = GoDataset('dataset/val')

test_dataset = GoDataset('dataset/test')



# Create data loaders

train_loader = DataLoader(train_dataset, batch_size=64, shuffle=True)

val_loader = DataLoader(val_dataset, batch_size=64)

test_loader = DataLoader(test_dataset, batch_size=64)

```

## License

The dataset is intended for research and educational purposes only.

## Creation Date

This dataset was created on 2025.3.13