Example #1
0
train_support = sparse_to_tuple(train_support)
train_support_t = sparse_to_tuple(train_support_t)

u_features = sparse_to_tuple(u_features)
v_features = sparse_to_tuple(v_features)
assert u_features[2][1] == v_features[2][
    1], 'Number of features of users and items must be the same!'

num_features = u_features[2][1]
u_features_nonzero = u_features[1].shape[0]
v_features_nonzero = v_features[1].shape[0]

# Feed_dicts for validation and test set stay constant over different update steps
train_feed_dict = construct_feed_dict(
    placeholders, u_features, v_features, u_features_nonzero,
    v_features_nonzero, train_support, train_support_t, train_labels,
    train_u_indices, train_v_indices, class_values, DO, train_u_features_side,
    train_v_features_side)
# No dropout for validation and test runs
val_feed_dict = construct_feed_dict(placeholders, u_features, v_features,
                                    u_features_nonzero, v_features_nonzero,
                                    val_support, val_support_t, val_labels,
                                    val_u_indices, val_v_indices, class_values,
                                    0., val_u_features_side,
                                    val_v_features_side)

test_feed_dict = construct_feed_dict(placeholders, u_features, v_features,
                                     u_features_nonzero, v_features_nonzero,
                                     test_support, test_support_t, test_labels,
                                     test_u_indices, test_v_indices,
                                     class_values, 0., test_u_features_side,
Example #2
0
val_support_t = sparse_to_tuple(val_support_t)

u_features = sparse_to_tuple(u_features)
v_features = sparse_to_tuple(v_features)
assert u_features[2][1] == v_features[2][
    1], 'Number of features of users and items must be the same!'

num_features = u_features[2][1]
u_features_nonzero = u_features[1].shape[0]
v_features_nonzero = v_features[1].shape[0]

# Feed_dicts for validation and test set stay constant over different update steps
# No dropout for validation and test runs
val_feed_dict = construct_feed_dict(placeholders, u_features, v_features,
                                    u_features_nonzero, v_features_nonzero,
                                    val_support, val_support_t, val_labels,
                                    val_u_indices, val_v_indices, class_values,
                                    0.)

test_feed_dict = construct_feed_dict(placeholders, u_features, v_features,
                                     u_features_nonzero, v_features_nonzero,
                                     test_support, test_support_t, test_labels,
                                     test_u_indices, test_v_indices,
                                     class_values, 0.)

# Collect all variables to be logged into summary
merged_summary = tf.summary.merge_all()

sess = tf.Session()
sess.run(tf.global_variables_initializer())