while int(''.join(curentday.split('-'))) < int(''.join(nowday.split('-'))): if int(''.join(curentday.split('-'))) >= int(''.join("2019-11-06".split('-'))): logging.info("****Day_nums-1 == index {}****".format(curentday )) break if int(''.join(curentday.split('-'))) == int(''.join("2019-10-27".split('-'))): curentday = datetime.datetime.strptime(curentday,"%Y-%m-%d") + datetime.timedelta(days=1) curentday = curentday.strftime("%Y-%m-%d") continue try: iiter =0 #从flaskapp log日志中,.1 .2 两个文件,提取出 两个 txt applog = os.path.join(PATH,logfile.format(curentday)) viewclickfile = handle_log.log(applog, curentday) #从两个TXT 提取 csv train_base = handle_train.generate_train_base(curentday,viewclickfile) #train_base = os.path.join(PATH,"train_base/train_base--2019-09-01.csv") # 结合 mysql数据中 储存的数据,出 训练数据 train_data = feature.get_data_with_pandas(train_base, batch_size) lr = 0.001 loss_sum = 0.0 accuracy_sum = 0.0 break_cnt = 1 flag = True
# file = sys.argv[1] # file = file[:len(file) - 1] # # day = sys.argv[2] print_iter = 1 serve_iter = 1 save_iter = 1 decay_iter = 1 print("*" * 40) try: import handle_log begin = time.time() handle_log.log(file, day) print(day, "handle log costs: ", time.time() - begin) import handle_train begin = time.time() train_base = handle_train.generate_train_base(day) print(day, "handle train_base costs: ", time.time() - begin) import feature begin = time.time() train_data = feature.get_data_with_pandas(train_base, 128) print(day, "handle feature costs: ", time.time() - begin) import model