-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcheck_splits.py
More file actions
30 lines (26 loc) · 1.06 KB
/
Copy pathcheck_splits.py
File metadata and controls
30 lines (26 loc) · 1.06 KB
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
import pandas as pd
import os
def main():
split_dir = 'splits'
for i in range(5):
fold_dir = os.path.join(split_dir, str(i))
train_file = os.path.join(fold_dir, 'train.csv')
test_file = os.path.join(fold_dir, 'test.csv')
if os.path.exists(train_file):
df_train = pd.read_csv(train_file)
if 'label' in df_train.columns:
print(f"Fold {i} Train class distribution:\n{df_train['label'].value_counts()}")
else:
print(f"Fold {i} Train: 'label' column not found in {train_file}")
else:
print(f"Fold {i} Train: {train_file} not found")
if os.path.exists(test_file):
df_test = pd.read_csv(test_file)
if 'label' in df_test.columns:
print(f"Fold {i} Test class distribution:\n{df_test['label'].value_counts()}")
else:
print(f"Fold {i} Test: 'label' column not found in {test_file}")
else:
print(f"Fold {i} Test: {test_file} not found")
if __name__ == '__main__':
main()