Skip to content

Commit

Permalink
Fixing formatting from trying to do this using the github editor
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpryce committed Nov 5, 2021
1 parent 899616f commit c6dce71
Showing 1 changed file with 46 additions and 46 deletions.
92 changes: 46 additions & 46 deletions tests/embed/test_n2v.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,68 +14,68 @@
class Node2VecEmbedTest(unittest.TestCase):
# these are not deterministic tests and can't be trusted to work consistently.
# See Issue #880
# def test_n2v_returns_same_labels_with_different_nodeid_types(self):
# probability_matrix = np.array([[0.95, 0.01], [0.01, 0.95]])
# number_of_nodes_per_community = [20, 20]
# def test_n2v_returns_same_labels_with_different_nodeid_types(self):
# probability_matrix = np.array([[0.95, 0.01], [0.01, 0.95]])
# number_of_nodes_per_community = [20, 20]

# sbm_sample = gc.simulations.sbm(
# number_of_nodes_per_community, probability_matrix
# )
# sbm_graph = nx.from_numpy_array(sbm_sample)
# sbm_sample = gc.simulations.sbm(
# number_of_nodes_per_community, probability_matrix
# )
# sbm_graph = nx.from_numpy_array(sbm_sample)

# graph = nx.Graph()
# graph_as_strings = nx.Graph()
# for s, t in sbm_graph.edges():
# graph.add_edge(s, t, weight=1)
# graph_as_strings.add_edge(str(s), str(t), weight=1)
# graph = nx.Graph()
# graph_as_strings = nx.Graph()
# for s, t in sbm_graph.edges():
# graph.add_edge(s, t, weight=1)
# graph_as_strings.add_edge(str(s), str(t), weight=1)

# original_embedding = gc.embed.node2vec_embed(graph, random_seed=1)
# string_embedding = gc.embed.node2vec_embed(graph_as_strings, random_seed=1)
# original_embedding = gc.embed.node2vec_embed(graph, random_seed=1)
# string_embedding = gc.embed.node2vec_embed(graph_as_strings, random_seed=1)

# k = KMeans(n_clusters=2)
# original_labels = k.fit_predict(original_embedding[0])
# string_labels = k.fit_predict(string_embedding[0])
# k = KMeans(n_clusters=2)
# original_labels = k.fit_predict(original_embedding[0])
# string_labels = k.fit_predict(string_embedding[0])

# expected_labels = np.zeros(40, dtype=int)
# expected_labels[20:] = 1
# expected_labels = np.zeros(40, dtype=int)
# expected_labels[20:] = 1

# original_ari = adjusted_rand_score(original_labels, expected_labels)
# string_ari = adjusted_rand_score(string_labels, expected_labels)
# original_ari = adjusted_rand_score(original_labels, expected_labels)
# string_ari = adjusted_rand_score(string_labels, expected_labels)

# self.assertEqual(original_ari, string_ari)
# self.assertEqual(original_ari, string_ari)

# def test_n2v_directed_undirected_returns_same_clustering(self):
# probability_matrix = np.array([[0.95, 0.01], [0.01, 0.95]])
# number_of_nodes_per_community = [20, 20]
# def test_n2v_directed_undirected_returns_same_clustering(self):
# probability_matrix = np.array([[0.95, 0.01], [0.01, 0.95]])
# number_of_nodes_per_community = [20, 20]

# sbm_sample = gc.simulations.sbm(
# number_of_nodes_per_community, probability_matrix
# )
# sbm_graph = nx.from_numpy_array(sbm_sample)
# sbm_sample = gc.simulations.sbm(
# number_of_nodes_per_community, probability_matrix
# )
# sbm_graph = nx.from_numpy_array(sbm_sample)

# graph = nx.Graph()
# graph_directed = nx.DiGraph()
# for s, t in sbm_graph.edges():
# graph.add_edge(s, t, weight=1)
# graph = nx.Graph()
# graph_directed = nx.DiGraph()
# for s, t in sbm_graph.edges():
# graph.add_edge(s, t, weight=1)

# graph_directed.add_edge(s, t, weight=1)
# graph_directed.add_edge(t, s, weight=1)
# graph_directed.add_edge(s, t, weight=1)
# graph_directed.add_edge(t, s, weight=1)

# undirected_embedding = gc.embed.node2vec_embed(graph, random_seed=1)
# directed_embedding = gc.embed.node2vec_embed(graph_directed, random_seed=1)
# undirected_embedding = gc.embed.node2vec_embed(graph, random_seed=1)
# directed_embedding = gc.embed.node2vec_embed(graph_directed, random_seed=1)

# k = KMeans(n_clusters=2, random_state=1234)
# undirected_labels = k.fit_predict(undirected_embedding[0])
# k = KMeans(n_clusters=2, random_state=1234)
# directed_labels = k.fit_predict(directed_embedding[0])
# k = KMeans(n_clusters=2, random_state=1234)
# undirected_labels = k.fit_predict(undirected_embedding[0])
# k = KMeans(n_clusters=2, random_state=1234)
# directed_labels = k.fit_predict(directed_embedding[0])

# expected_labels = np.zeros(40, dtype=int)
# expected_labels[20:] = 1
# expected_labels = np.zeros(40, dtype=int)
# expected_labels[20:] = 1

# undirected_ari = adjusted_rand_score(undirected_labels, expected_labels)
# directed_ari = adjusted_rand_score(directed_labels, expected_labels)
# undirected_ari = adjusted_rand_score(undirected_labels, expected_labels)
# directed_ari = adjusted_rand_score(directed_labels, expected_labels)

# self.assertEqual(undirected_ari, directed_ari)
# self.assertEqual(undirected_ari, directed_ari)

def test_node2vec_embed(self):
g = nx.florentine_families_graph()
Expand Down

0 comments on commit c6dce71

Please sign in to comment.