display_step = args.display_step batch_size = args.batch_size train_data, test_data, n_user, n_item = load_data_neg(test_size=0.2, sep="\t") config = tf.ConfigProto() config.gpu_options.allow_growth = True with tf.Session(config=config) as sess: model = None # Model selection if args.model == "CDAE": train_data, test_data, n_user, n_item = load_data_all( test_size=0.2, sep="\t") model = ICDAE(sess, n_user, n_item) if args.model == "CML": model = CML(sess, n_user, n_item) if args.model == "LRML": model = LRML(sess, n_user, n_item) if args.model == "BPRMF": model = BPRMF(sess, n_user, n_item) if args.model == "NeuMF": model = NeuMF(sess, n_user, n_item) if args.model == "GMF": model = GMF(sess, n_user, n_item) if args.model == "MLP": model = MLP(sess, n_user, n_item) if args.model == "JRL": model = JRL(sess, n_user, n_item) # build and execute the model
for u in range(num_users): neg_items[u] = list(all_items - set(train_data.getrow(u).nonzero()[1])) train_list.append(list(train_data.getrow(u).toarray()[0])) train_data = train_list # train model model = None kwargs = {'epoch': args.num_epochs, 'T': args.display_step, 'learning_rate': args.learning_rate, 'reg_rate': args.reg_rate, 'male_weight': args.male_weight, 'log_file': log_file} if args.model == 'BPRMF': model = BPRMF(sess, num_users, num_items, **kwargs) if args.model == 'CDAE': model = ICDAE(sess, num_users, num_items, **kwargs) if args.model == 'CML': model = CML(sess, num_users, num_items, **kwargs) if args.model == 'GMF': model = GMF(sess, num_users, num_items, **kwargs) if args.model == 'JRL': model = JRL(sess, num_users, num_items, **kwargs) if args.model == 'LRML': model = LRML(sess, num_users, num_items, **kwargs) if args.model == 'MLP': model = MLP(sess, num_users, num_items, **kwargs) if args.model == 'NeuMF': model = NeuMF(sess, num_users, num_items, **kwargs) if model is None: exit() model.build_network(num_factor=args.num_factors)
display_step = args.display_step batch_size = args.batch_size # train_data, test_data, n_user, n_item = load_data_neg(test_size=0.2, sep="\t") # train_data, test_data, n_user, n_item = load_data_myneg(test_size=0.2, sep=";;") train_data, test_data, n_user, n_item, test_data_hot, test_data_long, hot_item, long_item = load_data_myneg_tail( test_size=0.2, sep=";;") config = tf.ConfigProto() config.gpu_options.allow_growth = True with tf.Session(config=config) as sess: model = None # Model selection if args.model == "CDAE": train_data, test_data, n_user, n_item = load_data_all( test_size=0.2, sep="\t") model = ICDAE(sess, n_user, n_item) if args.model == "CML": model = CML(sess, n_user, n_item) if args.model == "LRML": model = LRML(sess, n_user, n_item) if args.model == "BPRMF": model = BPRMF(sess, n_user, n_item) if args.model == "NeuMF": model = NeuMF(sess, n_user, n_item) if args.model == "GMF": model = GMF(sess, n_user, n_item) if args.model == "MLP": model = MLP(sess, n_user, n_item) if args.model == "JRL": model = JRL(sess, n_user, n_item) if args.model == "NeuMF_my":