Commit 8cebc1d9 authored by 张彦钊's avatar 张彦钊

change main function for test

parent 657cd504
......@@ -7,12 +7,8 @@ from config import *
# 候选集cid只能从训练数据集cid中选择
def filter_cid(df):
data_set_cid = pd.read_csv(DIRECTORY_PATH + "data_set_cid.csv")["cid"].values.tolist()
print("过滤前样本大小:")
print(df.shape)
if not df.empty:
df = df.loc[df["cid"].isin(data_set_cid)]
print("过滤后样本大小:")
print(df.shape)
return df
......
......@@ -94,17 +94,17 @@ def router(device_id):
if __name__ == "__main__":
# TODO 如果耗时小于一分钟,下一次取到的device_id和上一次相同
while True:
start = time.time()
empty,device_id_list = get_active_users()
if empty:
time.sleep(10)
else:
for device_id in device_id_list:
router(device_id)
end = time.time()
time_cost = (end - start)
print("预测耗时{}秒".format(time_cost))
router("00BBE073-ACE3-4588-9ED8-B35F13D282EB")
# while True:
# start = time.time()
# empty,device_id_list = get_active_users()
# if empty:
# time.sleep(10)
# else:
# for device_id in device_id_list:
# router(device_id)
#
# end = time.time()
# time_cost = (end - start)
# print("耗时{}秒".format(time_cost))
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment