MCPcopy Create free account
hub / github.com/TrustAIResearch/MLHospital / split_dataset

Function split_dataset

mlh/data_preprocessing/dataset_preprocessing.py:92–101  ·  view source on GitHub ↗
(dataset, parts=3, part_size=None)

Source from the content-addressed store, hash-verified

90
91
92def split_dataset(dataset, parts=3, part_size=None):
93 length = len(dataset)
94 each_length = length//parts
95 # if we specify a number, we use the number to split data
96 if part_size != None and part_size < each_length:
97 each_length = part_size
98 torch.manual_seed(0)
99 train_, inference_, test_, _ = torch.utils.data.random_split(dataset,
100 [each_length, each_length, each_length, len(dataset)-(each_length*parts)])
101 return train_, inference_, test_
102
103
104def prepare_inference_dataset(dataset):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected