File size: 380 Bytes
e786b47
33558f8
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/usr/bin/python3
import json
from sklearn.model_selection import train_test_split

with open('inverted.json', 'r') as f:
    data = json.load(f)
    
train_data, eval_data = train_test_split(data, test_size=0.2, random_state=42)

with open('train.json', 'w') as f:
    json.dump(train_data, f, indent=4)

with open('eval.json', 'w') as f:
    json.dump(eval_data, f, indent=4)