def make_records(self): # record all the results' details into files print("in make record. we will calculate metrics after here.") _, Decoder = self.sess.run( [self.cost, self.Decoder], feed_dict={ self.input_R_U: self.train_R, self.input_R_I: self.train_R, self.input_OH_I: self.I_OH_mat, self.input_P_cor: [[0, 0]], self.input_N_cor: [[0, 0]], self.row_idx: np.reshape(xrange(self.num_rows), (self.num_rows, 1)), self.col_idx: np.reshape(xrange(self.num_cols), (self.num_cols, 1)) }) if self.base == 'i': [precision, recall, f_score, NDCG] = utility.test_model_all(Decoder.T, self.vali_R.T, self.train_R.T, self.price_R.T, 'save_intermediate_results') else: [precision, recall, f_score, NDCG] = utility.test_model_all(Decoder, self.vali_R, self.train_R, self.price_R, 'save_intermediate_results') utility.metric_record(precision, recall, f_score, NDCG, self.args, self.metric_path) utility.test_model_factor(Decoder, self.vali_R, self.train_R) return precision, recall, f_score, NDCG
def make_records(self): # record all the results' details into files _, Decoder, l1, l2 = self.sess.run( [self.cost, self.Decoder, self.pre_cost3, self.pre_cost4], feed_dict={ self.input_R_U: self.train_R, self.input_R_I: self.train_R, self.input_OH_U: self.U_OH_mat, self.input_OH_I: self.I_OH_mat, self.input_P_cor: [[0, 0]], self.input_N_cor: [[0, 0]], self.row_idx: np.reshape(range(self.num_rows), (self.num_rows, 1)), self.col_idx: np.reshape(range(self.num_cols), (self.num_cols, 1)) }) if self.base == 'i': [precision, recall, f_score, NDCG, r_f_table] = utility.test_model_all(Decoder.T, self.vali_R.T, self.train_R.T) else: [precision, recall, f_score, NDCG, r_f_table] = utility.test_model_all(Decoder, self.vali_R, self.train_R) utility.metric_record(precision, recall, f_score, NDCG, self.args, self.metric_path) utility.test_model_factor(Decoder, self.vali_R, self.train_R) print("******** max_epoch ********") print(self.max_epoch) return precision, recall, f_score, NDCG
def make_records(self): # record all the results' details into files _, Decoder = self.sess.run( [self.cost, self.Decoder], feed_dict={ self.input_R_U: self.train_R, self.input_R_U_index: self.U_OH_mat, self.is_training_ph: 0, self.anneal_ph: 0.2, self.row_idx: np.reshape(range(self.num_rows), (self.num_rows, 1)) }) if self.base == 'i': [precision, recall, f_score, NDCG, r_f_table] = utility.test_model_all(Decoder.T, self.vali_R.T, self.train_R.T) else: [precision, recall, f_score, NDCG, r_f_table] = utility.test_model_all(Decoder, self.vali_R, self.train_R) utility.metric_record(precision, recall, f_score, NDCG, self.args, self.metric_path) utility.test_model_factor(Decoder, self.vali_R, self.train_R) print("******** max_epoch ********") print(self.max_epoch) return precision, recall, f_score, NDCG