Spaces:
Runtime error
Runtime error
bug fix
Browse files
pages/2_Concepts_comparison.py
CHANGED
|
@@ -97,13 +97,13 @@ with output_col_1:
|
|
| 97 |
header_col_1.write(f'Concepts {", ".join(concept_ids)} - Relevant nodes in common: {nodes_in_common}')# - Nodes {",".join(list(imp_nodes))}')
|
| 98 |
|
| 99 |
edges = []
|
| 100 |
-
for i in range(len(
|
| 101 |
-
for j in range(len(
|
| 102 |
if i != j:
|
| 103 |
-
print(f'Similarity between {
|
| 104 |
similarity = cosine_similarity(vectors[i,:].reshape(1, -1), vectors[j,:].reshape(1, -1))
|
| 105 |
print(np.round(similarity[0][0], 3))
|
| 106 |
-
edges.append((
|
| 107 |
|
| 108 |
# Create an empty graph
|
| 109 |
G = nx.Graph()
|
|
|
|
| 97 |
header_col_1.write(f'Concepts {", ".join(concept_ids)} - Relevant nodes in common: {nodes_in_common}')# - Nodes {",".join(list(imp_nodes))}')
|
| 98 |
|
| 99 |
edges = []
|
| 100 |
+
for i in range(len(concept_ids)):
|
| 101 |
+
for j in range(len(concept_ids)):
|
| 102 |
if i != j:
|
| 103 |
+
print(f'Similarity between {concept_ids[i]} and {concept_ids[j]}')
|
| 104 |
similarity = cosine_similarity(vectors[i,:].reshape(1, -1), vectors[j,:].reshape(1, -1))
|
| 105 |
print(np.round(similarity[0][0], 3))
|
| 106 |
+
edges.append((concept_ids[i], concept_ids[j], np.round(similarity[0][0], 3)))
|
| 107 |
|
| 108 |
# Create an empty graph
|
| 109 |
G = nx.Graph()
|