get_origin_data_ins = Get_amazon_data_movie_tv(FLAGS=FLAGS) get_origin_data_ins.getDataStatistics() elif FLAGS.type == "music": get_origin_data_ins = Get_amazon_data_music(FLAGS=FLAGS) get_origin_data_ins.getDataStatistics() elif FLAGS.type == "elec": get_origin_data_ins = Get_amazon_data_elec(FLAGS=FLAGS) get_origin_data_ins.getDataStatistics() elif FLAGS.type == 'taobaoapp': get_origin_data_ins = Get_taobaoapp_data(FLAGS=FLAGS) get_origin_data_ins.getDataStatistics() # get_train_test_ins = Get_train_test(FLAGS=self.FLAGS,origin_data=get_origin_data_ins.origin_data) prepare_data_behavior_ins = prepare_data_base( FLAGS, get_origin_data_ins.origin_data) prepare_data_behavior_ins.map_process() train_set, test_set = prepare_data_behavior_ins.get_train_test() # fetch part of test_data # if len(self.test_set) > 10000: # self.test_set = random.sample(self.test_set,10000) # self.test_set = self.test_set.sample(3500) logger.info('DataHandle Process.\tCost time: %.2fs' % (time.time() - start_time)) start_time = time.time() top_pop_ins = top_pop_model(train_set, prepare_data_behavior_ins) top_pop_ins.cal_p_pop(1) top_pop_ins.cal_p_pop(5)
def __init__(self): start_time = time.time() model_parameter_ins = model_parameter() experiment_name = model_parameter_ins.flags.FLAGS.experiment_name self.FLAGS = model_parameter_ins.get_parameter(experiment_name).FLAGS log_ins = create_log(type=self.FLAGS.type, experiment_type=self.FLAGS.experiment_type, version=self.FLAGS.version) self.logger = log_ins.logger self.logger.info("hello world the experiment begin") # logger.info("The model parameter is :" + str(self.FLAGS._parse_flags())) if self.FLAGS.type == "yoochoose": get_origin_data_ins = Get_yoochoose_data(FLAGS=self.FLAGS) get_origin_data_ins.getDataStatistics() elif self.FLAGS.type == "movielen": get_origin_data_ins = Get_movie_data(FLAGS=self.FLAGS) get_origin_data_ins.getDataStatistics() if self.FLAGS.type == "tmall": get_origin_data_ins = Get_tmall_data(FLAGS=self.FLAGS) elif self.FLAGS.type == "movie_tv": get_origin_data_ins = Get_amazon_data_movie_tv(FLAGS=self.FLAGS) get_origin_data_ins.getDataStatistics() elif self.FLAGS.type == "elec": get_origin_data_ins = Get_amazon_data_elec(FLAGS=self.FLAGS) get_origin_data_ins.getDataStatistics() elif self.FLAGS.type == "music": get_origin_data_ins = Get_amazon_data_music(FLAGS=self.FLAGS) get_origin_data_ins.getDataStatistics() elif self.FLAGS.type == 'taobaoapp': get_origin_data_ins = Get_taobaoapp_data(FLAGS=self.FLAGS) get_origin_data_ins.getDataStatistics() elif self.FLAGS.type == "beauty": get_origin_data_ins = Get_amazon_data_beauty(FLAGS=self.FLAGS) get_origin_data_ins.getDataStatistics() elif self.FLAGS.type == "brightkite": get_origin_data_ins = Get_BrightKite_data(FLAGS=self.FLAGS) get_origin_data_ins.getDataStatistics() elif self.FLAGS.type == "order": get_origin_data_ins = Get_Order_data(FLAGS=self.FLAGS) get_origin_data_ins.getDataStatistics() #get_train_test_ins = Get_train_test(FLAGS=self.FLAGS,origin_data=get_origin_data_ins.origin_data) prepare_data_behavior_ins = prepare_data_base( self.FLAGS, get_origin_data_ins.origin_data) self.train_set, self.test_set = prepare_data_behavior_ins.get_train_test( ) #fetch part of test_data #if len(self.train_set) > 2000000: #self.test_set = random.sample(self.train_set,2000000) #self.test_set = self.test_set.sample(3500) self.logger.info('DataHandle Process.\tCost time: %.2fs' % (time.time() - start_time)) start_time = time.time() self.emb = Behavior_embedding_time_aware_attention( is_training=self.FLAGS.is_training, user_count=prepare_data_behavior_ins.user_count, item_count=prepare_data_behavior_ins.item_count, category_count=prepare_data_behavior_ins.category_count, max_length_seq=self.FLAGS.length_of_user_history) self.logger.info('Get Train Test Data Process.\tCost time: %.2fs' % (time.time() - start_time)) self.item_category_dic = prepare_data_behavior_ins.item_category_dic self.global_step = 0 self.one_epoch_step = 0 self.now_epoch = 0