Skip to content

Commit 136e39f

Browse files
committed
add new example
1 parent 58463bd commit 136e39f

2 files changed

Lines changed: 70 additions & 42 deletions

File tree

Example.ipynb

Lines changed: 70 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010
{
1111
"cell_type": "code",
12-
"execution_count": 1,
12+
"execution_count": 15,
1313
"metadata": {},
1414
"outputs": [
1515
{
@@ -18,31 +18,7 @@
1818
"text": [
1919
"graphwave\n",
2020
"degree2\n",
21-
"drne\n"
22-
]
23-
},
24-
{
25-
"name": "stderr",
26-
"output_type": "stream",
27-
"text": [
28-
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:493: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
29-
" _np_qint8 = np.dtype([(\"qint8\", np.int8, 1)])\n",
30-
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:494: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
31-
" _np_quint8 = np.dtype([(\"quint8\", np.uint8, 1)])\n",
32-
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:495: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
33-
" _np_qint16 = np.dtype([(\"qint16\", np.int16, 1)])\n",
34-
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:496: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
35-
" _np_quint16 = np.dtype([(\"quint16\", np.uint16, 1)])\n",
36-
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:497: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
37-
" _np_qint32 = np.dtype([(\"qint32\", np.int32, 1)])\n",
38-
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/framework/dtypes.py:502: FutureWarning: Passing (type, 1) or '1type' as a synonym of type is deprecated; in a future version of numpy, it will be understood as (type, (1,)) / '(1,)type'.\n",
39-
" np_resource = np.dtype([(\"resource\", np.ubyte, 1)])\n"
40-
]
41-
},
42-
{
43-
"name": "stdout",
44-
"output_type": "stream",
45-
"text": [
21+
"drne\n",
4622
"node2vec\n",
4723
"degree\n",
4824
"role2vec\n",
@@ -54,14 +30,6 @@
5430
"segk\n",
5531
"riwalk\n"
5632
]
57-
},
58-
{
59-
"name": "stderr",
60-
"output_type": "stream",
61-
"text": [
62-
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/externals/joblib/__init__.py:15: DeprecationWarning: sklearn.externals.joblib is deprecated in 0.21 and will be removed in 0.23. Please import this functionality directly from joblib, which can be installed with: pip install joblib. If this warning is raised when loading pickled models, you may need to re-serialize those models with scikit-learn 0.21+.\n",
63-
" warnings.warn(msg, category=DeprecationWarning)\n"
64-
]
6533
}
6634
],
6735
"source": [
@@ -426,7 +394,7 @@
426394
},
427395
{
428396
"cell_type": "code",
429-
"execution_count": 10,
397+
"execution_count": 11,
430398
"metadata": {},
431399
"outputs": [
432400
{
@@ -464,7 +432,7 @@
464432
" 'auc_macro': 0.9281}}}"
465433
]
466434
},
467-
"execution_count": 10,
435+
"execution_count": 11,
468436
"metadata": {},
469437
"output_type": "execute_result"
470438
}
@@ -473,6 +441,72 @@
473441
"perform_classification(dict_struc2vec_emb, dict_labels)"
474442
]
475443
},
444+
{
445+
"cell_type": "markdown",
446+
"metadata": {},
447+
"source": [
448+
"## Perform Clustering"
449+
]
450+
},
451+
{
452+
"cell_type": "code",
453+
"execution_count": 13,
454+
"metadata": {},
455+
"outputs": [
456+
{
457+
"name": "stderr",
458+
"output_type": "stream",
459+
"text": [
460+
"/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/sklearn/metrics/cluster/supervised.py:859: FutureWarning: The behavior of NMI will change in version 0.22. To match the behavior of 'v_measure_score', NMI will use average_method='arithmetic' by default.\n",
461+
" FutureWarning)\n"
462+
]
463+
},
464+
{
465+
"data": {
466+
"text/plain": [
467+
"{'overall': {'purity': [0.6717557251908397], 'nmi': [0.48503443794906465]}}"
468+
]
469+
},
470+
"execution_count": 13,
471+
"metadata": {},
472+
"output_type": "execute_result"
473+
}
474+
],
475+
"source": [
476+
"perform_clustering(dict_struc2vec_emb, dict_labels)"
477+
]
478+
},
479+
{
480+
"cell_type": "markdown",
481+
"metadata": {},
482+
"source": [
483+
"## Perform Centrality Correlation"
484+
]
485+
},
486+
{
487+
"cell_type": "code",
488+
"execution_count": 14,
489+
"metadata": {},
490+
"outputs": [
491+
{
492+
"data": {
493+
"text/plain": [
494+
"0.9387720917030852"
495+
]
496+
},
497+
"execution_count": 14,
498+
"metadata": {},
499+
"output_type": "execute_result"
500+
}
501+
],
502+
"source": [
503+
"from semb.evaluations.centrality_correlation import *\n",
504+
"centrality_correlation(dataset_graph, \n",
505+
" dict_struc2vec_emb, \n",
506+
" centrality='clustering_coeff', \n",
507+
" similarity='euclidean')"
508+
]
509+
},
476510
{
477511
"cell_type": "code",
478512
"execution_count": null,

Untitled.ipynb

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)