Spaces:
Running
Running
Upload ai/data_generation/verify_data.py with huggingface_hub
Browse files
ai/data_generation/verify_data.py
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import argparse
|
| 2 |
+
import os
|
| 3 |
+
|
| 4 |
+
import numpy as np
|
| 5 |
+
|
| 6 |
+
|
| 7 |
+
def verify(file_path):
|
| 8 |
+
if not os.path.exists(file_path):
|
| 9 |
+
print(f"File not found: {file_path}")
|
| 10 |
+
return
|
| 11 |
+
data = np.load(file_path)
|
| 12 |
+
print(f"File: {file_path}")
|
| 13 |
+
print(f"Keys: {list(data.keys())}")
|
| 14 |
+
print(f"States shape: {data['states'].shape}")
|
| 15 |
+
print(f"Policies shape: {data['policies'].shape}")
|
| 16 |
+
print(f"Winners shape: {data['winners'].shape}")
|
| 17 |
+
|
| 18 |
+
unique_winners = np.unique(data["winners"])
|
| 19 |
+
print(f"Unique winners: {unique_winners}")
|
| 20 |
+
if len(data["winners"]) > 0:
|
| 21 |
+
print(f"Winner mean: {np.mean(data['winners'])}")
|
| 22 |
+
print(f"Draw percentage: {np.mean(data['winners'] == 0) * 100:.1f}%")
|
| 23 |
+
|
| 24 |
+
# Check sum of policy
|
| 25 |
+
print(f"Sum of policy 0: {np.sum(data['policies'][0])}")
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
if __name__ == "__main__":
|
| 29 |
+
parser = argparse.ArgumentParser()
|
| 30 |
+
parser.add_argument("--file", type=str, default="ai/data/data_poc_800.npz")
|
| 31 |
+
args = parser.parse_args()
|
| 32 |
+
verify(args.file)
|