args.dataset, args.dataset_info_path, ) fold_id = (args.fold_id-1)%data.num_folds() data = data.get_data_folds()[fold_id] start = time.time() data.read_data() print('Time past for reading data: %d seconds' % (time.time() - start)) max_ranking_size = np.min((cutoff, data.max_query_size())) model_params = {'hidden units': [32, 32], 'learning_rate': 0.01,} model = nn.init_model(model_params) optimizer = tf.keras.optimizers.SGD(learning_rate=model_params['learning_rate']) results = [] metric_weights = 1./np.log2(np.arange(max_ranking_size) + 2) train_labels = 2**data.train.label_vector-1 vali_labels = 2**data.validation.label_vector-1 test_labels = 2**data.test.label_vector-1 train_ndoc_feat = np.zeros(data.train.num_docs()) vali_ndoc_feat = np.zeros(data.validation.num_docs()) test_ndoc_feat = np.zeros(data.test.num_docs()) for qid in range(data.train.num_queries()): q_feat = data.train.query_values_from_vector(qid, train_ndoc_feat) q_feat[:] = q_feat.shape[0]
print('Time past for reading data: %d seconds' % (time.time() - start)) max_ranking_size = np.min((cutoff, data.max_query_size())) click_model = clk.get_click_model(click_model_name) alpha, beta = click_model(np.arange(max_ranking_size)) true_train_doc_weights = data.train.label_vector * 0.25 true_vali_doc_weights = data.validation.label_vector * 0.25 true_test_doc_weights = data.test.label_vector * 0.25 model_params = { 'hidden units': [32, 32], } model = nn.init_model(model_params) logging_model = nn.init_model(model_params) # optimizer = tf.keras.optimizers.Adam() optimizer = tf.keras.optimizers.SGD(learning_rate=0.01) model.build(input_shape=data.train.feature_matrix.shape) logging_model.build(input_shape=data.train.feature_matrix.shape) if args.pretrained_model: model.load_weights(args.pretrained_model) logging_model.load_weights(args.pretrained_model) init_weights = model.get_weights() init_opt_weights = optimizer.get_weights() n_sampled = 0 train_clicks = np.zeros((data.train.num_docs(), max_ranking_size), dtype=np.int64)