MCPcopy Create free account
hub / github.com/BIT-MJY/SeqOT / normalize_data

Function normalize_data

tools/utils/normalize_data.py:9–36  ·  view source on GitHub ↗

Normalize the training data according to the overlap value. Args: ground_truth_mapping: the raw ground truth mapping array Returns: dist_norm_data: normalized ground truth mapping array

(ground_truth_mapping)

Source from the content-addressed store, hash-verified

7
8
9def normalize_data(ground_truth_mapping):
10 """Normalize the training data according to the overlap value.
11 Args:
12 ground_truth_mapping: the raw ground truth mapping array
13 Returns:
14 dist_norm_data: normalized ground truth mapping array
15 """
16 gt_map = ground_truth_mapping
17 bin_0_9 = gt_map[np.where(gt_map[:, 2] < 0.1)]
18 bin_10_19 = gt_map[(gt_map[:, 2] < 0.2) & (gt_map[:, 2] >= 0.1)]
19 bin_20_29 = gt_map[(gt_map[:, 2] < 0.3) & (gt_map[:, 2] >= 0.2)]
20 bin_30_39 = gt_map[(gt_map[:, 2] < 0.4) & (gt_map[:, 2] >= 0.3)]
21 bin_40_49 = gt_map[(gt_map[:, 2] < 0.5) & (gt_map[:, 2] >= 0.4)]
22 bin_50_59 = gt_map[(gt_map[:, 2] < 0.6) & (gt_map[:, 2] >= 0.5)]
23 bin_60_69 = gt_map[(gt_map[:, 2] < 0.7) & (gt_map[:, 2] >= 0.6)]
24 bin_70_79 = gt_map[(gt_map[:, 2] < 0.8) & (gt_map[:, 2] >= 0.7)]
25 bin_80_89 = gt_map[(gt_map[:, 2] < 0.9) & (gt_map[:, 2] >= 0.8)]
26 bin_90_100 = gt_map[(gt_map[:, 2] <= 1) & (gt_map[:, 2] >= 0.9)]
27
28
29
30 dist_norm_data = np.concatenate((bin_0_9, bin_10_19, bin_20_29, bin_30_39, bin_40_49,
31 bin_50_59, bin_60_69, bin_70_79, bin_80_89, bin_90_100))
32
33 # print("Distribution normalized data: ", dist_norm_data)
34 print("size of normalized data: ", len(dist_norm_data))
35
36 return dist_norm_data
37
38
39if __name__ == '__main__':

Callers 1

normalize_data.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected