diff --git a/brainx/notebooks/detect_partition_degeneracy.ipynb b/brainx/notebooks/detect_partition_degeneracy.ipynb index 15ea435..9f128be 100644 --- a/brainx/notebooks/detect_partition_degeneracy.ipynb +++ b/brainx/notebooks/detect_partition_degeneracy.ipynb @@ -1,7 +1,16 @@ { "metadata": { + "kernelspec": { + "codemirror_mode": { + "name": "ipython", + "version": 2 + }, + "display_name": "IPython (Python 2)", + "language": "python", + "name": "python2" + }, "name": "", - "signature": "sha256:a279c98a0412414b9c96041884cdbed8d963c45cbdc2d0208f2a84a5f0f09451" + "signature": "sha256:1b5afc6e5122b380a91d4eb08d65d1493d39af6d846e87f1e8a8ca3656a13d90" }, "nbformat": 3, "nbformat_minor": 0, @@ -57,28 +66,23 @@ "import numpy as np\n", "import networkx as nx\n", "from glob import glob\n", - "from matplotlib import pyplot as plt" - ], - "language": "python", - "metadata": {}, - "outputs": [], - "prompt_number": 2 - }, - { - "cell_type": "code", - "collapsed": false, - "input": [ - "# user-specific imports\n", - "import json\n", + "from matplotlib import pyplot as plt\n", "\n", - "brainxdir = '/home/jagust/graph/scripts/brainx/brainx/' ## EDIT ME! ##\n", - "os.chdir(brainxdir)\n", - "from util import threshold_adjacency_matrix" + "from brainx.util import threshold_adjacency_matrix" ], "language": "python", "metadata": {}, - "outputs": [], - "prompt_number": 3 + "outputs": [ + { + "output_type": "stream", + "stream": "stderr", + "text": [ + "/home/stefan/src/brainx/brainx/__init__.py:30: UserWarning: Monkeypatching NetworkX's Watts-Strogatz routine\n", + " warnings.warn(\"Monkeypatching NetworkX's Watts-Strogatz routine\")\n" + ] + } + ], + "prompt_number": 2 }, { "cell_type": "heading", @@ -232,14 +236,7 @@ "[[2, 3, 5, 14, 15, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 34, 35, 36, 37, 38, 39, 40, 41, 64, 65, 66, 71, 72, 73, 83, 84, 85, 86], [76, 77], [70], [74], [75], [87]]\n", "1006_gbsm cost: 0.25\n", "[[1, 10, 11, 16, 17, 18, 19, 20, 21, 28, 29, 32, 33, 36, 37, 39, 56, 57, 59, 60, 62, 63, 67, 78, 79, 80, 81, 82, 83, 85, 89], [87]]\n", - "1007_base" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " cost: 0.25\n", + "1007_base cost: 0.25\n", "[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 15, 18, 19, 22, 23, 24, 25, 26, 27, 33, 34, 35, 56, 57, 58, 59, 60, 61, 64, 65, 66, 67, 68, 69, 85], [20], [21]]\n", "[[42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 54, 55, 88], [52, 53]]\n", "1007_gbsm cost: 0.25\n", @@ -248,14 +245,7 @@ "[[1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 13, 18, 19, 22, 23, 24, 25, 31, 32, 33, 34, 35, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 84, 85, 88], [27]]\n", "1008_base cost: 0.25\n", "[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 22, 23, 24, 25, 26, 27, 30, 31, 34, 35, 51, 55, 58, 59, 60, 61, 64, 65, 66, 67, 76, 77, 84, 85, 86, 87, 89], [20], [21]]\n", - "1008_edu" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " cost: 0.25\n", + "1008_edu cost: 0.25\n", "[[2, 3, 4, 5, 6, 7, 8, 9, 12, 14, 15, 22, 23, 24, 25, 32, 34, 35, 64, 65, 66, 67, 70, 71, 84, 85, 86], [76, 77]]\n", "[[0, 11, 16, 17, 18, 19, 20, 21, 26, 27, 28, 29, 30, 31, 33, 36, 37, 38, 40, 56, 57, 68, 69, 78, 79, 80, 81, 82, 83, 87], [72, 73, 74, 75], [39], [41]]\n", "1008_gbsm cost: 0.25\n", @@ -263,38 +253,17 @@ "[[3, 4, 5, 7, 15, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 34, 35, 36, 37, 38, 40, 65, 66, 67, 71, 72, 74, 85, 87], [45]]\n", "1009_edu cost: 0.25\n", "[[0, 1, 21, 23, 24, 25, 26, 27, 37, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 68, 69, 80, 84, 85], [20]]\n", - "1009_gbsm" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " cost: 0.25\n", + "1009_gbsm cost: 0.25\n", "1010_edu cost: 0.25\n", "[[3, 5, 7, 9, 13, 14, 15, 16, 17, 22, 23, 25, 28, 29, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 54, 55, 59, 63, 65, 67, 68, 69, 70, 72, 73, 74, 75, 76, 77, 78, 79, 81, 82, 83, 87, 89], [27, 20, 21, 71]]\n", "1010_gbsm cost: 0.25\n", "[[3, 5, 15, 20, 21, 22, 23, 25, 27, 30, 31, 34, 35, 36, 37, 38, 39, 40, 41, 64, 65, 75, 82, 83, 85, 86, 87, 89], [26], [71]]\n", "[[0, 1, 2, 6, 7, 10, 11, 12, 13, 16, 17, 18, 19, 28, 29, 32, 56, 57, 60, 61, 62, 68, 69, 72, 73, 74, 76, 77, 79, 80, 81], [24], [70]]\n", "[[33, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 58, 59, 63, 66, 67, 78, 84, 88], [4], [8], [9], [14]]\n", - "1011_edu" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " cost: 0.25\n", + "1011_edu cost: 0.25\n", "1011_gbsm cost: 0.25\n", "1015_base cost: 0.25\n", - "1015_edu" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " cost: 0.25\n", + "1015_edu cost: 0.25\n", "[[0, 4, 8, 24, 25, 26, 27, 34, 36, 37, 38, 39, 40, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 66, 67, 68, 69, 88], [20, 21], [86], [87]]\n", "1015_gbsm cost: 0.25\n", "[[16, 17, 28, 29, 36, 37, 38, 39, 40, 41, 62, 63, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87], [21]]\n", @@ -303,27 +272,13 @@ "1016_base cost: 0.25\n", "[[4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 21, 22, 23, 26, 27, 28, 29, 36, 37, 38, 40, 41, 60, 61, 62, 63, 64, 65, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 85, 86, 87, 89], [20], [70]]\n", "[[0, 1, 2, 3, 18, 19, 32, 33, 34, 35, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 66, 67, 68, 69, 84, 88], [39], [71]]\n", - "1016_gbsm" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " cost: 0.25\n", + "1016_gbsm cost: 0.25\n", "[[32, 36, 38, 72, 73, 74, 75, 76, 77, 82, 83, 21, 28, 29, 62], [41, 37, 86, 87], [20], [39], [40]]\n", "1017_base cost: 0.25\n", "[[6, 10, 11, 12, 13, 14, 15, 16, 17, 18, 28, 29, 32, 36, 37, 38, 39, 40, 41, 62, 63, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 86, 87, 88, 89], [70]]\n", "[[42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 66, 67, 68, 69, 84, 85], [71]]\n", "1017_edu cost: 0.25\n", - "1017_gbsm" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " cost: 0.25\n", + "1017_gbsm cost: 0.25\n", "[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 30, 31, 32, 33, 59, 60, 61, 62, 69], [70], [71]]\n", "[[16, 17, 28, 29, 36, 37, 38, 39, 40, 41, 63, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89], [64, 65]]\n", "1018_base cost: 0.25\n", @@ -331,27 +286,13 @@ "1018_edu cost: 0.25\n", "[[1, 2, 3, 4, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 21, 22, 23, 24, 25, 26, 27, 30, 31, 35, 52, 56, 57, 60, 61, 63, 64, 65, 69, 84, 85, 89], [5], [20], [70], [71]]\n", "[[0, 16, 17, 18, 19, 28, 29, 32, 33, 34, 36, 37, 38, 39, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 53, 54, 55, 58, 59, 62, 66, 67, 68, 76, 77, 78, 79, 80, 81, 82, 83, 86, 88], [72, 73, 74, 75], [40, 41], [87]]\n", - "1018_gbsm" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " cost: 0.25\n", + "1018_gbsm cost: 0.25\n", "[[1, 6, 16, 17, 18, 19, 28, 29, 32, 33, 41, 57, 59, 60, 61, 62, 63, 69, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 83, 87], [70, 71]]\n", "1020_base cost: 0.25\n", "[[0, 1, 40, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 68, 69, 82, 88, 89], [38]]\n", "1020_edu cost: 0.25\n", "[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 28, 29, 30, 31, 32, 33, 38, 39, 57, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 71, 76, 77, 78, 79, 80, 81, 82, 83, 86, 89], [70]]\n", - "1020_gbsm" - ] - }, - { - "output_type": "stream", - "stream": "stdout", - "text": [ - " cost: 0.25\n", + "1020_gbsm cost: 0.25\n", "[[2, 3, 4, 5, 6, 8, 9, 10, 11, 13, 14, 15, 20, 22, 23, 24, 25, 26, 27, 30, 31, 34, 35, 60, 64, 65, 89], [70, 71]]\n", "[[7, 16, 17, 18, 19, 28, 29, 32, 33, 40, 62, 63, 66, 67, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83], [21]]\n" ]