MCPcopy Index your code
hub / github.com/PyGCL/PyGCL / get_split

Function get_split

GCL/eval/eval.py:9–18  ·  view source on GitHub ↗
(num_samples: int, train_ratio: float = 0.1, test_ratio: float = 0.8)

Source from the content-addressed store, hash-verified

7
8
9def get_split(num_samples: int, train_ratio: float = 0.1, test_ratio: float = 0.8):
10 assert train_ratio + test_ratio < 1
11 train_size = int(num_samples * train_ratio)
12 test_size = int(num_samples * test_ratio)
13 indices = torch.randperm(num_samples)
14 return {
15 'train': indices[:train_size],
16 'valid': indices[train_size: test_size + train_size],
17 'test': indices[test_size + train_size:]
18 }
19
20
21def from_predefined_split(data):

Callers 10

testFunction · 0.90
testFunction · 0.90
testFunction · 0.90
testFunction · 0.90
testFunction · 0.90
testFunction · 0.90
testFunction · 0.90
testFunction · 0.90
testFunction · 0.90
testFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected