- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFeatureBuild.py
More file actions
Latest commit
113 lines (67 loc) · 3.04 KB
/
Copy pathFeatureBuild.py
File metadata and controls
113 lines (67 loc) · 3.04 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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
importos
importmath
importpandasaspd
importnumpyasnp
importcopy
fromUbility.ReadAndSaveimportLoadH5, LoadCSV
ENGINEERING_LIST= ['Cell Index','Cell X','Cell Y','Height','Azimuth','Electrical Downtilt',
'Mechanical Downtilt','Frequency Band','RS Power']
MAP_LIST= ['Cell Altitude','Cell Building Height','Cell Clutter Index','X','Y','Altitude','Building Height','Clutter Index']
LABEL= ['RSRP']
min_Cell_X=384180.0
max_Cell_X=434540.0
min_Cell_Y=3376325.0
max_Cell_Y=3417960.0
min_X=382930
max_X=434580
min_Y=3375740
max_Y=3418880
h5_columns_list=ENGINEERING_LIST+MAP_LIST+LABEL
defIterationSigleCase(case_folder):
MAP_INDEX_LIST= ['Cell X', 'Cell Y', 'X', 'Y']
map_dict= {}
formap_indexinMAP_INDEX_LIST:
map_dict['min'+map_index] = []
map_dict['max'+map_index] = []
csv_num=0
forcsv_indexinos.listdir(case_folder):
csv_num+=1
print(csv_num)
csv_path=os.path.join(case_folder, csv_index)
pd=LoadCSV(csv_path)
formap_indexinMAP_INDEX_LIST:
map_dict['min'+map_index].append(min(pd[map_index]))
map_dict['max'+map_index].append(max(pd[map_index]))
formap_indexinMAP_INDEX_LIST:
print('min '+map_index+': ', min(map_dict['min'+map_index]))
print('max '+map_index+': ', max(map_dict['max'+map_index]))
defFeatureEngineering(feature_pd):
h5_columns_list=feature_pd.columns.tolist()
build_feature_list= ['Relative Distance', 'Relative Altitude']
build_feature_dict= {}
forindexinbuild_feature_list:
build_feature_dict[index] = []
forindexinfeature_pd.index.tolist():
###Distance
distance_l_feature=math.sqrt(math.pow(feature_pd.iloc[index, h5_columns_list.index('X')] -
feature_pd.iloc[index, h5_columns_list.index('Cell X')], 2) + \
math.pow(feature_pd.iloc[index, h5_columns_list.index('Y')] -
feature_pd.iloc[index, h5_columns_list.index('Cell Y')], 2))
build_feature_dict['Relative Distance'].append(math.sqrt(distance_l_feature))
####Hight
hight_feature=feature_pd.iloc[index, h5_columns_list.index('Height')] + \
feature_pd.iloc[index, h5_columns_list.index('Cell Altitude')] \
-feature_pd.iloc[index, h5_columns_list.index('Altitude')]
build_feature_dict['Relative Altitude'].append(hight_feature)
returnbuild_feature_dict
defPdGeneartion(h5_path):
h5_array=LoadH5(h5_path)
feature_pd=pd.DataFrame(data=h5_array, index=None, columns=h5_columns_list)
print(FeatureEngineering(feature_pd))
# plt.hist(target_list)
# plt.show()
defmain():
h5_path=r'E:\建模2019'
PdGeneartion(h5_path)
if__name__=='__main__':
main()