Upload 2 files
Browse files- README.md +75 -3
- dataset.jsonl +0 -0
README.md
CHANGED
@@ -1,3 +1,75 @@
|
|
1 |
-
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Chess Positions with Stockfish Evaluations
|
2 |
+
|
3 |
+
This dataset contains a collection of chess positions in Forsyth-Edwards Notation (FEN), each paired with a corresponding evaluation from the Stockfish chess engine. It is designed for use in training machine learning models for chess, analyzing chess positions, or for any application requiring a large set of evaluated positions.
|
4 |
+
|
5 |
+
## Data Format
|
6 |
+
|
7 |
+
The data is stored in a simple CSV (Comma-Separated Values) format without a header row. Each line in the file represents a single chess position and its evaluation.
|
8 |
+
|
9 |
+
The format is as follows:
|
10 |
+
`"FEN_string",evaluation`
|
11 |
+
|
12 |
+
### Fields
|
13 |
+
|
14 |
+
| Field | Description |
|
15 |
+
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
16 |
+
| `FEN_string`| A standard FEN string representing a specific board state. This includes piece placement, active color, castling availability, en passant target square, halfmove clock, and fullmove number. [Learn more about FEN](https://en.wikipedia.org/wiki/Forsyth%E2%80%93Edwards_Notation). |
|
17 |
+
| `evaluation`| The Stockfish engine's evaluation of the position in centipawns. <br> - A positive value (`+110`) indicates an advantage for White. <br> - A negative value (`-95`) indicates an advantage for Black. <br> - A value near zero suggests a balanced position. <br> - Mate-in-N is represented as `#N` (e.g., `#3` for mate in 3 for the side to move) or `#-N` (e.g., `#-2` if the side to move is being mated in 2). |
|
18 |
+
|
19 |
+
### Example Data
|
20 |
+
|
21 |
+
```csv
|
22 |
+
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",+25
|
23 |
+
"r1bqkbnr/pp1ppppp/2n5/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3",+15
|
24 |
+
"r4rk1/pp1n1ppp/2pbp3/q2n2B1/3PN3/3Q1N2/PPP2PPP/1K1R3R b - - 5 13",-80
|
25 |
+
"4r1k1/pp1r1p1p/1qp1n1p1/4P3/3p1P2/2Q4P/PP1R2P1/3R2K1 w - - 0 29",#4
|
26 |
+
```
|
27 |
+
|
28 |
+
## How to Use
|
29 |
+
|
30 |
+
Here is a basic Python script to read and parse the data from a file named `chess_data.csv`.
|
31 |
+
|
32 |
+
```python
|
33 |
+
import csv
|
34 |
+
|
35 |
+
def load_chess_data(file_path='chess_data.csv'):
|
36 |
+
"""
|
37 |
+
Loads and prints chess positions and their evaluations from the dataset.
|
38 |
+
"""
|
39 |
+
positions = []
|
40 |
+
try:
|
41 |
+
with open(file_path, 'r', encoding='utf-8') as f:
|
42 |
+
reader = csv.reader(f)
|
43 |
+
for row in reader:
|
44 |
+
if not row:
|
45 |
+
continue
|
46 |
+
fen_string = row[0]
|
47 |
+
evaluation = row[1]
|
48 |
+
positions.append({'fen': fen_string, 'eval': evaluation})
|
49 |
+
print(f"FEN: {fen_string}, Evaluation: {evaluation}")
|
50 |
+
except FileNotFoundError:
|
51 |
+
print(f"Error: The file {file_path} was not found.")
|
52 |
+
except IndexError:
|
53 |
+
print(f"Error: Malformed row found in {file_path}.")
|
54 |
+
|
55 |
+
return positions
|
56 |
+
|
57 |
+
if __name__ == '__main__':
|
58 |
+
# Assuming your data is in 'chess_data.csv'
|
59 |
+
chess_dataset = load_chess_data()
|
60 |
+
if chess_dataset:
|
61 |
+
print(f"
|
62 |
+
Successfully loaded {len(chess_dataset)} positions.")
|
63 |
+
|
64 |
+
```
|
65 |
+
|
66 |
+
## Data Generation (Example)
|
67 |
+
|
68 |
+
This dataset was generated using:
|
69 |
+
* **Engine**: Stockfish 16
|
70 |
+
* **Search**: 15 seconds per position
|
71 |
+
* **Source**: A curated list of positions from grandmaster games.
|
72 |
+
|
73 |
+
## License
|
74 |
+
|
75 |
+
This dataset is released under the [MIT License](https://opensource.org/licenses/MIT). You are free to use, modify, and distribute it for any purpose.
|
dataset.jsonl
ADDED
The diff for this file is too large to render.
See raw diff
|
|