MCPcopy Create free account
hub / github.com/OpenBMB/BMTools / subsample_data

Function subsample_data

bmtools/tools/database/utils/data.py:4–13  ·  view source on GitHub ↗

Subsample data. Data is in the form of a tuple of lists.

(data, subsample_size)

Source from the content-addressed store, hash-verified

2
3
4def subsample_data(data, subsample_size):
5 """
6 Subsample data. Data is in the form of a tuple of lists.
7 """
8 inputs, outputs = data
9 assert len(inputs) == len(outputs)
10 indices = random.sample(range(len(inputs)), subsample_size)
11 inputs = [inputs[i] for i in indices]
12 outputs = [outputs[i] for i in indices]
13 return inputs, outputs
14
15
16def create_split(data, split_size):

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected