|
--- |
|
license: mit |
|
task_categories: |
|
- token-classification |
|
- text-classification |
|
- text-generation |
|
language: |
|
- en |
|
pretty_name: ChessSet-Community |
|
size_categories: |
|
- 1K<n<10K |
|
tags: |
|
- ChessAI-Community |
|
--- |
|
# Chess Positions with Stockfish Evaluations |
|
|
|
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. |
|
|
|
## Data Format |
|
|
|
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. |
|
|
|
The format is as follows: |
|
`"FEN_string",evaluation` |
|
|
|
### Fields |
|
|
|
| Field | Description | |
|
|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
|
| `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). | |
|
| `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). | |
|
|
|
### Example Data |
|
|
|
```csv |
|
"rnbqkbnr/pppppppp/8/8/8/8/PPPPPPPP/RNBQKBNR w KQkq - 0 1",+25 |
|
"r1bqkbnr/pp1ppppp/2n5/2p5/4P3/5N2/PPPP1PPP/RNBQKB1R w KQkq - 2 3",+15 |
|
"r4rk1/pp1n1ppp/2pbp3/q2n2B1/3PN3/3Q1N2/PPP2PPP/1K1R3R b - - 5 13",-80 |
|
"4r1k1/pp1r1p1p/1qp1n1p1/4P3/3p1P2/2Q4P/PP1R2P1/3R2K1 w - - 0 29",#4 |
|
``` |
|
|
|
## How to Use |
|
|
|
Here is a basic Python script to read and parse the data from a file named `chess_data.csv`. |
|
|
|
```python |
|
import csv |
|
|
|
def load_chess_data(file_path='chess_data.csv'): |
|
""" |
|
Loads and prints chess positions and their evaluations from the dataset. |
|
""" |
|
positions = [] |
|
try: |
|
with open(file_path, 'r', encoding='utf-8') as f: |
|
reader = csv.reader(f) |
|
for row in reader: |
|
if not row: |
|
continue |
|
fen_string = row[0] |
|
evaluation = row[1] |
|
positions.append({'fen': fen_string, 'eval': evaluation}) |
|
print(f"FEN: {fen_string}, Evaluation: {evaluation}") |
|
except FileNotFoundError: |
|
print(f"Error: The file {file_path} was not found.") |
|
except IndexError: |
|
print(f"Error: Malformed row found in {file_path}.") |
|
|
|
return positions |
|
|
|
if __name__ == '__main__': |
|
# Assuming your data is in 'chess_data.csv' |
|
chess_dataset = load_chess_data() |
|
if chess_dataset: |
|
print(f" |
|
Successfully loaded {len(chess_dataset)} positions.") |
|
|
|
``` |
|
|
|
## Data Generation (Example) |
|
|
|
This dataset was generated using: |
|
* **Engine**: Stockfish 16 |
|
* **Search**: 15 seconds per position |
|
* **Source**: A curated list of positions from grandmaster games. |
|
|
|
## License |
|
|
|
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. |