├── .gitignore ├── README.md ├── docs ├── .nojekyll ├── Makefile ├── README.md ├── doctrees │ ├── environment.pickle │ └── index.doctree ├── html │ ├── .buildinfo │ ├── .nojekyll │ ├── _modules │ │ ├── gslr.html │ │ └── index.html │ ├── _sources │ │ └── index.rst.txt │ ├── _static │ │ ├── ajax-loader.gif │ │ ├── basic.css │ │ ├── comment-bright.png │ │ ├── comment-close.png │ │ ├── comment.png │ │ ├── css │ │ │ ├── badge_only.css │ │ │ └── theme.css │ │ ├── doctools.js │ │ ├── down-pressed.png │ │ ├── down.png │ │ ├── file.png │ │ ├── fonts │ │ │ ├── Inconsolata-Bold.ttf │ │ │ ├── Inconsolata-Regular.ttf │ │ │ ├── Lato-Bold.ttf │ │ │ ├── Lato-Regular.ttf │ │ │ ├── RobotoSlab-Bold.ttf │ │ │ ├── RobotoSlab-Regular.ttf │ │ │ ├── fontawesome-webfont.eot │ │ │ ├── fontawesome-webfont.svg │ │ │ ├── fontawesome-webfont.ttf │ │ │ └── fontawesome-webfont.woff │ │ ├── jquery-3.1.0.js │ │ ├── jquery.js │ │ ├── js │ │ │ ├── modernizr.min.js │ │ │ └── theme.js │ │ ├── minus.png │ │ ├── plus.png │ │ ├── pygments.css │ │ ├── searchtools.js │ │ ├── underscore-1.3.1.js │ │ ├── underscore.js │ │ ├── up-pressed.png │ │ ├── up.png │ │ └── websupport.js │ ├── genindex.html │ ├── index.html │ ├── objects.inv │ ├── py-modindex.html │ ├── search.html │ └── searchindex.js ├── index.html └── source │ ├── .nojekyll │ ├── conf.py │ └── index.rst ├── examples └── Example_Usage.ipynb ├── experiments ├── KEGG │ ├── KEGG_df.filtered.with_correlates.pickle │ ├── KEGG_df.pickle │ ├── Pathway_Curation_and_Correlates_Discovery.ipynb │ ├── README.md │ └── download_KEGG.ipynb ├── README.md ├── algorithms │ ├── Logit_PR_vs_GSLR_pr.ipynb │ ├── Logit_vs_GSLR.ipynb │ ├── PLS-DA.ipynb │ ├── README.md │ ├── figures │ │ ├── easy.pdf │ │ ├── hard.pdf │ │ ├── hsa04110_easy.pdf │ │ └── hsa04110_hard.pdf │ ├── gslr │ │ ├── GSLR.ipynb │ │ ├── GSLR2.ipynb │ │ ├── GSLR_gmm_results.ipynb │ │ ├── GSLR_results.ipynb │ │ ├── TCGA_BRCA.ipynb │ │ ├── TCGA_OV.ipynb │ │ ├── TOBI_MEDULLO.ipynb │ │ ├── gslr_gmm_pr_results.ipynb │ │ ├── gslr_gmm_results.pickle │ │ ├── gslr_pr_results.ipynb │ │ ├── gslr_results.pickle │ │ ├── ludwig │ │ │ ├── graph_proj_test.ipynb │ │ │ ├── gslr_test.ipynb │ │ │ └── softmax_test.ipynb │ │ ├── medullo_coefs.pickle │ │ ├── ovarian_coefs.pickle │ │ ├── real_data.py │ │ ├── run_GSLR.py │ │ ├── run_gslr_gmm.py │ │ ├── run_gslr_gmm_pr.py │ │ ├── run_gslr_pr.py │ │ └── run_xor_GSLR.py │ ├── logit │ │ ├── logit.ipynb │ │ ├── logit_gmm_pr_results.ipynb │ │ ├── logit_gmm_results.ipynb │ │ ├── logit_gmm_results.pickle │ │ ├── logit_l2_gmm_pr_results.ipynb │ │ ├── logit_l2_pr_results.ipynb │ │ ├── logit_pr_results.ipynb │ │ ├── logit_results.ipynb │ │ ├── logit_results.pickle │ │ ├── run_logit.py │ │ ├── run_logit_gmm.py │ │ ├── run_logit_gmm_pr.py │ │ ├── run_logit_pr.py │ │ ├── run_xor_logit.py │ │ ├── xor_logit_results.ipynb │ │ └── xor_logit_results.pickle │ ├── netreg │ │ ├── GX.tsv │ │ ├── NetReg.ipynb │ │ ├── X.tsv │ │ ├── Y.tsv │ │ ├── netreg.sh │ │ ├── outfile_coefficients.tsv │ │ └── outfile_intercepts.tsv │ ├── pcsf │ │ ├── PCSF.ipynb │ │ ├── hsa04110_inbiomap_exp.pcsf.prizes │ │ └── inbiomap_temp.tsv │ └── srig │ │ ├── SRIG.ipynb │ │ ├── Test_PyLearn_ParsimonY.ipynb │ │ ├── run_srig_pr.py │ │ └── test_SPAMS.ipynb ├── data_generation │ ├── 1_multivariate_normal │ │ ├── README.md │ │ ├── multivariate_normal.ipynb │ │ └── multivariate_normal.py │ ├── 2_independent_normals │ │ ├── README.md │ │ ├── independent_normals.ipynb │ │ └── independent_normals.py │ ├── 3_multivariate_normal_svd_covariance │ │ ├── README.md │ │ ├── ludwig.ipynb │ │ ├── ludwig_svd_covariance.ipynb │ │ ├── ludwig_svd_covariance.py │ │ ├── updated_kegg_ludwig_svd_covariance.ipynb │ │ └── xor_kegg_pathways.py │ ├── 4_multivariate_normal_svd_covariance_greater_shift │ │ ├── README.md │ │ └── ludwig_svd_covariance_gaussian_mixture.py │ ├── 5_conditional_multivariate_normal │ │ ├── README.md │ │ └── hypothesis.ipynb │ ├── README.md │ └── synthetic_vs_real.ipynb └── real_data │ ├── brca_inbiomap_exp.tsv │ ├── medullo_inbiomap_exp.tsv │ └── ovarian_inbiomap_exp.tsv ├── gslr ├── __init__.py ├── __main__.py └── gslr.py ├── poster ├── beamerthemeI6dv.sty ├── graph_sparsity_picture.tex ├── images │ ├── 1.pdf │ ├── 2.pdf │ ├── 3.pdf │ ├── 4.pdf │ ├── algo.pdf │ ├── graph.pdf │ ├── matrix.pdf │ ├── mit-cropped.pdf │ └── selected.pdf ├── middle-col-low.tex ├── poster.out ├── poster.pdf └── poster.tex ├── requirements.txt └── setup.py /.gitignore: -------------------------------------------------------------------------------- 1 | *.xlsx 2 | sftp-config.json 3 | experiments/generated_data 4 | **/**_pr_**.pickle 5 | .venv 6 | 7 | poster/*.aux 8 | poster/*.fdb_latexmk 9 | poster/*.fls 10 | poster/*.nav 11 | poster/*.toc 12 | poster/*snm 13 | 14 | 15 | # Byte-compiled / optimized / DLL files 16 | __pycache__/ 17 | *.py[cod] 18 | *$py.class 19 | 20 | # C extensions 21 | *.so 22 | 23 | # Distribution / packaging 24 | .Python 25 | env/ 26 | build/ 27 | develop-eggs/ 28 | dist/ 29 | downloads/ 30 | eggs/ 31 | .eggs/ 32 | lib64/ 33 | parts/ 34 | sdist/ 35 | var/ 36 | *.egg-info/ 37 | .installed.cfg 38 | *.egg 39 | 40 | # PyInstaller 41 | # Usually these files are written by a python script from a template 42 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 43 | *.manifest 44 | *.spec 45 | 46 | # Installer logs 47 | pip-log.txt 48 | pip-delete-this-directory.txt 49 | 50 | # Unit test / coverage reports 51 | htmlcov/ 52 | .tox/ 53 | .coverage 54 | .coverage.* 55 | .cache 56 | nosetests.xml 57 | coverage.xml 58 | *,cover 59 | .hypothesis/ 60 | 61 | # Translations 62 | *.mo 63 | *.pot 64 | 65 | # Django stuff: 66 | *.log 67 | local_settings.py 68 | 69 | # Flask stuff: 70 | instance/ 71 | .webassets-cache 72 | 73 | # Scrapy stuff: 74 | .scrapy 75 | 76 | # Sphinx documentation 77 | docs/_build/ 78 | 79 | # PyBuilder 80 | target/ 81 | 82 | # IPython Notebook 83 | .ipynb_checkpoints 84 | 85 | # pyenv 86 | .python-version 87 | 88 | # celery beat schedule file 89 | celerybeat-schedule 90 | 91 | # dotenv 92 | .env 93 | 94 | # virtualenv 95 | venv/ 96 | ENV/ 97 | 98 | # Spyder project settings 99 | .spyderproject 100 | 101 | # Rope project settings 102 | .ropeproject 103 | 104 | # Vim swap files 105 | *.swp 106 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | [![PyPI](https://img.shields.io/pypi/v/nine.svg)](https://pypi.python.org/pypi/gslr) 3 | 4 | # Graph-Sparse Logistic Regression 5 | 6 | ## Motivation 7 | 8 | The motivation for Graph-Sparse Logistic Regression is to constrain classification to predict a label from a graph-sparse support. More in [the paper](https://arxiv.org/abs/1712.05510) or [the poster](https://github.com/fraenkel-lab/GSLR/raw/master/poster/poster.pdf). 9 | 10 | 11 | ## Installation 12 | 13 | From [pypi](https://pypi.python.org/pypi/gslr). 14 | ``` 15 | pip install gslr 16 | ``` 17 | ## Documentation 18 | 19 | See the [docs](https://fraenkel-lab.github.io/GSLR/). 20 | 21 | ## Example Usage 22 | 23 | See the [`examples`](examples) directory 24 | -------------------------------------------------------------------------------- /docs/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/.nojekyll -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = GSLR 8 | SOURCEDIR = source 9 | BUILDDIR = . 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /docs/README.md: -------------------------------------------------------------------------------- 1 | ## Docs 2 | 3 | In order to actually change the documentation that shows up, change the docstrings in `gslr/gslr.py`. 4 | 5 | Docs are automatically generated by sphinx with autodoc and napoleon. 6 | 7 | ## Compilation Instructions: 8 | 9 | from `./docs` do `make html`. 10 | 11 | 12 | -------------------------------------------------------------------------------- /docs/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/doctrees/environment.pickle -------------------------------------------------------------------------------- /docs/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/doctrees/index.doctree -------------------------------------------------------------------------------- /docs/html/.buildinfo: -------------------------------------------------------------------------------- 1 | # Sphinx build info version 1 2 | # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. 3 | config: f3a98b159e10e282be31920e978cb9b0 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /docs/html/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/.nojekyll -------------------------------------------------------------------------------- /docs/html/_modules/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Overview: module code — GSLR 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | 50 | 51 | 98 | 99 |
100 | 101 | 102 | 108 | 109 | 110 | 111 |
112 |
113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |
130 | 131 |
    132 | 133 |
  • Docs »
  • 134 | 135 |
  • Overview: module code
  • 136 | 137 | 138 |
  • 139 | 140 | 141 | 142 |
  • 143 | 144 |
145 | 146 | 147 |
148 |
149 |
150 |
151 | 152 |

All modules for which code is available

153 | 155 | 156 |
157 |
158 | 159 |
160 |
161 | 175 | 176 |
177 |
178 | 179 |
180 | 181 |
182 | 183 | 184 | 185 | 186 | 187 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 215 | 216 | 217 | 218 | -------------------------------------------------------------------------------- /docs/html/_sources/index.rst.txt: -------------------------------------------------------------------------------- 1 | Graph-Sparse Logistic Regression 2 | ================================ 3 | 4 | .. automodule:: gslr 5 | :members: 6 | -------------------------------------------------------------------------------- /docs/html/_static/ajax-loader.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/ajax-loader.gif -------------------------------------------------------------------------------- /docs/html/_static/basic.css: -------------------------------------------------------------------------------- 1 | /* 2 | * basic.css 3 | * ~~~~~~~~~ 4 | * 5 | * Sphinx stylesheet -- basic theme. 6 | * 7 | * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /* -- main layout ----------------------------------------------------------- */ 13 | 14 | div.clearer { 15 | clear: both; 16 | } 17 | 18 | /* -- relbar ---------------------------------------------------------------- */ 19 | 20 | div.related { 21 | width: 100%; 22 | font-size: 90%; 23 | } 24 | 25 | div.related h3 { 26 | display: none; 27 | } 28 | 29 | div.related ul { 30 | margin: 0; 31 | padding: 0 0 0 10px; 32 | list-style: none; 33 | } 34 | 35 | div.related li { 36 | display: inline; 37 | } 38 | 39 | div.related li.right { 40 | float: right; 41 | margin-right: 5px; 42 | } 43 | 44 | /* -- sidebar --------------------------------------------------------------- */ 45 | 46 | div.sphinxsidebarwrapper { 47 | padding: 10px 5px 0 10px; 48 | } 49 | 50 | div.sphinxsidebar { 51 | float: left; 52 | width: 230px; 53 | margin-left: -100%; 54 | font-size: 90%; 55 | word-wrap: break-word; 56 | overflow-wrap : break-word; 57 | } 58 | 59 | div.sphinxsidebar ul { 60 | list-style: none; 61 | } 62 | 63 | div.sphinxsidebar ul ul, 64 | div.sphinxsidebar ul.want-points { 65 | margin-left: 20px; 66 | list-style: square; 67 | } 68 | 69 | div.sphinxsidebar ul ul { 70 | margin-top: 0; 71 | margin-bottom: 0; 72 | } 73 | 74 | div.sphinxsidebar form { 75 | margin-top: 10px; 76 | } 77 | 78 | div.sphinxsidebar input { 79 | border: 1px solid #98dbcc; 80 | font-family: sans-serif; 81 | font-size: 1em; 82 | } 83 | 84 | div.sphinxsidebar #searchbox input[type="text"] { 85 | width: 170px; 86 | } 87 | 88 | img { 89 | border: 0; 90 | max-width: 100%; 91 | } 92 | 93 | /* -- search page ----------------------------------------------------------- */ 94 | 95 | ul.search { 96 | margin: 10px 0 0 20px; 97 | padding: 0; 98 | } 99 | 100 | ul.search li { 101 | padding: 5px 0 5px 20px; 102 | background-image: url(file.png); 103 | background-repeat: no-repeat; 104 | background-position: 0 7px; 105 | } 106 | 107 | ul.search li a { 108 | font-weight: bold; 109 | } 110 | 111 | ul.search li div.context { 112 | color: #888; 113 | margin: 2px 0 0 30px; 114 | text-align: left; 115 | } 116 | 117 | ul.keywordmatches li.goodmatch a { 118 | font-weight: bold; 119 | } 120 | 121 | /* -- index page ------------------------------------------------------------ */ 122 | 123 | table.contentstable { 124 | width: 90%; 125 | margin-left: auto; 126 | margin-right: auto; 127 | } 128 | 129 | table.contentstable p.biglink { 130 | line-height: 150%; 131 | } 132 | 133 | a.biglink { 134 | font-size: 1.3em; 135 | } 136 | 137 | span.linkdescr { 138 | font-style: italic; 139 | padding-top: 5px; 140 | font-size: 90%; 141 | } 142 | 143 | /* -- general index --------------------------------------------------------- */ 144 | 145 | table.indextable { 146 | width: 100%; 147 | } 148 | 149 | table.indextable td { 150 | text-align: left; 151 | vertical-align: top; 152 | } 153 | 154 | table.indextable ul { 155 | margin-top: 0; 156 | margin-bottom: 0; 157 | list-style-type: none; 158 | } 159 | 160 | table.indextable > tbody > tr > td > ul { 161 | padding-left: 0em; 162 | } 163 | 164 | table.indextable tr.pcap { 165 | height: 10px; 166 | } 167 | 168 | table.indextable tr.cap { 169 | margin-top: 10px; 170 | background-color: #f2f2f2; 171 | } 172 | 173 | img.toggler { 174 | margin-right: 3px; 175 | margin-top: 3px; 176 | cursor: pointer; 177 | } 178 | 179 | div.modindex-jumpbox { 180 | border-top: 1px solid #ddd; 181 | border-bottom: 1px solid #ddd; 182 | margin: 1em 0 1em 0; 183 | padding: 0.4em; 184 | } 185 | 186 | div.genindex-jumpbox { 187 | border-top: 1px solid #ddd; 188 | border-bottom: 1px solid #ddd; 189 | margin: 1em 0 1em 0; 190 | padding: 0.4em; 191 | } 192 | 193 | /* -- domain module index --------------------------------------------------- */ 194 | 195 | table.modindextable td { 196 | padding: 2px; 197 | border-collapse: collapse; 198 | } 199 | 200 | /* -- general body styles --------------------------------------------------- */ 201 | 202 | div.body p, div.body dd, div.body li, div.body blockquote { 203 | -moz-hyphens: auto; 204 | -ms-hyphens: auto; 205 | -webkit-hyphens: auto; 206 | hyphens: auto; 207 | } 208 | 209 | a.headerlink { 210 | visibility: hidden; 211 | } 212 | 213 | h1:hover > a.headerlink, 214 | h2:hover > a.headerlink, 215 | h3:hover > a.headerlink, 216 | h4:hover > a.headerlink, 217 | h5:hover > a.headerlink, 218 | h6:hover > a.headerlink, 219 | dt:hover > a.headerlink, 220 | caption:hover > a.headerlink, 221 | p.caption:hover > a.headerlink, 222 | div.code-block-caption:hover > a.headerlink { 223 | visibility: visible; 224 | } 225 | 226 | div.body p.caption { 227 | text-align: inherit; 228 | } 229 | 230 | div.body td { 231 | text-align: left; 232 | } 233 | 234 | .first { 235 | margin-top: 0 !important; 236 | } 237 | 238 | p.rubric { 239 | margin-top: 30px; 240 | font-weight: bold; 241 | } 242 | 243 | img.align-left, .figure.align-left, object.align-left { 244 | clear: left; 245 | float: left; 246 | margin-right: 1em; 247 | } 248 | 249 | img.align-right, .figure.align-right, object.align-right { 250 | clear: right; 251 | float: right; 252 | margin-left: 1em; 253 | } 254 | 255 | img.align-center, .figure.align-center, object.align-center { 256 | display: block; 257 | margin-left: auto; 258 | margin-right: auto; 259 | } 260 | 261 | .align-left { 262 | text-align: left; 263 | } 264 | 265 | .align-center { 266 | text-align: center; 267 | } 268 | 269 | .align-right { 270 | text-align: right; 271 | } 272 | 273 | /* -- sidebars -------------------------------------------------------------- */ 274 | 275 | div.sidebar { 276 | margin: 0 0 0.5em 1em; 277 | border: 1px solid #ddb; 278 | padding: 7px 7px 0 7px; 279 | background-color: #ffe; 280 | width: 40%; 281 | float: right; 282 | } 283 | 284 | p.sidebar-title { 285 | font-weight: bold; 286 | } 287 | 288 | /* -- topics ---------------------------------------------------------------- */ 289 | 290 | div.topic { 291 | border: 1px solid #ccc; 292 | padding: 7px 7px 0 7px; 293 | margin: 10px 0 10px 0; 294 | } 295 | 296 | p.topic-title { 297 | font-size: 1.1em; 298 | font-weight: bold; 299 | margin-top: 10px; 300 | } 301 | 302 | /* -- admonitions ----------------------------------------------------------- */ 303 | 304 | div.admonition { 305 | margin-top: 10px; 306 | margin-bottom: 10px; 307 | padding: 7px; 308 | } 309 | 310 | div.admonition dt { 311 | font-weight: bold; 312 | } 313 | 314 | div.admonition dl { 315 | margin-bottom: 0; 316 | } 317 | 318 | p.admonition-title { 319 | margin: 0px 10px 5px 0px; 320 | font-weight: bold; 321 | } 322 | 323 | div.body p.centered { 324 | text-align: center; 325 | margin-top: 25px; 326 | } 327 | 328 | /* -- tables ---------------------------------------------------------------- */ 329 | 330 | table.docutils { 331 | border: 0; 332 | border-collapse: collapse; 333 | } 334 | 335 | table caption span.caption-number { 336 | font-style: italic; 337 | } 338 | 339 | table caption span.caption-text { 340 | } 341 | 342 | table.docutils td, table.docutils th { 343 | padding: 1px 8px 1px 5px; 344 | border-top: 0; 345 | border-left: 0; 346 | border-right: 0; 347 | border-bottom: 1px solid #aaa; 348 | } 349 | 350 | table.footnote td, table.footnote th { 351 | border: 0 !important; 352 | } 353 | 354 | th { 355 | text-align: left; 356 | padding-right: 5px; 357 | } 358 | 359 | table.citation { 360 | border-left: solid 1px gray; 361 | margin-left: 1px; 362 | } 363 | 364 | table.citation td { 365 | border-bottom: none; 366 | } 367 | 368 | /* -- figures --------------------------------------------------------------- */ 369 | 370 | div.figure { 371 | margin: 0.5em; 372 | padding: 0.5em; 373 | } 374 | 375 | div.figure p.caption { 376 | padding: 0.3em; 377 | } 378 | 379 | div.figure p.caption span.caption-number { 380 | font-style: italic; 381 | } 382 | 383 | div.figure p.caption span.caption-text { 384 | } 385 | 386 | /* -- field list styles ----------------------------------------------------- */ 387 | 388 | table.field-list td, table.field-list th { 389 | border: 0 !important; 390 | } 391 | 392 | .field-list ul { 393 | margin: 0; 394 | padding-left: 1em; 395 | } 396 | 397 | .field-list p { 398 | margin: 0; 399 | } 400 | 401 | .field-name { 402 | -moz-hyphens: manual; 403 | -ms-hyphens: manual; 404 | -webkit-hyphens: manual; 405 | hyphens: manual; 406 | } 407 | 408 | /* -- other body styles ----------------------------------------------------- */ 409 | 410 | ol.arabic { 411 | list-style: decimal; 412 | } 413 | 414 | ol.loweralpha { 415 | list-style: lower-alpha; 416 | } 417 | 418 | ol.upperalpha { 419 | list-style: upper-alpha; 420 | } 421 | 422 | ol.lowerroman { 423 | list-style: lower-roman; 424 | } 425 | 426 | ol.upperroman { 427 | list-style: upper-roman; 428 | } 429 | 430 | dl { 431 | margin-bottom: 15px; 432 | } 433 | 434 | dd p { 435 | margin-top: 0px; 436 | } 437 | 438 | dd ul, dd table { 439 | margin-bottom: 10px; 440 | } 441 | 442 | dd { 443 | margin-top: 3px; 444 | margin-bottom: 10px; 445 | margin-left: 30px; 446 | } 447 | 448 | dt:target, span.highlighted { 449 | background-color: #fbe54e; 450 | } 451 | 452 | rect.highlighted { 453 | fill: #fbe54e; 454 | } 455 | 456 | dl.glossary dt { 457 | font-weight: bold; 458 | font-size: 1.1em; 459 | } 460 | 461 | .optional { 462 | font-size: 1.3em; 463 | } 464 | 465 | .sig-paren { 466 | font-size: larger; 467 | } 468 | 469 | .versionmodified { 470 | font-style: italic; 471 | } 472 | 473 | .system-message { 474 | background-color: #fda; 475 | padding: 5px; 476 | border: 3px solid red; 477 | } 478 | 479 | .footnote:target { 480 | background-color: #ffa; 481 | } 482 | 483 | .line-block { 484 | display: block; 485 | margin-top: 1em; 486 | margin-bottom: 1em; 487 | } 488 | 489 | .line-block .line-block { 490 | margin-top: 0; 491 | margin-bottom: 0; 492 | margin-left: 1.5em; 493 | } 494 | 495 | .guilabel, .menuselection { 496 | font-family: sans-serif; 497 | } 498 | 499 | .accelerator { 500 | text-decoration: underline; 501 | } 502 | 503 | .classifier { 504 | font-style: oblique; 505 | } 506 | 507 | abbr, acronym { 508 | border-bottom: dotted 1px; 509 | cursor: help; 510 | } 511 | 512 | /* -- code displays --------------------------------------------------------- */ 513 | 514 | pre { 515 | overflow: auto; 516 | overflow-y: hidden; /* fixes display issues on Chrome browsers */ 517 | } 518 | 519 | span.pre { 520 | -moz-hyphens: none; 521 | -ms-hyphens: none; 522 | -webkit-hyphens: none; 523 | hyphens: none; 524 | } 525 | 526 | td.linenos pre { 527 | padding: 5px 0px; 528 | border: 0; 529 | background-color: transparent; 530 | color: #aaa; 531 | } 532 | 533 | table.highlighttable { 534 | margin-left: 0.5em; 535 | } 536 | 537 | table.highlighttable td { 538 | padding: 0 0.5em 0 0.5em; 539 | } 540 | 541 | div.code-block-caption { 542 | padding: 2px 5px; 543 | font-size: small; 544 | } 545 | 546 | div.code-block-caption code { 547 | background-color: transparent; 548 | } 549 | 550 | div.code-block-caption + div > div.highlight > pre { 551 | margin-top: 0; 552 | } 553 | 554 | div.code-block-caption span.caption-number { 555 | padding: 0.1em 0.3em; 556 | font-style: italic; 557 | } 558 | 559 | div.code-block-caption span.caption-text { 560 | } 561 | 562 | div.literal-block-wrapper { 563 | padding: 1em 1em 0; 564 | } 565 | 566 | div.literal-block-wrapper div.highlight { 567 | margin: 0; 568 | } 569 | 570 | code.descname { 571 | background-color: transparent; 572 | font-weight: bold; 573 | font-size: 1.2em; 574 | } 575 | 576 | code.descclassname { 577 | background-color: transparent; 578 | } 579 | 580 | code.xref, a code { 581 | background-color: transparent; 582 | font-weight: bold; 583 | } 584 | 585 | h1 code, h2 code, h3 code, h4 code, h5 code, h6 code { 586 | background-color: transparent; 587 | } 588 | 589 | .viewcode-link { 590 | float: right; 591 | } 592 | 593 | .viewcode-back { 594 | float: right; 595 | font-family: sans-serif; 596 | } 597 | 598 | div.viewcode-block:target { 599 | margin: -1px -10px; 600 | padding: 0 10px; 601 | } 602 | 603 | /* -- math display ---------------------------------------------------------- */ 604 | 605 | img.math { 606 | vertical-align: middle; 607 | } 608 | 609 | div.body div.math p { 610 | text-align: center; 611 | } 612 | 613 | span.eqno { 614 | float: right; 615 | } 616 | 617 | span.eqno a.headerlink { 618 | position: relative; 619 | left: 0px; 620 | z-index: 1; 621 | } 622 | 623 | div.math:hover a.headerlink { 624 | visibility: visible; 625 | } 626 | 627 | /* -- printout stylesheet --------------------------------------------------- */ 628 | 629 | @media print { 630 | div.document, 631 | div.documentwrapper, 632 | div.bodywrapper { 633 | margin: 0 !important; 634 | width: 100%; 635 | } 636 | 637 | div.sphinxsidebar, 638 | div.related, 639 | div.footer, 640 | #top-link { 641 | display: none; 642 | } 643 | } -------------------------------------------------------------------------------- /docs/html/_static/comment-bright.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/comment-bright.png -------------------------------------------------------------------------------- /docs/html/_static/comment-close.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/comment-close.png -------------------------------------------------------------------------------- /docs/html/_static/comment.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/comment.png -------------------------------------------------------------------------------- /docs/html/_static/css/badge_only.css: -------------------------------------------------------------------------------- 1 | .fa:before{-webkit-font-smoothing:antialiased}.clearfix{*zoom:1}.clearfix:before,.clearfix:after{display:table;content:""}.clearfix:after{clear:both}@font-face{font-family:FontAwesome;font-weight:normal;font-style:normal;src:url("../font/fontawesome_webfont.eot");src:url("../font/fontawesome_webfont.eot?#iefix") format("embedded-opentype"),url("../font/fontawesome_webfont.woff") format("woff"),url("../font/fontawesome_webfont.ttf") format("truetype"),url("../font/fontawesome_webfont.svg#FontAwesome") format("svg")}.fa:before{display:inline-block;font-family:FontAwesome;font-style:normal;font-weight:normal;line-height:1;text-decoration:inherit}a .fa{display:inline-block;text-decoration:inherit}li .fa{display:inline-block}li .fa-large:before,li .fa-large:before{width:1.875em}ul.fas{list-style-type:none;margin-left:2em;text-indent:-0.8em}ul.fas li .fa{width:0.8em}ul.fas li .fa-large:before,ul.fas li .fa-large:before{vertical-align:baseline}.fa-book:before{content:""}.icon-book:before{content:""}.fa-caret-down:before{content:""}.icon-caret-down:before{content:""}.fa-caret-up:before{content:""}.icon-caret-up:before{content:""}.fa-caret-left:before{content:""}.icon-caret-left:before{content:""}.fa-caret-right:before{content:""}.icon-caret-right:before{content:""}.rst-versions{position:fixed;bottom:0;left:0;width:300px;color:#fcfcfc;background:#1f1d1d;border-top:solid 10px #343131;font-family:"Lato","proxima-nova","Helvetica Neue",Arial,sans-serif;z-index:400}.rst-versions a{color:#2980B9;text-decoration:none}.rst-versions .rst-badge-small{display:none}.rst-versions .rst-current-version{padding:12px;background-color:#272525;display:block;text-align:right;font-size:90%;cursor:pointer;color:#27AE60;*zoom:1}.rst-versions .rst-current-version:before,.rst-versions .rst-current-version:after{display:table;content:""}.rst-versions .rst-current-version:after{clear:both}.rst-versions .rst-current-version .fa{color:#fcfcfc}.rst-versions .rst-current-version .fa-book{float:left}.rst-versions .rst-current-version .icon-book{float:left}.rst-versions .rst-current-version.rst-out-of-date{background-color:#E74C3C;color:#fff}.rst-versions .rst-current-version.rst-active-old-version{background-color:#F1C40F;color:#000}.rst-versions.shift-up .rst-other-versions{display:block}.rst-versions .rst-other-versions{font-size:90%;padding:12px;color:gray;display:none}.rst-versions .rst-other-versions hr{display:block;height:1px;border:0;margin:20px 0;padding:0;border-top:solid 1px #413d3d}.rst-versions .rst-other-versions dd{display:inline-block;margin:0}.rst-versions .rst-other-versions dd a{display:inline-block;padding:6px;color:#fcfcfc}.rst-versions.rst-badge{width:auto;bottom:20px;right:20px;left:auto;border:none;max-width:300px}.rst-versions.rst-badge .icon-book{float:none}.rst-versions.rst-badge .fa-book{float:none}.rst-versions.rst-badge.shift-up .rst-current-version{text-align:right}.rst-versions.rst-badge.shift-up .rst-current-version .fa-book{float:left}.rst-versions.rst-badge.shift-up .rst-current-version .icon-book{float:left}.rst-versions.rst-badge .rst-current-version{width:auto;height:30px;line-height:30px;padding:0 6px;display:block;text-align:center}@media screen and (max-width: 768px){.rst-versions{width:85%;display:none}.rst-versions.shift{display:block}} 2 | /*# sourceMappingURL=badge_only.css.map */ 3 | -------------------------------------------------------------------------------- /docs/html/_static/doctools.js: -------------------------------------------------------------------------------- 1 | /* 2 | * doctools.js 3 | * ~~~~~~~~~~~ 4 | * 5 | * Sphinx JavaScript utilities for all documentation. 6 | * 7 | * :copyright: Copyright 2007-2017 by the Sphinx team, see AUTHORS. 8 | * :license: BSD, see LICENSE for details. 9 | * 10 | */ 11 | 12 | /** 13 | * select a different prefix for underscore 14 | */ 15 | $u = _.noConflict(); 16 | 17 | /** 18 | * make the code below compatible with browsers without 19 | * an installed firebug like debugger 20 | if (!window.console || !console.firebug) { 21 | var names = ["log", "debug", "info", "warn", "error", "assert", "dir", 22 | "dirxml", "group", "groupEnd", "time", "timeEnd", "count", "trace", 23 | "profile", "profileEnd"]; 24 | window.console = {}; 25 | for (var i = 0; i < names.length; ++i) 26 | window.console[names[i]] = function() {}; 27 | } 28 | */ 29 | 30 | /** 31 | * small helper function to urldecode strings 32 | */ 33 | jQuery.urldecode = function(x) { 34 | return decodeURIComponent(x).replace(/\+/g, ' '); 35 | }; 36 | 37 | /** 38 | * small helper function to urlencode strings 39 | */ 40 | jQuery.urlencode = encodeURIComponent; 41 | 42 | /** 43 | * This function returns the parsed url parameters of the 44 | * current request. Multiple values per key are supported, 45 | * it will always return arrays of strings for the value parts. 46 | */ 47 | jQuery.getQueryParameters = function(s) { 48 | if (typeof s === 'undefined') 49 | s = document.location.search; 50 | var parts = s.substr(s.indexOf('?') + 1).split('&'); 51 | var result = {}; 52 | for (var i = 0; i < parts.length; i++) { 53 | var tmp = parts[i].split('=', 2); 54 | var key = jQuery.urldecode(tmp[0]); 55 | var value = jQuery.urldecode(tmp[1]); 56 | if (key in result) 57 | result[key].push(value); 58 | else 59 | result[key] = [value]; 60 | } 61 | return result; 62 | }; 63 | 64 | /** 65 | * highlight a given string on a jquery object by wrapping it in 66 | * span elements with the given class name. 67 | */ 68 | jQuery.fn.highlightText = function(text, className) { 69 | function highlight(node, addItems) { 70 | if (node.nodeType === 3) { 71 | var val = node.nodeValue; 72 | var pos = val.toLowerCase().indexOf(text); 73 | if (pos >= 0 && !jQuery(node.parentNode).hasClass(className)) { 74 | var span; 75 | var isInSVG = jQuery(node).closest("body, svg, foreignObject").is("svg"); 76 | if (isInSVG) { 77 | span = document.createElementNS("http://www.w3.org/2000/svg", "tspan"); 78 | } else { 79 | span = document.createElement("span"); 80 | span.className = className; 81 | } 82 | span.appendChild(document.createTextNode(val.substr(pos, text.length))); 83 | node.parentNode.insertBefore(span, node.parentNode.insertBefore( 84 | document.createTextNode(val.substr(pos + text.length)), 85 | node.nextSibling)); 86 | node.nodeValue = val.substr(0, pos); 87 | if (isInSVG) { 88 | var bbox = span.getBBox(); 89 | var rect = document.createElementNS("http://www.w3.org/2000/svg", "rect"); 90 | rect.x.baseVal.value = bbox.x; 91 | rect.y.baseVal.value = bbox.y; 92 | rect.width.baseVal.value = bbox.width; 93 | rect.height.baseVal.value = bbox.height; 94 | rect.setAttribute('class', className); 95 | var parentOfText = node.parentNode.parentNode; 96 | addItems.push({ 97 | "parent": node.parentNode, 98 | "target": rect}); 99 | } 100 | } 101 | } 102 | else if (!jQuery(node).is("button, select, textarea")) { 103 | jQuery.each(node.childNodes, function() { 104 | highlight(this, addItems); 105 | }); 106 | } 107 | } 108 | var addItems = []; 109 | var result = this.each(function() { 110 | highlight(this, addItems); 111 | }); 112 | for (var i = 0; i < addItems.length; ++i) { 113 | jQuery(addItems[i].parent).before(addItems[i].target); 114 | } 115 | return result; 116 | }; 117 | 118 | /* 119 | * backward compatibility for jQuery.browser 120 | * This will be supported until firefox bug is fixed. 121 | */ 122 | if (!jQuery.browser) { 123 | jQuery.uaMatch = function(ua) { 124 | ua = ua.toLowerCase(); 125 | 126 | var match = /(chrome)[ \/]([\w.]+)/.exec(ua) || 127 | /(webkit)[ \/]([\w.]+)/.exec(ua) || 128 | /(opera)(?:.*version|)[ \/]([\w.]+)/.exec(ua) || 129 | /(msie) ([\w.]+)/.exec(ua) || 130 | ua.indexOf("compatible") < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) || 131 | []; 132 | 133 | return { 134 | browser: match[ 1 ] || "", 135 | version: match[ 2 ] || "0" 136 | }; 137 | }; 138 | jQuery.browser = {}; 139 | jQuery.browser[jQuery.uaMatch(navigator.userAgent).browser] = true; 140 | } 141 | 142 | /** 143 | * Small JavaScript module for the documentation. 144 | */ 145 | var Documentation = { 146 | 147 | init : function() { 148 | this.fixFirefoxAnchorBug(); 149 | this.highlightSearchWords(); 150 | this.initIndexTable(); 151 | 152 | }, 153 | 154 | /** 155 | * i18n support 156 | */ 157 | TRANSLATIONS : {}, 158 | PLURAL_EXPR : function(n) { return n === 1 ? 0 : 1; }, 159 | LOCALE : 'unknown', 160 | 161 | // gettext and ngettext don't access this so that the functions 162 | // can safely bound to a different name (_ = Documentation.gettext) 163 | gettext : function(string) { 164 | var translated = Documentation.TRANSLATIONS[string]; 165 | if (typeof translated === 'undefined') 166 | return string; 167 | return (typeof translated === 'string') ? translated : translated[0]; 168 | }, 169 | 170 | ngettext : function(singular, plural, n) { 171 | var translated = Documentation.TRANSLATIONS[singular]; 172 | if (typeof translated === 'undefined') 173 | return (n == 1) ? singular : plural; 174 | return translated[Documentation.PLURALEXPR(n)]; 175 | }, 176 | 177 | addTranslations : function(catalog) { 178 | for (var key in catalog.messages) 179 | this.TRANSLATIONS[key] = catalog.messages[key]; 180 | this.PLURAL_EXPR = new Function('n', 'return +(' + catalog.plural_expr + ')'); 181 | this.LOCALE = catalog.locale; 182 | }, 183 | 184 | /** 185 | * add context elements like header anchor links 186 | */ 187 | addContextElements : function() { 188 | $('div[id] > :header:first').each(function() { 189 | $('\u00B6'). 190 | attr('href', '#' + this.id). 191 | attr('title', _('Permalink to this headline')). 192 | appendTo(this); 193 | }); 194 | $('dt[id]').each(function() { 195 | $('\u00B6'). 196 | attr('href', '#' + this.id). 197 | attr('title', _('Permalink to this definition')). 198 | appendTo(this); 199 | }); 200 | }, 201 | 202 | /** 203 | * workaround a firefox stupidity 204 | * see: https://bugzilla.mozilla.org/show_bug.cgi?id=645075 205 | */ 206 | fixFirefoxAnchorBug : function() { 207 | if (document.location.hash) 208 | window.setTimeout(function() { 209 | document.location.href += ''; 210 | }, 10); 211 | }, 212 | 213 | /** 214 | * highlight the search words provided in the url in the text 215 | */ 216 | highlightSearchWords : function() { 217 | var params = $.getQueryParameters(); 218 | var terms = (params.highlight) ? params.highlight[0].split(/\s+/) : []; 219 | if (terms.length) { 220 | var body = $('div.body'); 221 | if (!body.length) { 222 | body = $('body'); 223 | } 224 | window.setTimeout(function() { 225 | $.each(terms, function() { 226 | body.highlightText(this.toLowerCase(), 'highlighted'); 227 | }); 228 | }, 10); 229 | $('') 231 | .appendTo($('#searchbox')); 232 | } 233 | }, 234 | 235 | /** 236 | * init the domain index toggle buttons 237 | */ 238 | initIndexTable : function() { 239 | var togglers = $('img.toggler').click(function() { 240 | var src = $(this).attr('src'); 241 | var idnum = $(this).attr('id').substr(7); 242 | $('tr.cg-' + idnum).toggle(); 243 | if (src.substr(-9) === 'minus.png') 244 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); 245 | else 246 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); 247 | }).css('display', ''); 248 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { 249 | togglers.click(); 250 | } 251 | }, 252 | 253 | /** 254 | * helper function to hide the search marks again 255 | */ 256 | hideSearchWords : function() { 257 | $('#searchbox .highlight-link').fadeOut(300); 258 | $('span.highlighted').removeClass('highlighted'); 259 | }, 260 | 261 | /** 262 | * make the url absolute 263 | */ 264 | makeURL : function(relativeURL) { 265 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; 266 | }, 267 | 268 | /** 269 | * get the current relative url 270 | */ 271 | getCurrentURL : function() { 272 | var path = document.location.pathname; 273 | var parts = path.split(/\//); 274 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { 275 | if (this === '..') 276 | parts.pop(); 277 | }); 278 | var url = parts.join('/'); 279 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); 280 | }, 281 | 282 | initOnKeyListeners: function() { 283 | $(document).keyup(function(event) { 284 | var activeElementType = document.activeElement.tagName; 285 | // don't navigate when in search box or textarea 286 | if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { 287 | switch (event.keyCode) { 288 | case 37: // left 289 | var prevHref = $('link[rel="prev"]').prop('href'); 290 | if (prevHref) { 291 | window.location.href = prevHref; 292 | return false; 293 | } 294 | case 39: // right 295 | var nextHref = $('link[rel="next"]').prop('href'); 296 | if (nextHref) { 297 | window.location.href = nextHref; 298 | return false; 299 | } 300 | } 301 | } 302 | }); 303 | } 304 | }; 305 | 306 | // quick alias for translations 307 | _ = Documentation.gettext; 308 | 309 | $(document).ready(function() { 310 | Documentation.init(); 311 | }); -------------------------------------------------------------------------------- /docs/html/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/down-pressed.png -------------------------------------------------------------------------------- /docs/html/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/down.png -------------------------------------------------------------------------------- /docs/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/file.png -------------------------------------------------------------------------------- /docs/html/_static/fonts/Inconsolata-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/fonts/Inconsolata-Bold.ttf -------------------------------------------------------------------------------- /docs/html/_static/fonts/Inconsolata-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/fonts/Inconsolata-Regular.ttf -------------------------------------------------------------------------------- /docs/html/_static/fonts/Lato-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/fonts/Lato-Bold.ttf -------------------------------------------------------------------------------- /docs/html/_static/fonts/Lato-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/fonts/Lato-Regular.ttf -------------------------------------------------------------------------------- /docs/html/_static/fonts/RobotoSlab-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/fonts/RobotoSlab-Bold.ttf -------------------------------------------------------------------------------- /docs/html/_static/fonts/RobotoSlab-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/fonts/RobotoSlab-Regular.ttf -------------------------------------------------------------------------------- /docs/html/_static/fonts/fontawesome-webfont.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/fonts/fontawesome-webfont.eot -------------------------------------------------------------------------------- /docs/html/_static/fonts/fontawesome-webfont.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/fonts/fontawesome-webfont.ttf -------------------------------------------------------------------------------- /docs/html/_static/fonts/fontawesome-webfont.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/fonts/fontawesome-webfont.woff -------------------------------------------------------------------------------- /docs/html/_static/js/theme.js: -------------------------------------------------------------------------------- 1 | require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o"); 80 | 81 | // Add expand links to all parents of nested ul 82 | $('.wy-menu-vertical ul').not('.simple').siblings('a').each(function () { 83 | var link = $(this); 84 | expand = $(''); 85 | expand.on('click', function (ev) { 86 | self.toggleCurrent(link); 87 | ev.stopPropagation(); 88 | return false; 89 | }); 90 | link.prepend(expand); 91 | }); 92 | }; 93 | 94 | nav.reset = function () { 95 | // Get anchor from URL and open up nested nav 96 | var anchor = encodeURI(window.location.hash); 97 | if (anchor) { 98 | try { 99 | var link = $('.wy-menu-vertical') 100 | .find('[href="' + anchor + '"]'); 101 | // If we didn't find a link, it may be because we clicked on 102 | // something that is not in the sidebar (eg: when using 103 | // sphinxcontrib.httpdomain it generates headerlinks but those 104 | // aren't picked up and placed in the toctree). So let's find 105 | // the closest header in the document and try with that one. 106 | if (link.length === 0) { 107 | var doc_link = $('.document a[href="' + anchor + '"]'); 108 | var closest_section = doc_link.closest('div.section'); 109 | // Try again with the closest section entry. 110 | link = $('.wy-menu-vertical') 111 | .find('[href="#' + closest_section.attr("id") + '"]'); 112 | 113 | } 114 | $('.wy-menu-vertical li.toctree-l1 li.current') 115 | .removeClass('current'); 116 | link.closest('li.toctree-l2').addClass('current'); 117 | link.closest('li.toctree-l3').addClass('current'); 118 | link.closest('li.toctree-l4').addClass('current'); 119 | } 120 | catch (err) { 121 | console.log("Error expanding nav for anchor", err); 122 | } 123 | } 124 | }; 125 | 126 | nav.onScroll = function () { 127 | this.winScroll = false; 128 | var newWinPosition = this.win.scrollTop(), 129 | winBottom = newWinPosition + this.winHeight, 130 | navPosition = this.navBar.scrollTop(), 131 | newNavPosition = navPosition + (newWinPosition - this.winPosition); 132 | if (newWinPosition < 0 || winBottom > this.docHeight) { 133 | return; 134 | } 135 | this.navBar.scrollTop(newNavPosition); 136 | this.winPosition = newWinPosition; 137 | }; 138 | 139 | nav.onResize = function () { 140 | this.winResize = false; 141 | this.winHeight = this.win.height(); 142 | this.docHeight = $(document).height(); 143 | }; 144 | 145 | nav.hashChange = function () { 146 | this.linkScroll = true; 147 | this.win.one('hashchange', function () { 148 | this.linkScroll = false; 149 | }); 150 | }; 151 | 152 | nav.toggleCurrent = function (elem) { 153 | var parent_li = elem.closest('li'); 154 | parent_li.siblings('li.current').removeClass('current'); 155 | parent_li.siblings().find('li.current').removeClass('current'); 156 | parent_li.find('> ul li.current').removeClass('current'); 157 | parent_li.toggleClass('current'); 158 | } 159 | 160 | return nav; 161 | }; 162 | 163 | module.exports.ThemeNav = ThemeNav(); 164 | 165 | if (typeof(window) != 'undefined') { 166 | window.SphinxRtdTheme = { StickyNav: module.exports.ThemeNav }; 167 | } 168 | 169 | },{"jquery":"jquery"}]},{},["sphinx-rtd-theme"]); 170 | -------------------------------------------------------------------------------- /docs/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/minus.png -------------------------------------------------------------------------------- /docs/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/plus.png -------------------------------------------------------------------------------- /docs/html/_static/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #eeffcc; } 3 | .highlight .c { color: #408090; font-style: italic } /* Comment */ 4 | .highlight .err { border: 1px solid #FF0000 } /* Error */ 5 | .highlight .k { color: #007020; font-weight: bold } /* Keyword */ 6 | .highlight .o { color: #666666 } /* Operator */ 7 | .highlight .ch { color: #408090; font-style: italic } /* Comment.Hashbang */ 8 | .highlight .cm { color: #408090; font-style: italic } /* Comment.Multiline */ 9 | .highlight .cp { color: #007020 } /* Comment.Preproc */ 10 | .highlight .cpf { color: #408090; font-style: italic } /* Comment.PreprocFile */ 11 | .highlight .c1 { color: #408090; font-style: italic } /* Comment.Single */ 12 | .highlight .cs { color: #408090; background-color: #fff0f0 } /* Comment.Special */ 13 | .highlight .gd { color: #A00000 } /* Generic.Deleted */ 14 | .highlight .ge { font-style: italic } /* Generic.Emph */ 15 | .highlight .gr { color: #FF0000 } /* Generic.Error */ 16 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 17 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 18 | .highlight .go { color: #333333 } /* Generic.Output */ 19 | .highlight .gp { color: #c65d09; font-weight: bold } /* Generic.Prompt */ 20 | .highlight .gs { font-weight: bold } /* Generic.Strong */ 21 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 22 | .highlight .gt { color: #0044DD } /* Generic.Traceback */ 23 | .highlight .kc { color: #007020; font-weight: bold } /* Keyword.Constant */ 24 | .highlight .kd { color: #007020; font-weight: bold } /* Keyword.Declaration */ 25 | .highlight .kn { color: #007020; font-weight: bold } /* Keyword.Namespace */ 26 | .highlight .kp { color: #007020 } /* Keyword.Pseudo */ 27 | .highlight .kr { color: #007020; font-weight: bold } /* Keyword.Reserved */ 28 | .highlight .kt { color: #902000 } /* Keyword.Type */ 29 | .highlight .m { color: #208050 } /* Literal.Number */ 30 | .highlight .s { color: #4070a0 } /* Literal.String */ 31 | .highlight .na { color: #4070a0 } /* Name.Attribute */ 32 | .highlight .nb { color: #007020 } /* Name.Builtin */ 33 | .highlight .nc { color: #0e84b5; font-weight: bold } /* Name.Class */ 34 | .highlight .no { color: #60add5 } /* Name.Constant */ 35 | .highlight .nd { color: #555555; font-weight: bold } /* Name.Decorator */ 36 | .highlight .ni { color: #d55537; font-weight: bold } /* Name.Entity */ 37 | .highlight .ne { color: #007020 } /* Name.Exception */ 38 | .highlight .nf { color: #06287e } /* Name.Function */ 39 | .highlight .nl { color: #002070; font-weight: bold } /* Name.Label */ 40 | .highlight .nn { color: #0e84b5; font-weight: bold } /* Name.Namespace */ 41 | .highlight .nt { color: #062873; font-weight: bold } /* Name.Tag */ 42 | .highlight .nv { color: #bb60d5 } /* Name.Variable */ 43 | .highlight .ow { color: #007020; font-weight: bold } /* Operator.Word */ 44 | .highlight .w { color: #bbbbbb } /* Text.Whitespace */ 45 | .highlight .mb { color: #208050 } /* Literal.Number.Bin */ 46 | .highlight .mf { color: #208050 } /* Literal.Number.Float */ 47 | .highlight .mh { color: #208050 } /* Literal.Number.Hex */ 48 | .highlight .mi { color: #208050 } /* Literal.Number.Integer */ 49 | .highlight .mo { color: #208050 } /* Literal.Number.Oct */ 50 | .highlight .sa { color: #4070a0 } /* Literal.String.Affix */ 51 | .highlight .sb { color: #4070a0 } /* Literal.String.Backtick */ 52 | .highlight .sc { color: #4070a0 } /* Literal.String.Char */ 53 | .highlight .dl { color: #4070a0 } /* Literal.String.Delimiter */ 54 | .highlight .sd { color: #4070a0; font-style: italic } /* Literal.String.Doc */ 55 | .highlight .s2 { color: #4070a0 } /* Literal.String.Double */ 56 | .highlight .se { color: #4070a0; font-weight: bold } /* Literal.String.Escape */ 57 | .highlight .sh { color: #4070a0 } /* Literal.String.Heredoc */ 58 | .highlight .si { color: #70a0d0; font-style: italic } /* Literal.String.Interpol */ 59 | .highlight .sx { color: #c65d09 } /* Literal.String.Other */ 60 | .highlight .sr { color: #235388 } /* Literal.String.Regex */ 61 | .highlight .s1 { color: #4070a0 } /* Literal.String.Single */ 62 | .highlight .ss { color: #517918 } /* Literal.String.Symbol */ 63 | .highlight .bp { color: #007020 } /* Name.Builtin.Pseudo */ 64 | .highlight .fm { color: #06287e } /* Name.Function.Magic */ 65 | .highlight .vc { color: #bb60d5 } /* Name.Variable.Class */ 66 | .highlight .vg { color: #bb60d5 } /* Name.Variable.Global */ 67 | .highlight .vi { color: #bb60d5 } /* Name.Variable.Instance */ 68 | .highlight .vm { color: #bb60d5 } /* Name.Variable.Magic */ 69 | .highlight .il { color: #208050 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /docs/html/_static/underscore.js: -------------------------------------------------------------------------------- 1 | // Underscore.js 1.3.1 2 | // (c) 2009-2012 Jeremy Ashkenas, DocumentCloud Inc. 3 | // Underscore is freely distributable under the MIT license. 4 | // Portions of Underscore are inspired or borrowed from Prototype, 5 | // Oliver Steele's Functional, and John Resig's Micro-Templating. 6 | // For all details and documentation: 7 | // http://documentcloud.github.com/underscore 8 | (function(){function q(a,c,d){if(a===c)return a!==0||1/a==1/c;if(a==null||c==null)return a===c;if(a._chain)a=a._wrapped;if(c._chain)c=c._wrapped;if(a.isEqual&&b.isFunction(a.isEqual))return a.isEqual(c);if(c.isEqual&&b.isFunction(c.isEqual))return c.isEqual(a);var e=l.call(a);if(e!=l.call(c))return false;switch(e){case "[object String]":return a==String(c);case "[object Number]":return a!=+a?c!=+c:a==0?1/a==1/c:a==+c;case "[object Date]":case "[object Boolean]":return+a==+c;case "[object RegExp]":return a.source== 9 | c.source&&a.global==c.global&&a.multiline==c.multiline&&a.ignoreCase==c.ignoreCase}if(typeof a!="object"||typeof c!="object")return false;for(var f=d.length;f--;)if(d[f]==a)return true;d.push(a);var f=0,g=true;if(e=="[object Array]"){if(f=a.length,g=f==c.length)for(;f--;)if(!(g=f in a==f in c&&q(a[f],c[f],d)))break}else{if("constructor"in a!="constructor"in c||a.constructor!=c.constructor)return false;for(var h in a)if(b.has(a,h)&&(f++,!(g=b.has(c,h)&&q(a[h],c[h],d))))break;if(g){for(h in c)if(b.has(c, 10 | h)&&!f--)break;g=!f}}d.pop();return g}var r=this,G=r._,n={},k=Array.prototype,o=Object.prototype,i=k.slice,H=k.unshift,l=o.toString,I=o.hasOwnProperty,w=k.forEach,x=k.map,y=k.reduce,z=k.reduceRight,A=k.filter,B=k.every,C=k.some,p=k.indexOf,D=k.lastIndexOf,o=Array.isArray,J=Object.keys,s=Function.prototype.bind,b=function(a){return new m(a)};if(typeof exports!=="undefined"){if(typeof module!=="undefined"&&module.exports)exports=module.exports=b;exports._=b}else r._=b;b.VERSION="1.3.1";var j=b.each= 11 | b.forEach=function(a,c,d){if(a!=null)if(w&&a.forEach===w)a.forEach(c,d);else if(a.length===+a.length)for(var e=0,f=a.length;e2;a== 12 | null&&(a=[]);if(y&&a.reduce===y)return e&&(c=b.bind(c,e)),f?a.reduce(c,d):a.reduce(c);j(a,function(a,b,i){f?d=c.call(e,d,a,b,i):(d=a,f=true)});if(!f)throw new TypeError("Reduce of empty array with no initial value");return d};b.reduceRight=b.foldr=function(a,c,d,e){var f=arguments.length>2;a==null&&(a=[]);if(z&&a.reduceRight===z)return e&&(c=b.bind(c,e)),f?a.reduceRight(c,d):a.reduceRight(c);var g=b.toArray(a).reverse();e&&!f&&(c=b.bind(c,e));return f?b.reduce(g,c,d,e):b.reduce(g,c)};b.find=b.detect= 13 | function(a,c,b){var e;E(a,function(a,g,h){if(c.call(b,a,g,h))return e=a,true});return e};b.filter=b.select=function(a,c,b){var e=[];if(a==null)return e;if(A&&a.filter===A)return a.filter(c,b);j(a,function(a,g,h){c.call(b,a,g,h)&&(e[e.length]=a)});return e};b.reject=function(a,c,b){var e=[];if(a==null)return e;j(a,function(a,g,h){c.call(b,a,g,h)||(e[e.length]=a)});return e};b.every=b.all=function(a,c,b){var e=true;if(a==null)return e;if(B&&a.every===B)return a.every(c,b);j(a,function(a,g,h){if(!(e= 14 | e&&c.call(b,a,g,h)))return n});return e};var E=b.some=b.any=function(a,c,d){c||(c=b.identity);var e=false;if(a==null)return e;if(C&&a.some===C)return a.some(c,d);j(a,function(a,b,h){if(e||(e=c.call(d,a,b,h)))return n});return!!e};b.include=b.contains=function(a,c){var b=false;if(a==null)return b;return p&&a.indexOf===p?a.indexOf(c)!=-1:b=E(a,function(a){return a===c})};b.invoke=function(a,c){var d=i.call(arguments,2);return b.map(a,function(a){return(b.isFunction(c)?c||a:a[c]).apply(a,d)})};b.pluck= 15 | function(a,c){return b.map(a,function(a){return a[c]})};b.max=function(a,c,d){if(!c&&b.isArray(a))return Math.max.apply(Math,a);if(!c&&b.isEmpty(a))return-Infinity;var e={computed:-Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;b>=e.computed&&(e={value:a,computed:b})});return e.value};b.min=function(a,c,d){if(!c&&b.isArray(a))return Math.min.apply(Math,a);if(!c&&b.isEmpty(a))return Infinity;var e={computed:Infinity};j(a,function(a,b,h){b=c?c.call(d,a,b,h):a;bd?1:0}),"value")};b.groupBy=function(a,c){var d={},e=b.isFunction(c)?c:function(a){return a[c]};j(a,function(a,b){var c=e(a,b);(d[c]||(d[c]=[])).push(a)});return d};b.sortedIndex=function(a, 17 | c,d){d||(d=b.identity);for(var e=0,f=a.length;e>1;d(a[g])=0})})};b.difference=function(a){var c=b.flatten(i.call(arguments,1));return b.filter(a,function(a){return!b.include(c,a)})};b.zip=function(){for(var a=i.call(arguments),c=b.max(b.pluck(a,"length")),d=Array(c),e=0;e=0;d--)b=[a[d].apply(this,b)];return b[0]}}; 24 | b.after=function(a,b){return a<=0?b():function(){if(--a<1)return b.apply(this,arguments)}};b.keys=J||function(a){if(a!==Object(a))throw new TypeError("Invalid object");var c=[],d;for(d in a)b.has(a,d)&&(c[c.length]=d);return c};b.values=function(a){return b.map(a,b.identity)};b.functions=b.methods=function(a){var c=[],d;for(d in a)b.isFunction(a[d])&&c.push(d);return c.sort()};b.extend=function(a){j(i.call(arguments,1),function(b){for(var d in b)a[d]=b[d]});return a};b.defaults=function(a){j(i.call(arguments, 25 | 1),function(b){for(var d in b)a[d]==null&&(a[d]=b[d])});return a};b.clone=function(a){return!b.isObject(a)?a:b.isArray(a)?a.slice():b.extend({},a)};b.tap=function(a,b){b(a);return a};b.isEqual=function(a,b){return q(a,b,[])};b.isEmpty=function(a){if(b.isArray(a)||b.isString(a))return a.length===0;for(var c in a)if(b.has(a,c))return false;return true};b.isElement=function(a){return!!(a&&a.nodeType==1)};b.isArray=o||function(a){return l.call(a)=="[object Array]"};b.isObject=function(a){return a===Object(a)}; 26 | b.isArguments=function(a){return l.call(a)=="[object Arguments]"};if(!b.isArguments(arguments))b.isArguments=function(a){return!(!a||!b.has(a,"callee"))};b.isFunction=function(a){return l.call(a)=="[object Function]"};b.isString=function(a){return l.call(a)=="[object String]"};b.isNumber=function(a){return l.call(a)=="[object Number]"};b.isNaN=function(a){return a!==a};b.isBoolean=function(a){return a===true||a===false||l.call(a)=="[object Boolean]"};b.isDate=function(a){return l.call(a)=="[object Date]"}; 27 | b.isRegExp=function(a){return l.call(a)=="[object RegExp]"};b.isNull=function(a){return a===null};b.isUndefined=function(a){return a===void 0};b.has=function(a,b){return I.call(a,b)};b.noConflict=function(){r._=G;return this};b.identity=function(a){return a};b.times=function(a,b,d){for(var e=0;e/g,">").replace(/"/g,""").replace(/'/g,"'").replace(/\//g,"/")};b.mixin=function(a){j(b.functions(a), 28 | function(c){K(c,b[c]=a[c])})};var L=0;b.uniqueId=function(a){var b=L++;return a?a+b:b};b.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var t=/.^/,u=function(a){return a.replace(/\\\\/g,"\\").replace(/\\'/g,"'")};b.template=function(a,c){var d=b.templateSettings,d="var __p=[],print=function(){__p.push.apply(__p,arguments);};with(obj||{}){__p.push('"+a.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(d.escape||t,function(a,b){return"',_.escape("+ 29 | u(b)+"),'"}).replace(d.interpolate||t,function(a,b){return"',"+u(b)+",'"}).replace(d.evaluate||t,function(a,b){return"');"+u(b).replace(/[\r\n\t]/g," ")+";__p.push('"}).replace(/\r/g,"\\r").replace(/\n/g,"\\n").replace(/\t/g,"\\t")+"');}return __p.join('');",e=new Function("obj","_",d);return c?e(c,b):function(a){return e.call(this,a,b)}};b.chain=function(a){return b(a).chain()};var m=function(a){this._wrapped=a};b.prototype=m.prototype;var v=function(a,c){return c?b(a).chain():a},K=function(a,c){m.prototype[a]= 30 | function(){var a=i.call(arguments);H.call(a,this._wrapped);return v(c.apply(b,a),this._chain)}};b.mixin(b);j("pop,push,reverse,shift,sort,splice,unshift".split(","),function(a){var b=k[a];m.prototype[a]=function(){var d=this._wrapped;b.apply(d,arguments);var e=d.length;(a=="shift"||a=="splice")&&e===0&&delete d[0];return v(d,this._chain)}});j(["concat","join","slice"],function(a){var b=k[a];m.prototype[a]=function(){return v(b.apply(this._wrapped,arguments),this._chain)}});m.prototype.chain=function(){this._chain= 31 | true;return this};m.prototype.value=function(){return this._wrapped}}).call(this); 32 | -------------------------------------------------------------------------------- /docs/html/_static/up-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/up-pressed.png -------------------------------------------------------------------------------- /docs/html/_static/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/_static/up.png -------------------------------------------------------------------------------- /docs/html/genindex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | Index — GSLR 0.0.1 documentation 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 |
50 | 51 | 52 | 99 | 100 |
101 | 102 | 103 | 109 | 110 | 111 | 112 |
113 |
114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 |
131 | 132 |
    133 | 134 |
  • Docs »
  • 135 | 136 |
  • Index
  • 137 | 138 | 139 |
  • 140 | 141 | 142 | 143 |
  • 144 | 145 |
146 | 147 | 148 |
149 |
150 |
151 |
152 | 153 | 154 |

Index

155 | 156 |
157 | E 158 | | G 159 | | N 160 | | P 161 | | R 162 | | S 163 | 164 |
165 |

E

166 | 167 | 171 |
172 | 173 |

G

174 | 175 | 181 | 187 |
188 | 189 |

N

190 | 191 | 195 |
196 | 197 |

P

198 | 199 | 203 | 207 |
208 | 209 |

R

210 | 211 | 215 |
216 | 217 |

S

218 | 219 | 223 | 227 |
228 | 229 | 230 | 231 |
232 |
233 | 234 |
235 |
236 |
237 | 238 | 239 |
240 | 241 |
242 |

243 | © Copyright 2017, Ludwig Schmidt, Alexander LeNail. 244 | 245 |

246 |
247 | Built with Sphinx using a theme provided by Read the Docs. 248 | 249 |
250 | 251 |
252 |
253 | 254 |
255 | 256 |
257 | 258 | 259 | 260 | 261 | 262 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 290 | 291 | 292 | 293 | -------------------------------------------------------------------------------- /docs/html/objects.inv: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/html/objects.inv -------------------------------------------------------------------------------- /docs/html/py-modindex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Python Module Index — GSLR 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 |
56 | 57 | 58 | 105 | 106 |
107 | 108 | 109 | 115 | 116 | 117 | 118 |
119 |
120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 |
137 | 138 |
    139 | 140 |
  • Docs »
  • 141 | 142 |
  • Python Module Index
  • 143 | 144 | 145 |
  • 146 | 147 | 148 | 149 |
  • 150 | 151 |
152 | 153 | 154 |
155 |
156 |
157 |
158 | 159 | 160 |

Python Module Index

161 | 162 |
163 | g 164 |
165 | 166 | 167 | 168 | 170 | 171 | 172 | 175 |
 
169 | g
173 | gslr 174 |
176 | 177 | 178 |
179 |
180 | 181 |
182 |
183 |
184 | 185 | 186 |
187 | 188 |
189 |

190 | © Copyright 2017, Ludwig Schmidt, Alexander LeNail. 191 | 192 |

193 |
194 | Built with Sphinx using a theme provided by Read the Docs. 195 | 196 |
197 | 198 |
199 |
200 | 201 |
202 | 203 |
204 | 205 | 206 | 207 | 208 | 209 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 237 | 238 | 239 | 240 | -------------------------------------------------------------------------------- /docs/html/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | Search — GSLR 0.0.1 documentation 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 |
49 | 50 | 51 | 98 | 99 |
100 | 101 | 102 | 108 | 109 | 110 | 111 |
112 |
113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 |
130 | 131 |
    132 | 133 |
  • Docs »
  • 134 | 135 |
  • Search
  • 136 | 137 | 138 |
  • 139 | 140 |
  • 141 | 142 |
143 | 144 | 145 |
146 |
147 |
148 |
149 | 150 | 158 | 159 | 160 |
161 | 162 |
163 | 164 |
165 |
166 | 167 |
168 |
169 |
170 | 171 | 172 |
173 | 174 |
175 |

176 | © Copyright 2017, Ludwig Schmidt, Alexander LeNail. 177 | 178 |

179 |
180 | Built with Sphinx using a theme provided by Read the Docs. 181 | 182 |
183 | 184 |
185 |
186 | 187 |
188 | 189 |
190 | 191 | 192 | 193 | 194 | 195 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 224 | 225 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | -------------------------------------------------------------------------------- /docs/html/searchindex.js: -------------------------------------------------------------------------------- 1 | Search.setIndex({docnames:["index"],envversion:53,filenames:["index.rst"],objects:{"":{gslr:[0,0,0,"-"]},"gslr.GraphOptions":{edges:[0,2,1,""],num_clusters:[0,2,1,""],pruning:[0,2,1,""],root:[0,2,1,""]},gslr:{GraphOptions:[0,1,1,""],graph_proj_sparsity:[0,3,1,""],gslr:[0,3,1,""],proj_softmax_matrix:[0,3,1,""],softmax_gradient:[0,2,1,""],softmax_loss:[0,2,1,""]}},objnames:{"0":["py","module","Python module"],"1":["py","class","Python class"],"2":["py","attribute","Python attribute"],"3":["py","function","Python function"]},objtypes:{"0":"py:module","1":"py:class","2":"py:attribute","3":"py:function"},terms:{"class":0,"final":0,"int":0,"return":0,The:0,algorithm:0,alia:0,all:0,approxim:0,arrai:0,averag:0,being:0,between:0,bound:0,choic:0,choos:0,coeffici:0,comput:0,constraint:0,cost:0,current:0,data:0,dimens:0,dimension:0,directli:0,each:0,edg:0,edge_cost:0,edge_costs_multipli:0,entri:0,exampl:0,factor:0,field:0,gradient:0,graph_opt:0,graph_proj_max_num_it:0,graph_proj_spars:0,graphopt:0,gslr:0,inclus:0,indic:0,input:0,integ:0,intermedi:0,iter:0,label:0,largest:0,list:0,loss:0,lower:0,make:0,matrix:0,max_num_it:0,maximum:0,model:0,multi:0,neg:0,node:0,non:0,none:0,num_choic:0,num_clust:0,num_step:0,number:0,one:0,onto:0,opt:0,output:0,paramet:0,pass:0,pcsf:0,pcst_fast:0,perform:0,print:0,prize:0,progress:0,proj_softmax_matrix:0,project:0,prune:0,real:0,repres:0,root:0,scalar:0,schedul:0,select:0,shape:0,should:0,size:0,softmax:0,softmax_gradi:0,softmax_loss:0,solut:0,sourc:0,sparsiti:0,sparsity_high:0,sparsity_low:0,step:0,tri:0,type:0,upper:0,vector:0,verbosity_level:0,vertic:0,weigh:0,weight:0,where:0,whether:0},titles:["Graph-Sparse Logistic Regression"],titleterms:{graph:0,logist:0,regress:0,spars:0}}) -------------------------------------------------------------------------------- /docs/index.html: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/source/.nojekyll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/docs/source/.nojekyll -------------------------------------------------------------------------------- /docs/source/conf.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # -*- coding: utf-8 -*- 3 | # 4 | # GSLR documentation build configuration file, created by 5 | # sphinx-quickstart on Mon Dec 4 10:29:01 2017. 6 | # 7 | # This file is execfile()d with the current directory set to its 8 | # containing dir. 9 | # 10 | # Note that not all possible configuration values are present in this 11 | # autogenerated file. 12 | # 13 | # All configuration values have a default; values that are commented out 14 | # serve to show the default. 15 | 16 | # If extensions (or modules to document with autodoc) are in another directory, 17 | # add these directories to sys.path here. If the directory is relative to the 18 | # documentation root, use os.path.abspath to make it absolute, like shown here. 19 | # 20 | # import os 21 | # import sys 22 | # sys.path.insert(0, os.path.abspath('.')) 23 | 24 | import os, sys 25 | sys.path.insert(0, os.path.abspath('../../gslr')) 26 | 27 | import sphinx_rtd_theme 28 | html_theme = "sphinx_rtd_theme" 29 | html_theme_path = [sphinx_rtd_theme.get_html_theme_path()] 30 | 31 | 32 | # -- General configuration ------------------------------------------------ 33 | 34 | # If your documentation needs a minimal Sphinx version, state it here. 35 | # 36 | # needs_sphinx = '1.0' 37 | 38 | # Add any Sphinx extension module names here, as strings. They can be 39 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 40 | # ones. 41 | extensions = ['sphinx.ext.autodoc','sphinx.ext.napoleon', 42 | 'sphinx.ext.viewcode', 43 | 'sphinx.ext.githubpages'] 44 | 45 | # Add any paths that contain templates here, relative to this directory. 46 | # templates_path = ['_templates'] 47 | 48 | # The suffix(es) of source filenames. 49 | # You can specify multiple suffix as a list of string: 50 | # 51 | # source_suffix = ['.rst', '.md'] 52 | source_suffix = '.rst' 53 | 54 | # The master toctree document. 55 | master_doc = 'index' 56 | 57 | # General information about the project. 58 | project = 'GSLR' 59 | copyright = '2017, Ludwig Schmidt, Alexander LeNail' 60 | author = 'Ludwig Schmidt, Alexander LeNail' 61 | 62 | # The version info for the project you're documenting, acts as replacement for 63 | # |version| and |release|, also used in various other places throughout the 64 | # built documents. 65 | # 66 | # The short X.Y version. 67 | version = '0.0.1' 68 | # The full version, including alpha/beta/rc tags. 69 | release = '0.0.1' 70 | 71 | # The language for content autogenerated by Sphinx. Refer to documentation 72 | # for a list of supported languages. 73 | # 74 | # This is also used if you do content translation via gettext catalogs. 75 | # Usually you set "language" from the command line for these cases. 76 | language = None 77 | 78 | # List of patterns, relative to source directory, that match files and 79 | # directories to ignore when looking for source files. 80 | # This patterns also effect to html_static_path and html_extra_path 81 | exclude_patterns = [] 82 | 83 | # The name of the Pygments (syntax highlighting) style to use. 84 | pygments_style = 'sphinx' 85 | 86 | # If true, `todo` and `todoList` produce output, else they produce nothing. 87 | todo_include_todos = False 88 | 89 | 90 | # -- Options for HTML output ---------------------------------------------- 91 | 92 | # The theme to use for HTML and HTML Help pages. See the documentation for 93 | # a list of builtin themes. 94 | # 95 | # html_theme = 'alabaster' 96 | 97 | # Theme options are theme-specific and customize the look and feel of a theme 98 | # further. For a list of options available for each theme, see the 99 | # documentation. 100 | # 101 | # html_theme_options = {} 102 | 103 | # Add any paths that contain custom static files (such as style sheets) here, 104 | # relative to this directory. They are copied after the builtin static files, 105 | # so a file named "default.css" will overwrite the builtin "default.css". 106 | html_static_path = ['_static'] 107 | 108 | # Custom sidebar templates, must be a dictionary that maps document names 109 | # to template names. 110 | # 111 | # This is required for the alabaster theme 112 | # refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars 113 | html_sidebars = { 114 | '**': [ 115 | 'relations.html', # needs 'show_related': True theme option to display 116 | 'searchbox.html', 117 | ] 118 | } 119 | 120 | 121 | # -- Options for HTMLHelp output ------------------------------------------ 122 | 123 | # Output file base name for HTML help builder. 124 | htmlhelp_basename = 'GSLRdoc' 125 | 126 | 127 | # -- Options for LaTeX output --------------------------------------------- 128 | 129 | latex_elements = { 130 | # The paper size ('letterpaper' or 'a4paper'). 131 | # 132 | # 'papersize': 'letterpaper', 133 | 134 | # The font size ('10pt', '11pt' or '12pt'). 135 | # 136 | # 'pointsize': '10pt', 137 | 138 | # Additional stuff for the LaTeX preamble. 139 | # 140 | # 'preamble': '', 141 | 142 | # Latex figure (float) alignment 143 | # 144 | # 'figure_align': 'htbp', 145 | } 146 | 147 | # Grouping the document tree into LaTeX files. List of tuples 148 | # (source start file, target name, title, 149 | # author, documentclass [howto, manual, or own class]). 150 | latex_documents = [ 151 | (master_doc, 'GSLR.tex', 'GSLR Documentation', 152 | 'Ludwig Schmidt, Alexander LeNail', 'manual'), 153 | ] 154 | 155 | 156 | # -- Options for manual page output --------------------------------------- 157 | 158 | # One entry per manual page. List of tuples 159 | # (source start file, name, description, authors, manual section). 160 | man_pages = [ 161 | (master_doc, 'gslr', 'GSLR Documentation', 162 | [author], 1) 163 | ] 164 | 165 | 166 | # -- Options for Texinfo output ------------------------------------------- 167 | 168 | # Grouping the document tree into Texinfo files. List of tuples 169 | # (source start file, target name, title, author, 170 | # dir menu entry, description, category) 171 | texinfo_documents = [ 172 | (master_doc, 'GSLR', 'GSLR Documentation', 173 | author, 'GSLR', 'One line description of project.', 174 | 'Miscellaneous'), 175 | ] 176 | 177 | 178 | 179 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | Graph-Sparse Logistic Regression 2 | ================================ 3 | 4 | .. automodule:: gslr 5 | :members: 6 | -------------------------------------------------------------------------------- /experiments/KEGG/KEGG_df.filtered.with_correlates.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/KEGG/KEGG_df.filtered.with_correlates.pickle -------------------------------------------------------------------------------- /experiments/KEGG/KEGG_df.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/KEGG/KEGG_df.pickle -------------------------------------------------------------------------------- /experiments/KEGG/README.md: -------------------------------------------------------------------------------- 1 | # KEGG database download and filtering 2 | 3 | `download_KEGG.ipynb` downloads the KEGG database as a dataframe. 4 | 5 | `KEGG_df.pickle` is the resulting dataframe, the version we used for our experiments. KEGG has likely been updated since, so get the newest version. However, if you'd like to reproduce our results exactly, you will need to use this older version from mid-2017. 6 | 7 | `Pathway_Curation_and_Correlates_Discovery.ipynb` filters out the metabolic pathways from `KEGG_df.pickle`, which are poorly connected in the interactomes because proteins which belong to the same metabolic pathways infrequently need to bind to one another. This notebook also appends to each pathway the top 100 correlates from our empirical data, which we never ended up using. 8 | 9 | `KEGG_df.filtered.with_correlates.pickle` is the resulting dataframe. This is the exact dataframe we used for all our experiments. 10 | 11 | -------------------------------------------------------------------------------- /experiments/README.md: -------------------------------------------------------------------------------- 1 | # Experiments with Graph-Sparse Logistic Regression 2 | 3 | ### `./KEGG` 4 | 5 | Contains notebooks we used to download and preprocess the KEGG pathway database, as well as the resulting database as a pandas dataframe. 6 | 7 | ### `./data_generation` 8 | 9 | Contains 5 semi-synthetic data generation strategies' notebooks, scripts, and explanations. 10 | 11 | ### `./generated_data` 12 | 13 | Contains the generated data in csv format. This is listed in the `.gitignore` so you likely don't see it! 14 | Please feel free to request access, or generate the data yourself via the `./data_generation` directiory. 15 | 16 | ### `./algorithms` 17 | 18 | Contains the experimental code to test each of the algorithms we tested against the generated semi-synthetic data. 19 | -------------------------------------------------------------------------------- /experiments/algorithms/README.md: -------------------------------------------------------------------------------- 1 | # Algorithmic Experiments and Benchmarks 2 | 3 | This directory contains subdirectories corresponding with each algorithmic appraoch we attempted. 4 | 5 | The two main approaches we tried were our own (GSLR) and L1-Regularized Logistic Regression ("The LASSO") from [scikit-learn](http://scikit-learn.org/). 6 | 7 | We also tried L2-regularized logistic regression, the classic PCSF setup, and the "Graph LASSO" / "Structured Regression Incorporating Graphical structure among predictors" (SRIG). 8 | 9 | -------------------------------------------------------------------------------- /experiments/algorithms/figures/easy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/figures/easy.pdf -------------------------------------------------------------------------------- /experiments/algorithms/figures/hard.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/figures/hard.pdf -------------------------------------------------------------------------------- /experiments/algorithms/figures/hsa04110_easy.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/figures/hsa04110_easy.pdf -------------------------------------------------------------------------------- /experiments/algorithms/figures/hsa04110_hard.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/figures/hsa04110_hard.pdf -------------------------------------------------------------------------------- /experiments/algorithms/gslr/gslr_gmm_results.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/gslr/gslr_gmm_results.pickle -------------------------------------------------------------------------------- /experiments/algorithms/gslr/gslr_results.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/gslr/gslr_results.pickle -------------------------------------------------------------------------------- /experiments/algorithms/gslr/ludwig/graph_proj_test.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "collapsed": true, 8 | "deletable": true, 9 | "editable": true 10 | }, 11 | "outputs": [], 12 | "source": [ 13 | "from __future__ import division\n", 14 | "from __future__ import print_function\n", 15 | "\n", 16 | "%matplotlib notebook\n", 17 | "\n", 18 | "import matplotlib.pyplot as plt\n", 19 | "import numpy as np\n", 20 | "import sys\n", 21 | "from timeit import default_timer as timer\n", 22 | "\n", 23 | "sys.path.append('/Users/ludwig/research/model_cs/cluster_model/biology_application/pcst_fast_repo')\n", 24 | "import gslr" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": 6, 30 | "metadata": { 31 | "collapsed": false, 32 | "deletable": true, 33 | "editable": true 34 | }, 35 | "outputs": [ 36 | { 37 | "name": "stdout", 38 | "output_type": "stream", 39 | "text": [ 40 | "Initial lambda_l = 7.2 lambda_r = 0.0 eps = 0.012\n", 41 | "lambda_l = 7.2 lambda_r = 0.0 lambda_m = 3.6 cur_sparsity = 1\n", 42 | "lambda_l = 3.6 lambda_r = 0.0 lambda_m = 1.8 cur_sparsity = 1\n", 43 | "lambda_l = 1.8 lambda_r = 0.0 lambda_m = 0.9 cur_sparsity = 1\n", 44 | "lambda_l = 0.9 lambda_r = 0.0 lambda_m = 0.45 cur_sparsity = 3\n", 45 | "Returning intermediate solution for lambda_m\n" 46 | ] 47 | } 48 | ], 49 | "source": [ 50 | "d = 8\n", 51 | "prizes = np.zeros(d)\n", 52 | "prizes[3] = 1.2\n", 53 | "prizes[5] = 1.0\n", 54 | "prizes[6] = 0.2\n", 55 | "edges = np.transpose(np.vstack([np.arange(d - 1), np.arange(d - 1) + 1]))\n", 56 | "\n", 57 | "n = 1000\n", 58 | "d = 10\n", 59 | "c = 4\n", 60 | "sigma = 0.8\n", 61 | "\n", 62 | "\n", 63 | "sparsity_low = 2\n", 64 | "sparsity_high = 3\n", 65 | "root = -1\n", 66 | "num_clusters = 1\n", 67 | "pruning = 'strong'\n", 68 | "verbosity_level = 1\n", 69 | "result, sol_vertices, sol_edges = gslr.graph_proj_sparsity(prizes, edges, sparsity_low, sparsity_high, root, num_clusters, pruning, verbosity_level)" 70 | ] 71 | }, 72 | { 73 | "cell_type": "code", 74 | "execution_count": 7, 75 | "metadata": { 76 | "collapsed": false, 77 | "deletable": true, 78 | "editable": true 79 | }, 80 | "outputs": [ 81 | { 82 | "data": { 83 | "text/plain": [ 84 | "array([3, 4, 5], dtype=int32)" 85 | ] 86 | }, 87 | "execution_count": 7, 88 | "metadata": {}, 89 | "output_type": "execute_result" 90 | } 91 | ], 92 | "source": [ 93 | "sol_vertices" 94 | ] 95 | }, 96 | { 97 | "cell_type": "code", 98 | "execution_count": 8, 99 | "metadata": { 100 | "collapsed": false, 101 | "deletable": true, 102 | "editable": true 103 | }, 104 | "outputs": [ 105 | { 106 | "data": { 107 | "text/plain": [ 108 | "array([4, 3], dtype=int32)" 109 | ] 110 | }, 111 | "execution_count": 8, 112 | "metadata": {}, 113 | "output_type": "execute_result" 114 | } 115 | ], 116 | "source": [ 117 | "sol_edges" 118 | ] 119 | }, 120 | { 121 | "cell_type": "code", 122 | "execution_count": 9, 123 | "metadata": { 124 | "collapsed": false, 125 | "deletable": true, 126 | "editable": true 127 | }, 128 | "outputs": [ 129 | { 130 | "data": { 131 | "text/plain": [ 132 | "array([ 0. , 0. , 0. , 1.2, 0. , 1. , 0. , 0. ])" 133 | ] 134 | }, 135 | "execution_count": 9, 136 | "metadata": {}, 137 | "output_type": "execute_result" 138 | } 139 | ], 140 | "source": [ 141 | "result" 142 | ] 143 | }, 144 | { 145 | "cell_type": "code", 146 | "execution_count": null, 147 | "metadata": { 148 | "collapsed": true, 149 | "deletable": true, 150 | "editable": true 151 | }, 152 | "outputs": [], 153 | "source": [] 154 | } 155 | ], 156 | "metadata": { 157 | "kernelspec": { 158 | "display_name": "Python 3", 159 | "language": "python", 160 | "name": "python3" 161 | }, 162 | "language_info": { 163 | "codemirror_mode": { 164 | "name": "ipython", 165 | "version": 3 166 | }, 167 | "file_extension": ".py", 168 | "mimetype": "text/x-python", 169 | "name": "python", 170 | "nbconvert_exporter": "python", 171 | "pygments_lexer": "ipython3", 172 | "version": "3.6.1" 173 | } 174 | }, 175 | "nbformat": 4, 176 | "nbformat_minor": 1 177 | } 178 | -------------------------------------------------------------------------------- /experiments/algorithms/gslr/ludwig/softmax_test.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "code", 5 | "execution_count": 1, 6 | "metadata": { 7 | "collapsed": true, 8 | "deletable": true, 9 | "editable": true 10 | }, 11 | "outputs": [], 12 | "source": [ 13 | "from __future__ import division\n", 14 | "from __future__ import print_function\n", 15 | "\n", 16 | "%matplotlib notebook\n", 17 | "\n", 18 | "import matplotlib.pyplot as plt\n", 19 | "import numpy as np\n", 20 | "from timeit import default_timer as timer\n", 21 | "\n", 22 | "import tensorflow as tf\n", 23 | "\n", 24 | "import gslr" 25 | ] 26 | }, 27 | { 28 | "cell_type": "code", 29 | "execution_count": 4, 30 | "metadata": { 31 | "collapsed": false, 32 | "deletable": true, 33 | "editable": true 34 | }, 35 | "outputs": [ 36 | { 37 | "name": "stdout", 38 | "output_type": "stream", 39 | "text": [ 40 | "Time to compute gradient: 0.000478029251099 seconds\n", 41 | "Time to run session: 0.0264229774475 seconds\n", 42 | "Equal: True\n" 43 | ] 44 | } 45 | ], 46 | "source": [ 47 | "n = 100\n", 48 | "d = 20\n", 49 | "c = 10\n", 50 | "X = np.random.randn(n, d)\n", 51 | "y = np.random.choice(c, n)\n", 52 | "W = np.random.randn(c, d)\n", 53 | "\n", 54 | "start = timer()\n", 55 | "G = gslr.softmax_gradient(X, y, W)\n", 56 | "end = timer()\n", 57 | "print('Time to compute gradient: {} seconds'.format(end - start))\n", 58 | "\n", 59 | "X_tf = tf.placeholder(tf.float64, shape=[n, d])\n", 60 | "y_tf = tf.placeholder(tf.int64, shape=[n])\n", 61 | "W_tf = tf.placeholder(tf.float64, shape=[c, d])\n", 62 | "loss = tf.reduce_mean(tf.nn.sparse_softmax_cross_entropy_with_logits(labels=y_tf, logits=tf.matmul(X_tf, W_tf, transpose_b=True)))\n", 63 | "grad = tf.gradients(loss, W_tf)\n", 64 | "sess = tf.Session()\n", 65 | "\n", 66 | "start = timer()\n", 67 | "G_tf, = sess.run(grad, feed_dict={X_tf: X, y_tf: y, W_tf: W})\n", 68 | "end = timer()\n", 69 | "print('Time to run session: {} seconds'.format(end - start))\n", 70 | "\n", 71 | "#print('G:')\n", 72 | "#print(G)\n", 73 | "#print('G_tf:')\n", 74 | "#print(G_tf)\n", 75 | "print('Equal: {}'.format(np.allclose(G, G_tf)))" 76 | ] 77 | }, 78 | { 79 | "cell_type": "code", 80 | "execution_count": 5, 81 | "metadata": { 82 | "collapsed": false, 83 | "deletable": true, 84 | "editable": true 85 | }, 86 | "outputs": [ 87 | { 88 | "name": "stdout", 89 | "output_type": "stream", 90 | "text": [ 91 | "Time to compute loss: 0.000304937362671 seconds\n", 92 | "Time to run session: 0.00139713287354 seconds\n", 93 | "Equal: True\n" 94 | ] 95 | } 96 | ], 97 | "source": [ 98 | "start = timer()\n", 99 | "loss_own = gslr.softmax_loss(X, y, W)\n", 100 | "end = timer()\n", 101 | "print('Time to compute loss: {} seconds'.format(end - start))\n", 102 | "\n", 103 | "start = timer()\n", 104 | "loss_tf = sess.run(loss, feed_dict={X_tf: X, y_tf: y, W_tf: W})\n", 105 | "end = timer()\n", 106 | "print('Time to run session: {} seconds'.format(end - start))\n", 107 | "\n", 108 | "#print('loss: {}'.format(loss_own))\n", 109 | "#print('loss_tf: {}'.format(loss_tf))\n", 110 | "print('Equal: {}'.format(np.allclose(loss_own, loss_tf)))" 111 | ] 112 | }, 113 | { 114 | "cell_type": "code", 115 | "execution_count": null, 116 | "metadata": { 117 | "collapsed": true, 118 | "deletable": true, 119 | "editable": true 120 | }, 121 | "outputs": [], 122 | "source": [] 123 | } 124 | ], 125 | "metadata": { 126 | "kernelspec": { 127 | "display_name": "Python 3", 128 | "language": "python", 129 | "name": "python3" 130 | }, 131 | "language_info": { 132 | "codemirror_mode": { 133 | "name": "ipython", 134 | "version": 3 135 | }, 136 | "file_extension": ".py", 137 | "mimetype": "text/x-python", 138 | "name": "python", 139 | "nbconvert_exporter": "python", 140 | "pygments_lexer": "ipython3", 141 | "version": "3.6.1" 142 | } 143 | }, 144 | "nbformat": 4, 145 | "nbformat_minor": 1 146 | } 147 | -------------------------------------------------------------------------------- /experiments/algorithms/gslr/medullo_coefs.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/gslr/medullo_coefs.pickle -------------------------------------------------------------------------------- /experiments/algorithms/gslr/ovarian_coefs.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/gslr/ovarian_coefs.pickle -------------------------------------------------------------------------------- /experiments/algorithms/gslr/real_data.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB 4 | #SBATCH --job-name=GSLR_GMM_PR 5 | #SBATCH --output=/scratch/users/lenail/gslr/experiments/algorithms/gslr/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 16 | sys.path.append(os.getcwd()) 17 | 18 | # get number of cpus available to job 19 | try: 20 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 21 | except KeyError: 22 | n_cpus = multiprocessing.cpu_count() 23 | 24 | # ACTUAL APPLICATION LOGIC 25 | 26 | import sys 27 | import pickle 28 | import numpy as np 29 | import pandas as pd 30 | import networkx as nx 31 | 32 | from sklearn.preprocessing import LabelEncoder 33 | 34 | from matplotlib_venn import venn3, venn3_circles, venn2 35 | 36 | repo_path = '/scratch/users/lenail/gslr/' 37 | interactome_path = repo_path + 'experiments/algorithms/pcsf/inbiomap_temp.tsv' 38 | 39 | sys.path.append(repo_path + 'gslr/') 40 | import gslr 41 | 42 | 43 | 44 | ### V. Graph-Sparse Logistic Regression 45 | 46 | def GSLR(X, y) 47 | 48 | d = len(nodes) 49 | c = 2 50 | 51 | graph_opts = gslr.GraphOptions(edges=edges, root=-1, num_clusters=1, pruning='strong') 52 | 53 | sparsity_low = 150 54 | sparsity_high = 400 55 | 56 | verbosity_level = 1 57 | 58 | num_steps = 100 59 | possible_steps = np.array([0.03, 0.1, 0.3]) 60 | steps = np.tile(possible_steps, (num_steps, 1)) 61 | 62 | W0 = np.zeros((c, d)) 63 | 64 | W_hat, losses = gslr.gslr(X, y, W0, sparsity_low, sparsity_high, graph_opts, steps, verbosity_level, edge_costs=inbiomap_experimentally.cost.values, edge_costs_multiplier=6) 65 | 66 | yhat = gslr.predict(X, W_hat) 67 | num_cor = gslr.num_correct(y, yhat) 68 | 69 | return num_cor, W_hat, losses 70 | 71 | 72 | if __name__ == "__main__": 73 | 74 | 75 | ### I. Load Ovarian Cancer Proteomics Dataset 76 | 77 | # medullo = pd.read_csv('/Users/alex/Documents/proteomics/data_preparation/proteomics_data/medullo_inbiomap_exp.tsv', index_col=0) 78 | dataset = pd.read_csv('/Users/alex/Documents/proteomics/data_preparation/proteomics_data/ovarian_inbiomap_exp.tsv', index_col=0) 79 | # brca = pd.read_csv('/Users/alex/Documents/proteomics/data_preparation/proteomics_data/brca_inbiomap_exp.tsv', index_col=0) 80 | 81 | # medullo_labels = pd.read_csv('/Users/alex/Documents/proteomics/data_preparation/proteomics_data/raw/medullo_labels.csv', index_col=0) 82 | labels = pd.read_csv('/Users/alex/Documents/proteomics/data_preparation/proteomics_data/raw/ovarian_labels.csv', index_col=0) 83 | # brca_labels = pd.read_csv('/Users/alex/Documents/proteomics/data_preparation/proteomics_data/raw/brca_labels.csv', index_col=0) 84 | 85 | 86 | ### II. Load Interactome 87 | 88 | inbiomap_experimentally = pd.read_csv(interactome_path, sep='\t', names=['protein1','protein2','cost']) 89 | inbiomap_experimentally.head() 90 | 91 | 92 | (edges, nodes) = pd.factorize(inbiomap_experimentally[["protein1","protein2"]].unstack()) 93 | edges = edges.reshape(inbiomap_experimentally[["protein1","protein2"]].shape, order='F') 94 | 95 | 96 | ### IV. Prepare Dataset 97 | 98 | dataset = dataset.transpose().reindex(index=nodes).transpose() 99 | X = dataset.values 100 | 101 | 102 | labels = labels.values.flatten().tolist() 103 | 104 | 105 | labeler = LabelEncoder() 106 | labeler.fit(labels) 107 | y = labeler.transform(labels) 108 | 109 | 110 | 111 | 112 | 113 | -------------------------------------------------------------------------------- /experiments/algorithms/gslr/run_GSLR.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=GSLR 5 | #SBATCH --output=/home/lenail/gslr/experiments/algorithms/gslr/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | import pickle 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | import numpy as np 29 | import pandas as pd 30 | from sklearn.preprocessing import LabelEncoder 31 | from sklearn.model_selection import StratifiedKFold 32 | # from sklearn.model_selection import train_test_split, cross_val_score, KFold 33 | 34 | sys.path.append('/home/lenail/gslr/gslr') 35 | import gslr 36 | 37 | def GSLR(pathway_id_and_filepath_and_nodes_and_edges_and_costs): 38 | 39 | pathway_id, filepath, nodes, edges, costs = pathway_id_and_filepath_and_nodes_and_edges_and_costs 40 | 41 | # we had done dataset.to_csv(filename, index=True, header=True) 42 | dataset = pd.read_csv(filepath, index_col=0) 43 | y = LabelEncoder().fit_transform(dataset.index.tolist()) 44 | 45 | dataset = dataset.transpose().reindex(index=nodes).transpose() 46 | X = dataset.values 47 | 48 | d = len(nodes) 49 | c = 2 50 | 51 | graph_opts = gslr.GraphOptions(edges=edges, root=-1, num_clusters=1, pruning='strong') 52 | 53 | sparsity_low = 50 54 | sparsity_high = 100 55 | 56 | verbosity_level = 0 57 | 58 | num_steps = 35 59 | possible_steps = np.array([0.03,0.1,0.3]) 60 | steps = np.tile(possible_steps, (num_steps, 1)) 61 | 62 | features = [] 63 | accuracies = [] 64 | 65 | for train, test in StratifiedKFold(n_splits=10).split(X, y): 66 | 67 | W0 = np.zeros((c, d)) 68 | 69 | W_hat, losses = gslr.gslr(X[train], y[train], W0, sparsity_low, sparsity_high, graph_opts, steps, verbosity_level, edge_costs=costs, edge_costs_multiplier=2) 70 | 71 | yhat = gslr.predict(X[test], W_hat) 72 | num_cor = gslr.num_correct(y[test], yhat) 73 | accuracy = num_cor / float(len(test)) 74 | 75 | features.append(W_hat[0]) 76 | accuracies.append(accuracy) 77 | 78 | features = pd.DataFrame(features, columns=dataset.columns) 79 | features = features.columns[(features != 0).any()].tolist() 80 | 81 | return pathway_id, accuracies, features 82 | 83 | 84 | if __name__ == "__main__": 85 | 86 | repo_path = '/home/lenail/gslr/experiments/' 87 | data_path = repo_path + 'generated_data/3/' 88 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 89 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 90 | pathways_df = pd.read_pickle(KEGG_path) 91 | 92 | inbiomap_experimentally = pd.read_csv(interactome_path, sep='\t', names=['protein1','protein2','cost']) 93 | (edges, nodes) = pd.factorize(inbiomap_experimentally[["protein1","protein2"]].unstack()) 94 | edges = edges.reshape(inbiomap_experimentally[["protein1","protein2"]].shape, order='F') 95 | costs = inbiomap_experimentally.cost.values 96 | 97 | inputs = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv', nodes, edges, costs) for pathway_id in pathways_df.index.get_level_values(2)] 98 | 99 | pool = multiprocessing.Pool(n_cpus) 100 | 101 | results = pool.map(GSLR, inputs) 102 | 103 | pickle.dump(results, open('gslr_results.pickle', 'wb')) 104 | 105 | 106 | 107 | 108 | 109 | 110 | -------------------------------------------------------------------------------- /experiments/algorithms/gslr/run_gslr_gmm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=GSLR_GMM 5 | #SBATCH --output=/home/lenail/gslr/experiments/algorithms/gslr/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | import pickle 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | import numpy as np 29 | import pandas as pd 30 | from sklearn.preprocessing import LabelEncoder 31 | from sklearn.model_selection import StratifiedKFold 32 | # from sklearn.model_selection import train_test_split, cross_val_score, KFold 33 | 34 | sys.path.append('/home/lenail/gslr/gslr') 35 | import gslr 36 | 37 | def GSLR(pathway_id_and_filepath_and_nodes_and_edges_and_costs): 38 | 39 | pathway_id, filepath, nodes, edges, costs = pathway_id_and_filepath_and_nodes_and_edges_and_costs 40 | 41 | # we had done dataset.to_csv(filename, index=True, header=True) 42 | dataset = pd.read_csv(filepath, index_col=0) 43 | y = LabelEncoder().fit_transform(dataset.index.tolist()) 44 | 45 | dataset = dataset.transpose().reindex(index=nodes).transpose() 46 | X = dataset.values 47 | 48 | d = len(nodes) 49 | c = 2 50 | 51 | graph_opts = gslr.GraphOptions(edges=edges, root=-1, num_clusters=1, pruning='strong') 52 | 53 | sparsity_low = 50 54 | sparsity_high = 100 55 | 56 | verbosity_level = 0 57 | 58 | num_steps = 35 59 | possible_steps = np.array([0.03,0.1,0.3]) 60 | steps = np.tile(possible_steps, (num_steps, 1)) 61 | 62 | features = [] 63 | accuracies = [] 64 | 65 | for train, test in StratifiedKFold(n_splits=10).split(X, y): 66 | 67 | W0 = np.zeros((c, d)) 68 | 69 | W_hat, losses = gslr.gslr(X[train], y[train], W0, sparsity_low, sparsity_high, graph_opts, steps, verbosity_level, edge_costs=costs, edge_costs_multiplier=2) 70 | 71 | yhat = gslr.predict(X[test], W_hat) 72 | num_cor = gslr.num_correct(y[test], yhat) 73 | accuracy = num_cor / float(len(test)) 74 | 75 | features.append(W_hat[0]) 76 | accuracies.append(accuracy) 77 | 78 | features = pd.DataFrame(features, columns=dataset.columns) 79 | features = features.columns[(features != 0).any()].tolist() 80 | 81 | return pathway_id, accuracies, features 82 | 83 | 84 | if __name__ == "__main__": 85 | 86 | repo_path = '/home/lenail/gslr/experiments/' 87 | data_path = repo_path + 'generated_data/4/' 88 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 89 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 90 | pathways_df = pd.read_pickle(KEGG_path) 91 | 92 | inbiomap_experimentally = pd.read_csv(interactome_path, sep='\t', names=['protein1','protein2','cost']) 93 | (edges, nodes) = pd.factorize(inbiomap_experimentally[["protein1","protein2"]].unstack()) 94 | edges = edges.reshape(inbiomap_experimentally[["protein1","protein2"]].shape, order='F') 95 | costs = inbiomap_experimentally.cost.values 96 | 97 | inputs = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv', nodes, edges, costs) for pathway_id in pathways_df.index.get_level_values(2)] 98 | 99 | pool = multiprocessing.Pool(n_cpus) 100 | results = pool.map(GSLR, inputs) 101 | 102 | pickle.dump(results, open('gslr_gmm_results.pickle', 'wb')) 103 | 104 | 105 | 106 | 107 | 108 | 109 | -------------------------------------------------------------------------------- /experiments/algorithms/gslr/run_gslr_gmm_pr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB 4 | #SBATCH --job-name=GSLR_GMM_PR 5 | #SBATCH --output=/scratch/users/lenail/gslr/experiments/algorithms/gslr/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | import pickle 16 | from itertools import product 17 | 18 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 19 | sys.path.append(os.getcwd()) 20 | 21 | # get number of cpus available to job 22 | try: 23 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 24 | except KeyError: 25 | n_cpus = multiprocessing.cpu_count() 26 | 27 | # ACTUAL APPLICATION LOGIC 28 | 29 | import numpy as np 30 | import pandas as pd 31 | from sklearn.preprocessing import LabelEncoder 32 | from sklearn.model_selection import StratifiedKFold 33 | # from sklearn.model_selection import train_test_split, cross_val_score, KFold 34 | 35 | sys.path.append('/home/lenail/gslr/gslr') 36 | import gslr 37 | 38 | def GSLR(pathway_id_and_filepath_and_nodes_and_edges_and_costs_and_low_and_high): 39 | 40 | pathway_id, filepath, nodes, edges, costs, sparsity_low, sparsity_high = pathway_id_and_filepath_and_nodes_and_edges_and_costs_and_low_and_high 41 | 42 | print() 43 | print('-----------------') 44 | print(pathway_id) 45 | print(str(sparsity_low)+'-'+str(sparsity_high)) 46 | print() 47 | 48 | # we had done dataset.to_csv(filename, index=True, header=True) 49 | dataset = pd.read_csv(filepath, index_col=0) 50 | y = LabelEncoder().fit_transform(dataset.index.tolist()) 51 | 52 | dataset = dataset.transpose().reindex(index=nodes).transpose() 53 | X = dataset.values 54 | 55 | d = len(nodes) 56 | c = 2 57 | 58 | graph_opts = gslr.GraphOptions(edges=edges, root=-1, num_clusters=1, pruning='strong') 59 | 60 | verbosity_level = 1 61 | 62 | num_steps = 35 63 | possible_steps = np.array([0.03,0.1,0.3]) 64 | steps = np.tile(possible_steps, (num_steps, 1)) 65 | 66 | featuresets = [] 67 | accuracies = [] 68 | 69 | for train, test in StratifiedKFold(n_splits=10).split(X, y): 70 | 71 | print() 72 | print('fold') 73 | print() 74 | 75 | W0 = np.zeros((c, d)) 76 | 77 | W_hat, losses = gslr.gslr(X[train], y[train], W0, sparsity_low, sparsity_high, graph_opts, steps, verbosity_level, edge_costs=costs, edge_costs_multiplier=2) 78 | 79 | yhat = gslr.predict(X[test], W_hat) 80 | num_cor = gslr.num_correct(y[test], yhat) 81 | accuracy = num_cor / float(len(test)) 82 | accuracies.append(accuracy) 83 | 84 | features = pd.DataFrame(W_hat, columns=dataset.columns) 85 | features = features.columns[(features != 0).any()].tolist() 86 | featuresets.append(features) 87 | 88 | 89 | return pathway_id, (sparsity_low, sparsity_high), accuracies, featuresets 90 | 91 | 92 | if __name__ == "__main__": 93 | 94 | repo_path = '/scratch/users/lenail/gslr/experiments/' 95 | data_path = repo_path + 'generated_data/4/' 96 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 97 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 98 | pathways_df = pd.read_pickle(KEGG_path) 99 | 100 | inbiomap_experimentally = pd.read_csv(interactome_path, sep='\t', names=['protein1','protein2','cost']) 101 | (edges, nodes) = pd.factorize(inbiomap_experimentally[["protein1","protein2"]].unstack()) 102 | edges = edges.reshape(inbiomap_experimentally[["protein1","protein2"]].shape, order='F') 103 | costs = inbiomap_experimentally.cost.values 104 | 105 | lows_and_highs = [(0, 100),(50, 200),(150, 300),(250, 500),(500, 1500)] 106 | 107 | inputs = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv', nodes, edges, costs, low, high) for pathway_id, (low, high) in product(pathways_df.index.get_level_values(2)[220:], lows_and_highs)] 108 | 109 | pool = multiprocessing.Pool(n_cpus) 110 | 111 | results = pool.map(GSLR, inputs) 112 | 113 | pickle.dump(results, open('/scratch/users/lenail/results/gslr_gmm_pr_results_220_229.pickle', 'wb')) 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | -------------------------------------------------------------------------------- /experiments/algorithms/gslr/run_gslr_pr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB 4 | #SBATCH --job-name=GSLR_PR 5 | #SBATCH --output=/scratch/users/lenail/gslr/experiments/algorithms/gslr/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | #SBATCH --time=40:00:00 10 | 11 | 12 | import multiprocessing 13 | import sys 14 | import os 15 | 16 | import pickle 17 | from itertools import product 18 | 19 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 20 | sys.path.append(os.getcwd()) 21 | 22 | # get number of cpus available to job 23 | try: 24 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 25 | except KeyError: 26 | n_cpus = multiprocessing.cpu_count() 27 | 28 | # ACTUAL APPLICATION LOGIC 29 | 30 | import numpy as np 31 | import pandas as pd 32 | from sklearn.preprocessing import LabelEncoder 33 | from sklearn.model_selection import StratifiedKFold 34 | # from sklearn.model_selection import train_test_split, cross_val_score, KFold 35 | 36 | sys.path.append('/home/lenail/gslr/gslr') 37 | import gslr 38 | 39 | def GSLR(pathway_id_and_filepath_and_nodes_and_edges_and_costs_and_low_and_high): 40 | 41 | pathway_id, filepath, nodes, edges, costs, sparsity_low, sparsity_high = pathway_id_and_filepath_and_nodes_and_edges_and_costs_and_low_and_high 42 | 43 | print() 44 | print('-----------------') 45 | print(pathway_id) 46 | print(str(sparsity_low)+'-'+str(sparsity_high)) 47 | print() 48 | 49 | # we had done dataset.to_csv(filename, index=True, header=True) 50 | dataset = pd.read_csv(filepath, index_col=0) 51 | y = LabelEncoder().fit_transform(dataset.index.tolist()) 52 | 53 | dataset = dataset.transpose().reindex(index=nodes).transpose() 54 | X = dataset.values 55 | 56 | d = len(nodes) 57 | c = 2 58 | 59 | graph_opts = gslr.GraphOptions(edges=edges, root=-1, num_clusters=1, pruning='strong') 60 | 61 | verbosity_level = 1 62 | 63 | num_steps = 20 64 | possible_steps = np.array([0.03,0.1,0.3]) 65 | steps = np.tile(possible_steps, (num_steps, 1)) 66 | 67 | featuresets = [] 68 | accuracies = [] 69 | 70 | for train, test in StratifiedKFold(n_splits=10).split(X, y): 71 | 72 | print() 73 | print('fold') 74 | print() 75 | 76 | W0 = np.zeros((c, d)) 77 | 78 | W_hat, losses = gslr.gslr(X[train], y[train], W0, sparsity_low, sparsity_high, graph_opts, steps, verbosity_level, edge_costs=costs, edge_costs_multiplier=2) 79 | 80 | yhat = gslr.predict(X[test], W_hat) 81 | num_cor = gslr.num_correct(y[test], yhat) 82 | accuracy = num_cor / float(len(test)) 83 | accuracies.append(accuracy) 84 | 85 | features = pd.DataFrame(W_hat, columns=dataset.columns) 86 | features = features.columns[(features != 0).any()].tolist() 87 | featuresets.append(features) 88 | 89 | 90 | return pathway_id, (sparsity_low, sparsity_high), accuracies, featuresets 91 | 92 | 93 | if __name__ == "__main__": 94 | 95 | repo_path = '/scratch/users/lenail/gslr/experiments/' 96 | data_path = repo_path + 'generated_data/3/' 97 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 98 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 99 | pathways_df = pd.read_pickle(KEGG_path) 100 | 101 | inbiomap_experimentally = pd.read_csv(interactome_path, sep='\t', names=['protein1','protein2','cost']) 102 | (edges, nodes) = pd.factorize(inbiomap_experimentally[["protein1","protein2"]].unstack()) 103 | edges = edges.reshape(inbiomap_experimentally[["protein1","protein2"]].shape, order='F') 104 | costs = inbiomap_experimentally.cost.values 105 | 106 | lows_and_highs = [(0, 100),(50, 200),(150, 300),(250, 500),(500, 1500)] 107 | 108 | inputs = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv', nodes, edges, costs, low, high) for pathway_id, (low, high) in product(pathways_df.index.get_level_values(2)[220:], lows_and_highs)] 109 | 110 | pool = multiprocessing.Pool(n_cpus) 111 | 112 | results = pool.map(GSLR, inputs) 113 | 114 | pickle.dump(results, open('/scratch/users/lenail/results/gslr_pr_results_220_229.pickle', 'wb')) 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | -------------------------------------------------------------------------------- /experiments/algorithms/gslr/run_xor_GSLR.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=XORGSLR 5 | #SBATCH --output=/home/lenail/gslr/experiments/algorithms/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | import pickle 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | import numpy as np 29 | import pandas as pd 30 | from sklearn.preprocessing import LabelEncoder 31 | from sklearn.model_selection import StratifiedKFold 32 | # from sklearn.model_selection import train_test_split, cross_val_score, KFold 33 | 34 | sys.path.append('/home/lenail/gslr/gslr') 35 | import gslr 36 | 37 | def GSLR(filepath_and_pathway_ids_and_nodes_and_edges): 38 | 39 | filepath, pathway_id_1, pathway_id_2, nodes, edges = filepath_and_pathway_ids_and_nodes_and_edges 40 | 41 | # we had done dataset.to_csv(filename, index=True, header=True) 42 | dataset = pd.read_csv(filepath, index_col=0) 43 | y = LabelEncoder().fit_transform(dataset.index.tolist()) 44 | 45 | dataset = dataset.transpose().reindex(index=nodes).transpose() 46 | X = dataset.values 47 | 48 | d = len(nodes) 49 | c = 2 50 | 51 | graph_opts = gslr.GraphOptions(edges=edges, root=-1, num_clusters=1, pruning='strong') 52 | 53 | sparsity_low = 30 54 | sparsity_high = 70 55 | 56 | verbosity_level = 0 57 | 58 | num_steps = 50 59 | possible_steps = np.array([0.1,0.2]) 60 | steps = np.tile(possible_steps, (num_steps, 1)) 61 | 62 | features = [] 63 | accuracies = [] 64 | 65 | for train, test in StratifiedKFold(n_splits=10).split(X, y): 66 | 67 | W0 = np.zeros((c, d)) 68 | 69 | W_hat, losses = gslr.gslr(X[train], y[train], W0, sparsity_low, sparsity_high, graph_opts, steps, verbosity_level) 70 | 71 | yhat = gslr.predict(X[test], W_hat) 72 | num_cor = gslr.num_correct(y[test], yhat) 73 | accuracy = num_cor / float(len(test)) 74 | 75 | features.append(W_hat[0]) 76 | accuracies.append(accuracy) 77 | 78 | features = pd.DataFrame(features, columns=dataset.columns) 79 | features = features.columns[(features != 0).any()].tolist() 80 | 81 | return pathway_id_1, pathway_id_2, accuracies, features 82 | 83 | 84 | if __name__ == "__main__": 85 | 86 | repo_path = '/home/lenail/gslr/experiments/' 87 | data_path = repo_path + 'generated_data/xor_3/' 88 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 89 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 90 | pathways_df = pd.read_pickle(KEGG_path) 91 | 92 | inbiomap_experimentally = pd.read_csv(interactome_path, sep='\t', names=['protein1','protein2','cost']) 93 | (edges, nodes) = pd.factorize(inbiomap_experimentally[["protein1","protein2"]].unstack()) 94 | edges = edges.reshape(inbiomap_experimentally[["protein1","protein2"]].shape, order='F') 95 | costs = inbiomap_experimentally.cost.values 96 | 97 | inputs = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv', nodes, edges, costs) for pathway_id in pathways_df.index.get_level_values(2)] 98 | 99 | pool = multiprocessing.Pool(n_cpus) 100 | results = pool.map(GSLR, files) 101 | 102 | pickle.dump(results, open('xor_gslr_results.pickle', 'wb')) 103 | 104 | 105 | -------------------------------------------------------------------------------- /experiments/algorithms/logit/logit_gmm_results.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/logit/logit_gmm_results.pickle -------------------------------------------------------------------------------- /experiments/algorithms/logit/logit_results.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/logit/logit_results.pickle -------------------------------------------------------------------------------- /experiments/algorithms/logit/run_logit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=LOGIT 5 | #SBATCH --output=/home/lenail/gslr/experiments/algorithms/logit/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | import pickle 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | from itertools import combinations 29 | import numpy as np 30 | import pandas as pd 31 | import networkx as nx 32 | from sklearn.linear_model import LogisticRegressionCV 33 | 34 | 35 | def logit(pathway_id_and_filepath): 36 | 37 | pathway_id, filepath = pathway_id_and_filepath 38 | 39 | # we had done dataset.to_csv(filename, index=True, header=True) 40 | dataset = pd.read_csv(filepath, index_col=0) 41 | labels = dataset.index.tolist() 42 | 43 | classifier = LogisticRegressionCV(solver='liblinear', penalty='l1', Cs=[5], cv=10) 44 | classifier.fit(dataset.values, labels) 45 | features = pd.DataFrame(classifier.coef_, columns=dataset.columns) 46 | features = features.ix[0, features.loc[0].nonzero()[0].tolist()].index.tolist() 47 | scores = list(classifier.scores_.values()) 48 | 49 | return pathway_id, scores, features 50 | 51 | 52 | if __name__ == "__main__": 53 | 54 | repo_path = '/home/lenail/gslr/experiments/' 55 | data_path = repo_path + 'generated_data/3/' 56 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 57 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 58 | pathways_df = pd.read_pickle(KEGG_path) 59 | 60 | files = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv') for pathway_id in pathways_df.index.get_level_values(2)] 61 | 62 | pool = multiprocessing.Pool(n_cpus) 63 | 64 | results = pool.map(logit, files) 65 | 66 | pickle.dump(results, open('logit_results.pickle', 'wb')) 67 | 68 | -------------------------------------------------------------------------------- /experiments/algorithms/logit/run_logit_gmm.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=LOGIT_GMM 5 | #SBATCH --output=/home/lenail/gslr/experiments/algorithms/logit/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | import pickle 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | from itertools import combinations 29 | import numpy as np 30 | import pandas as pd 31 | import networkx as nx 32 | from sklearn.linear_model import LogisticRegressionCV 33 | 34 | 35 | def logit(pathway_id_and_filepath): 36 | 37 | pathway_id, filepath = pathway_id_and_filepath 38 | 39 | # we had done dataset.to_csv(filename, index=True, header=True) 40 | dataset = pd.read_csv(filepath, index_col=0) 41 | labels = dataset.index.tolist() 42 | 43 | classifier = LogisticRegressionCV(solver='liblinear', penalty='l1', Cs=[5], cv=10) 44 | classifier.fit(dataset.values, labels) 45 | features = pd.DataFrame(classifier.coef_, columns=dataset.columns) 46 | features = features.ix[0, features.loc[0].nonzero()[0].tolist()].index.tolist() 47 | scores = list(classifier.scores_.values()) 48 | 49 | # features = coefs[coefs != 0].dropna(axis=1, how='all').fillna(0) 50 | 51 | return pathway_id, scores, features 52 | 53 | 54 | if __name__ == "__main__": 55 | 56 | repo_path = '/home/lenail/gslr/experiments/' 57 | data_path = repo_path + 'generated_data/4/' 58 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 59 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 60 | pathways_df = pd.read_pickle(KEGG_path) 61 | 62 | files = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv') for pathway_id in pathways_df.index.get_level_values(2)] 63 | pool = multiprocessing.Pool(n_cpus) 64 | results = pool.map(logit, files) 65 | 66 | pickle.dump(results, open('logit_gmm_results.pickle', 'wb')) 67 | 68 | -------------------------------------------------------------------------------- /experiments/algorithms/logit/run_logit_gmm_pr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=LOGIT_GMM_PR 5 | #SBATCH --output=/scratch/users/lenail/gslr/experiments/algorithms/logit/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | import pickle 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | import numpy as np 29 | import pandas as pd 30 | from sklearn.linear_model import LogisticRegressionCV 31 | 32 | 33 | def logit(pathway_id_and_filepath): 34 | 35 | pathway_id, filepath = pathway_id_and_filepath 36 | 37 | # we had done dataset.to_csv(filename, index=True, header=True) 38 | dataset = pd.read_csv(filepath, index_col=0) 39 | labels = dataset.index.tolist() 40 | 41 | classifier = LogisticRegressionCV(solver='liblinear', penalty='l2', Cs=16, cv=10) 42 | classifier.fit(dataset.values, labels) 43 | scores = list(classifier.scores_.values()) 44 | 45 | # features = pd.DataFrame(W_hat, columns=dataset.columns) 46 | # features = features.columns[(features != 0).any()].tolist() 47 | 48 | return pathway_id, scores, classifier.coefs_paths_, classifier.Cs_ 49 | 50 | 51 | if __name__ == "__main__": 52 | 53 | repo_path = '/scratch/users/lenail/gslr/experiments/' 54 | data_path = repo_path + 'generated_data/4/' 55 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 56 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 57 | pathways_df = pd.read_pickle(KEGG_path) 58 | 59 | files = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv') for pathway_id in pathways_df.index.get_level_values(2)] 60 | 61 | pool = multiprocessing.Pool(n_cpus) 62 | 63 | results = pool.map(logit, files) 64 | 65 | pickle.dump(results, open('/scratch/users/lenail/results/logit_l2_gmm_pr_results.pickle', 'wb')) 66 | 67 | -------------------------------------------------------------------------------- /experiments/algorithms/logit/run_logit_pr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=LOGIT_PR 5 | #SBATCH --output=/scratch/users/lenail/gslr/experiments/algorithms/logit/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | import pickle 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | import numpy as np 29 | import pandas as pd 30 | from sklearn.linear_model import LogisticRegressionCV 31 | 32 | 33 | def logit(pathway_id_and_filepath): 34 | 35 | pathway_id, filepath = pathway_id_and_filepath 36 | 37 | # we had done dataset.to_csv(filename, index=True, header=True) 38 | dataset = pd.read_csv(filepath, index_col=0) 39 | labels = dataset.index.tolist() 40 | 41 | classifier = LogisticRegressionCV(solver='liblinear', penalty='l2', Cs=16, cv=10) 42 | classifier.fit(dataset.values, labels) 43 | scores = list(classifier.scores_.values()) 44 | 45 | # features = pd.DataFrame(W_hat, columns=dataset.columns) 46 | # features = features.columns[(features != 0).any()].tolist() 47 | 48 | return pathway_id, scores, classifier.coefs_paths_, classifier.Cs_ 49 | 50 | 51 | if __name__ == "__main__": 52 | 53 | repo_path = '/scratch/users/lenail/gslr/experiments/' 54 | data_path = repo_path + 'generated_data/3/' 55 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 56 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 57 | pathways_df = pd.read_pickle(KEGG_path) 58 | 59 | files = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv') for pathway_id in pathways_df.index.get_level_values(2)] 60 | 61 | pool = multiprocessing.Pool(n_cpus) 62 | 63 | results = pool.map(logit, files) 64 | 65 | pickle.dump(results, open('/scratch/users/lenail/results/logit_l2_pr_results.pickle', 'wb')) 66 | 67 | -------------------------------------------------------------------------------- /experiments/algorithms/logit/run_xor_logit.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=LOGIT 5 | #SBATCH --output=/home/lenail/gslr/experiments/algorithms/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | import pickle 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | from itertools import combinations 29 | import numpy as np 30 | import pandas as pd 31 | import networkx as nx 32 | from sklearn.linear_model import LogisticRegressionCV 33 | # from sklearn.preprocessing import LabelEncoder 34 | # from sklearn.model_selection import train_test_split, cross_val_score, KFold 35 | 36 | 37 | def logit(filepath_and_pathway_ids): 38 | 39 | filepath, first_pathway_id, second_pathway_id = filepath_and_pathway_ids 40 | 41 | # we had done dataset.to_csv(filename, index=True, header=True) 42 | dataset = pd.read_csv(filepath, index_col=0) 43 | labels = dataset.index.str.replace(first_pathway_id, "positive").str.replace(second_pathway_id, "positive").tolist() 44 | 45 | classifier = LogisticRegressionCV(solver='liblinear', penalty='l1', Cs=[5], cv=10) 46 | classifier.fit(dataset.values, labels) 47 | features = pd.DataFrame(classifier.coef_, columns=dataset.columns) 48 | features = features.ix[0, features.loc[0].nonzero()[0].tolist()].index.tolist() 49 | scores = list(classifier.scores_.values())[0].flatten().tolist() 50 | 51 | return first_pathway_id, second_pathway_id, scores, features 52 | 53 | # oncogenes = {subtype: ovarian_coefs.ix[subtype, ovarian_coefs.loc[subtype].nonzero()[0].tolist()].index.tolist() for subtype in ovarian_coefs.index.tolist()} 54 | # oncogenes_pairs = {subtype: list(combinations(genes, r=2)) for subtype, genes in oncogenes.items()} 55 | # path_lengths = {subtype: [nx.shortest_path_length(interactome, source=pair[0], target=pair[1]) for pair in pairs if pair[0] in interactome.nodes() and pair[1] in interactome.nodes()] for subtype, pairs in oncogenes_pairs.items()} 56 | # [pd.Series(path_lengths[subtype]).plot.hist() for subtype in path_lengths] 57 | 58 | 59 | if __name__ == "__main__": 60 | 61 | repo_path = '/home/lenail/gslr/experiments/' 62 | data_path = repo_path + 'generated_data/xor_3/' 63 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 64 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 65 | pathways_df = pd.read_pickle(KEGG_path) 66 | 67 | files = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv') for pathway_id in pathways_df.index.get_level_values(2)] 68 | 69 | pool = multiprocessing.Pool(n_cpus) 70 | results = pool.map(logit, files) 71 | 72 | pickle.dump(results, open('xor_logit_results.pickle', 'wb')) 73 | 74 | -------------------------------------------------------------------------------- /experiments/algorithms/logit/xor_logit_results.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/experiments/algorithms/logit/xor_logit_results.pickle -------------------------------------------------------------------------------- /experiments/algorithms/netreg/GX.tsv: -------------------------------------------------------------------------------- 1 | 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 2 | 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 3 | 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 4 | 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 5 | 1.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 6 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 7 | 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 1.0 0.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 8 | 0.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 9 | 1.0 1.0 1.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 10 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 11 | 1.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 12 | 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 13 | 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 14 | 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 15 | 0.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 16 | 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 1.0 0.0 1.0 0.0 1.0 0.0 1.0 0.0 17 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 1.0 0.0 18 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 19 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 20 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 21 | 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0 22 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 23 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 1.0 1.0 1.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 1.0 24 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 25 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 26 | 0.0 1.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 27 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 0.0 1.0 0.0 1.0 28 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 0.0 1.0 0.0 0.0 0.0 29 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 1.0 0.0 0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0 0.0 0.0 0.0 0.0 30 | 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 1.0 0.0 0.0 0.0 31 | -------------------------------------------------------------------------------- /experiments/algorithms/netreg/Y.tsv: -------------------------------------------------------------------------------- 1 | 1.0 2 | 1.0 3 | 1.0 4 | 1.0 5 | 1.0 6 | 1.0 7 | 1.0 8 | 1.0 9 | 1.0 10 | 1.0 11 | 1.0 12 | 1.0 13 | 1.0 14 | 1.0 15 | 1.0 16 | 1.0 17 | 1.0 18 | 1.0 19 | 1.0 20 | 1.0 21 | 0.0 22 | 0.0 23 | 0.0 24 | 0.0 25 | 0.0 26 | 0.0 27 | 0.0 28 | 0.0 29 | 0.0 30 | 0.0 31 | 0.0 32 | 0.0 33 | 0.0 34 | 0.0 35 | 0.0 36 | 0.0 37 | 0.0 38 | 0.0 39 | 0.0 40 | 0.0 41 | -------------------------------------------------------------------------------- /experiments/algorithms/netreg/netreg.sh: -------------------------------------------------------------------------------- 1 | # netReg - a network-regularized generalized regression model 2 | 3 | # Arguments: 4 | # -h [ --help ] Print this help. 5 | # -d [ --design ] arg Filename of the design matrix X. 6 | # -u [ --gx ] arg Filename of the affinity matrix GX for X. 7 | # -r [ --reponse ] arg Filename of the reponse matrix Y. 8 | # -v [ --gy ] arg Filename of the affinity matrix GY for Y. 9 | # -l [ --lambda ] arg (=1) LASSO penalization parameter. 10 | # -s [ --psi ] arg (=0) Penalization parameter for affinity matrix GX. 11 | # -x [ --xi ] arg (=0) Penalization parameter for affinity matrix GY. 12 | # -m [ --maxit ] arg (=100000) Maximum number of iterations of coordinate descent. You should choose a sufficiently large number. 13 | # -t [ --threshold ] arg (=0.0000001) Convergence threshold for coordinate descent. Anything below 0.0001 should suffice. 14 | # -o [ --outfile ] arg Filename of the output file. 15 | 16 | # Model selection: 17 | # --modelselection Use modelselection, i.e. estimation of optimal shrinkage parameters using crossvalition, before doing the estimation of coefficients. 18 | # -n [ --nfolds ] arg (=10) The number of cross-validation folds. This can be maximal the number of rows of X/Y and minimal 3. 19 | # -e [ --epsilon ] arg (=0.001) Convergence threshold for the BOBYQA algorithm, i.e. the stop criterion for the model selection. 20 | # -b [ --bobit ] arg (=1000) Maximal number of iterations for the BOBYQA algorithm. 21 | 22 | 23 | # X.tsv: samples are rows, columns are variables 24 | # Y.tsv: samples are rows, columns are classes 25 | # GX.tsv: graph over the variables in X -- square matrix. 26 | 27 | netReg -d X.tsv -r Y.tsv -u GX.tsv -l 10 -x 1 --maxit 1000 --threshold 0.0001 -o outfile.tsv 28 | 29 | 30 | -------------------------------------------------------------------------------- /experiments/algorithms/netreg/outfile_coefficients.tsv: -------------------------------------------------------------------------------- 1 | 0.00000000000000e+00 2 | 0.00000000000000e+00 3 | 0.00000000000000e+00 4 | 3.86754250908242e-02 5 | 0.00000000000000e+00 6 | 0.00000000000000e+00 7 | 0.00000000000000e+00 8 | 0.00000000000000e+00 9 | 0.00000000000000e+00 10 | 0.00000000000000e+00 11 | 0.00000000000000e+00 12 | 0.00000000000000e+00 13 | 0.00000000000000e+00 14 | 0.00000000000000e+00 15 | 0.00000000000000e+00 16 | 0.00000000000000e+00 17 | 0.00000000000000e+00 18 | -2.27745119343753e-02 19 | -3.12356097059241e-02 20 | 0.00000000000000e+00 21 | 0.00000000000000e+00 22 | 0.00000000000000e+00 23 | 0.00000000000000e+00 24 | 0.00000000000000e+00 25 | 0.00000000000000e+00 26 | 0.00000000000000e+00 27 | 0.00000000000000e+00 28 | 0.00000000000000e+00 29 | 0.00000000000000e+00 30 | -4.44538505890046e-02 31 | -------------------------------------------------------------------------------- /experiments/algorithms/netreg/outfile_intercepts.tsv: -------------------------------------------------------------------------------- 1 | 4.47911131870002e-01 2 | -------------------------------------------------------------------------------- /experiments/algorithms/srig/Test_PyLearn_ParsimonY.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "## Try SRIG via the [PyLearn-ParsimonY](https://github.com/neurospin/pylearn-parsimony) library" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": null, 13 | "metadata": {}, 14 | "outputs": [], 15 | "source": [ 16 | "import parsimony.estimators as estimators\n", 17 | "import parsimony.algorithms as algorithms\n", 18 | "import parsimony.functions.nesterov.gl as gl\n", 19 | "k = 0.0 # l2 ridge regression coefficient\n", 20 | "l = 0.1 # l1 lasso coefficient\n", 21 | "g = 0.1 # group lasso coefficient\n", 22 | "num_ft = len(nodes)" 23 | ] 24 | }, 25 | { 26 | "cell_type": "code", 27 | "execution_count": null, 28 | "metadata": {}, 29 | "outputs": [], 30 | "source": [ 31 | "A = gl.linear_operator_from_groups(num_ft, neighborhoods)\n", 32 | "estimator = estimators.LogisticRegressionL1L2GL(\n", 33 | " k, l, g, A=A,\n", 34 | " algorithm=algorithms.proximal.FISTA(),\n", 35 | " algorithm_params=dict(max_iter=1000))\n", 36 | "res = estimator.fit(X, y)\n", 37 | "print(\"Estimated prediction rate =\", estimator.score(X, y))" 38 | ] 39 | } 40 | ], 41 | "metadata": { 42 | "kernelspec": { 43 | "display_name": "Python 3", 44 | "language": "python", 45 | "name": "python3" 46 | }, 47 | "language_info": { 48 | "codemirror_mode": { 49 | "name": "ipython", 50 | "version": 3 51 | }, 52 | "file_extension": ".py", 53 | "mimetype": "text/x-python", 54 | "name": "python", 55 | "nbconvert_exporter": "python", 56 | "pygments_lexer": "ipython3", 57 | "version": "3.7.1" 58 | } 59 | }, 60 | "nbformat": 4, 61 | "nbformat_minor": 2 62 | } 63 | -------------------------------------------------------------------------------- /experiments/algorithms/srig/run_srig_pr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=srig 5 | #SBATCH --output=/home/lenail/srig/experiments/algorithms/srig/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | import pickle 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | import numpy as np 29 | import pandas as pd 30 | import networkx as nx 31 | 32 | from sklearn.preprocessing import LabelEncoder 33 | from sklearn.model_selection import StratifiedKFold 34 | 35 | import spams 36 | import scipy.sparse as ssp 37 | 38 | 39 | def srig_predict(X, W): return np.argmax(np.dot(X, W.transpose()), axis=1) 40 | 41 | def num_correct(y1, y2): return np.count_nonzero(np.equal(y1, y2)) 42 | 43 | def SRIG(pathway_id_and_filepath_and_graph_struct_and_lambda): 44 | 45 | pathway_id, filepath, graph, lambda1 = pathway_id_and_filepath_and_graph_struct_and_lambda 46 | 47 | print() 48 | print('-----------------') 49 | print(pathway_id) 50 | print(str(sparsity_low)+'-'+str(sparsity_high)) 51 | print() 52 | 53 | # we had done dataset.to_csv(filename, index=True, header=True) 54 | dataset = pd.read_csv(filepath, index_col=0) 55 | y = LabelEncoder().fit_transform(dataset.index.tolist()) 56 | Y = np.asfortranarray(np.expand_dims(y, axis=1)).astype(float) 57 | Y = spams.normalize(Y) 58 | 59 | dataset = dataset.transpose().reindex(index=nodes).transpose() 60 | X = dataset.values 61 | X = np.asfortranarray(dataset.values).astype(float) 62 | X = spams.normalize(X) 63 | 64 | W0 = np.zeros((X.shape[1],Y.shape[1]),dtype=np.float64,order="F") 65 | 66 | features = [] 67 | accuracies = [] 68 | 69 | for train, test in StratifiedKFold(n_splits=10).split(X, y): 70 | 71 | print() 72 | print('fold') 73 | print() 74 | 75 | W0 = np.zeros((X.shape[1],Y.shape[1]),dtype=np.float64,order="F") 76 | 77 | (W, optim_info) = spams.fistaGraph(Y, X, W0, graph, loss='square', regul='graph', lambda1=lambda1, return_optim_info=True) 78 | 79 | yhat = srig_predict(X[test], W) 80 | num_cor = num_correct(y[test], yhat) 81 | accuracy = num_cor / float(len(test)) 82 | 83 | features.append(W) 84 | accuracies.append(accuracy) 85 | 86 | features = pd.DataFrame(features, columns=dataset.columns) 87 | features = features.columns[(features != 0).any()].tolist() 88 | 89 | return pathway_id, accuracies, features 90 | 91 | 92 | if __name__ == "__main__": 93 | 94 | repo_path = '/home/lenail/gslr/experiments/' 95 | data_path = repo_path + 'generated_data/3/' 96 | KEGG_path = repo_path + 'KEGG/KEGG_df.filtered.with_correlates.pickle' 97 | interactome_path = repo_path + 'algorithms/pcsf/inbiomap_temp.tsv' 98 | pathways_df = pd.read_pickle(KEGG_path) 99 | 100 | inbiomap_experimentally = pd.read_csv(interactome_path, sep='\t', names=['protein1','protein2','cost']) 101 | inbiomap_experimentally_graph = nx.from_pandas_edgelist(inbiomap_experimentally, 'protein1', 'protein2', edge_attr=True) 102 | (edges, nodes) = pd.factorize(inbiomap_experimentally[["protein1","protein2"]].unstack()) 103 | edges = edges.reshape(inbiomap_experimentally[["protein1","protein2"]].shape, order='F') 104 | 105 | neighborhoods = [[nodes.get_loc(node)]+[nodes.get_loc(neighbor) for neighbor in inbiomap_experimentally_graph.neighbors(node)] for node in nodes] 106 | num_groups = len(neighborhoods) 107 | 108 | eta_g = np.ones(num_groups) 109 | 110 | groups = scipy.sparse.csc_matrix(np.zeros((num_groups,num_groups)),dtype=np.bool) 111 | 112 | i, j = zip(*flatten([[(i, j) for j in neighbors] for i, neighbors in enumerate(neighborhoods)])) 113 | groups_var = scipy.sparse.csc_matrix((np.ones(len(i)),(i,j)),dtype=np.bool) 114 | 115 | graph = {'eta_g':eta_g,'groups':groups,'groups_var':groups_var} 116 | 117 | 118 | inputs = [(pathway_id, data_path+pathway_id+'_inbiomap_exp.csv', graph) for pathway_id in pathways_df.index.get_level_values(2)] 119 | 120 | pool = multiprocessing.Pool(n_cpus) 121 | 122 | results = pool.map(SRIG, inputs) 123 | 124 | pickle.dump(results, open('/scratch/users/lenail/results/srig_pr_results.pickle', 'wb')) 125 | 126 | 127 | 128 | 129 | 130 | 131 | -------------------------------------------------------------------------------- /experiments/data_generation/1_multivariate_normal/README.md: -------------------------------------------------------------------------------- 1 | # Synthetic Data Generation Strategy #1: "Multivariate Normal" 2 | 3 | This was our first try at generating semi-synthetic data. 4 | We went through a number of iterations, and did not use this code in the final paper. 5 | 6 | ## Outline: 7 | 8 | 1. Get means and covariance from empirical data 9 | 2. Get pathway information from KEGG. 10 | 3. Sample from multivariate normal defined by empirical data 11 | 4. For "positive" examples, shift mean values of proteins in pathway by a sample from their univariate normals in the empirical data 12 | 13 | 14 | ## Reason this did not work: 15 | 16 | With a "short, fat" (n << p) matrix with more features than examples, the covariance matrix is 17 | not positive semi-definite, which causes the data generation procedure to alternately take hours 18 | or not work at all. 19 | 20 | -------------------------------------------------------------------------------- /experiments/data_generation/1_multivariate_normal/multivariate_normal.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mit_hill 4 | #SBATCH --constraint=centos7 5 | #SBATCH --job-name=KEGG 6 | #SBATCH --output=/home/lenail/proteomics/synthetic_proteomics/multiprocess_%j.out 7 | #SBATCH -n 8 8 | #SBATCH -N 1 9 | #SBATCH --mem-per-cpu=8000 10 | 11 | 12 | import multiprocessing 13 | import sys 14 | import os 15 | 16 | from functools import partial 17 | 18 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 19 | sys.path.append(os.getcwd()) 20 | 21 | # get number of cpus available to job 22 | try: 23 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 24 | except KeyError: 25 | n_cpus = multiprocessing.cpu_count() 26 | 27 | # ACTUAL APPLICATION LOGIC 28 | 29 | import numpy as np 30 | import pandas as pd 31 | import pickle as pkl 32 | 33 | # ovarian = pd.read_csv('../data_preparation/ovarian_inbiomap_exp.tsv', index_col=0) 34 | 35 | # means = ovarian.mean(axis=0) 36 | # covariances = ovarian.cov() 37 | # variances = ovarian.var() 38 | 39 | pathways = pkl.load(open("KEGG_pathway_gene_lists.pkl", "rb")) 40 | 41 | 42 | def generate_dataset(pathway): 43 | 44 | pathway_id, pathway_genes = pathway 45 | 46 | POSITIVE_SAMPLES = 100 47 | NEGATIVE_SAMPLES = 100 48 | 49 | ovarian = pd.read_csv('../data_preparation/ovarian_inbiomap_exp.tsv', index_col=0) 50 | 51 | means = ovarian.mean(axis=0) 52 | covariances = ovarian.cov() 53 | variances = ovarian.var() 54 | 55 | print('here') 56 | 57 | new_pathway_means = pd.Series(np.random.normal(0,variances), index=variances.index)[pathway_genes].fillna(0) 58 | new_means = pd.concat([means, new_pathway_means], axis=1).fillna(0).sum(axis=1).reindex(means.index) 59 | 60 | positives = pd.DataFrame(np.random.multivariate_normal(new_means, covariances, size=POSITIVE_SAMPLES)) 61 | positives.index = [pathway_id+' positive']*len(positives) 62 | 63 | negatives = pd.DataFrame(np.random.multivariate_normal(means, covariances, size=NEGATIVE_SAMPLES)) 64 | negatives.index = [pathway_id+' negative']*len(negatives) 65 | 66 | dataset = pd.concat([positives, negatives]).sample(frac=1) # shuffle 67 | dataset.columns = ovarian.columns 68 | 69 | filename = 'synthetic_'+pathway_id+'_'+str(POSITIVE_SAMPLES)+'pos_'+str(NEGATIVE_SAMPLES)+'neg.csv' 70 | return dataset.to_csv(filename, index=True, header=True) 71 | 72 | 73 | if __name__ == "__main__": 74 | 75 | # create pool of n_cpus workers 76 | pool = multiprocessing.Pool(n_cpus) 77 | pool.map(generate_dataset, list(pathways.items())[:10]) 78 | 79 | 80 | 81 | ## APPLY FUNCTION IN PARALLEL 82 | 83 | # pool.starmap(generate_dataset_func, pathways.items()) 84 | 85 | 86 | 87 | # Greg's phone: 617 797 4664 88 | 89 | 90 | -------------------------------------------------------------------------------- /experiments/data_generation/2_independent_normals/README.md: -------------------------------------------------------------------------------- 1 | # Synthetic Data Generation Strategy #2: "Independent Normals" 2 | 3 | We briefly entertained the idea of sampling semi-synthetic data from the univariate 4 | normals for each feature in the empirical data. 5 | 6 | ## Outline: 7 | 8 | 1. Get means and variances from empirical data 9 | 2. Get pathway information from KEGG. 10 | 3. Change mean values of proteins in pathway 11 | 4. Sample from **independent normals** for each protein 12 | 13 | 14 | ## Reason this did not work: 15 | 16 | The gaussian of patient proteomics is not a perfect hypershphere. 17 | 18 | -------------------------------------------------------------------------------- /experiments/data_generation/2_independent_normals/independent_normals.py: -------------------------------------------------------------------------------- 1 | import numpy as np 2 | import pandas as pd 3 | import pickle as pkl 4 | 5 | 6 | def generate_dataset(pathway_id, pathway_genes, ovarian, POSITIVE_SAMPLES=100, NEGATIVE_SAMPLES=100): 7 | 8 | means = ovarian.mean(axis=0) 9 | variances = ovarian.var() 10 | 11 | new_pathway_means = pd.Series(np.random.normal(0,variances), index=variances.index)[pathway_genes].fillna(0) 12 | new_means = pd.concat([means, new_pathway_means], axis=1).fillna(0).sum(axis=1).reindex(means.index) 13 | 14 | positives = pd.DataFrame(np.random.normal(new_means, variances, size=(100, len(means))), columns=ovarian.columns) 15 | positives.index = [pathway_id]*len(positives) 16 | 17 | negatives = pd.DataFrame(np.random.normal(means, variances, size=(100, len(means))), columns=ovarian.columns) 18 | negatives.index = ['negative']*len(negatives) 19 | 20 | dataset = pd.concat([positives, negatives]).sample(frac=1) # shuffle 21 | 22 | filename = './independent_normals/'+pathway_id+'.csv' 23 | return dataset.to_csv(filename, index=True, header=True) 24 | 25 | 26 | if __name__ == "__main__": 27 | 28 | ovarian = pd.read_csv('../data_preparation/ovarian_inbiomap_exp.tsv', index_col=0) 29 | 30 | pathways = pkl.load(open("KEGG_pathway_gene_lists.pkl", "rb")) 31 | 32 | for pathway_id, pathway_genes in list(pathways.items())[:1]: 33 | 34 | generate_dataset(pathway_id, pathway_genes, ovarian) 35 | 36 | 37 | -------------------------------------------------------------------------------- /experiments/data_generation/3_multivariate_normal_svd_covariance/README.md: -------------------------------------------------------------------------------- 1 | # Synthetic Data Generation Strategy #3: "Multivariate Normals with the SVD trick" 2 | 3 | Ludwig developed a routine to sample from a multivariate normal without needing 4 | to invert the covariance through a clever SVD trick. This makes the original idea 5 | tractable. 6 | 7 | ## Outline: 8 | 9 | 1. Get means and covariance from empirical data 10 | 2. Get pathway information from KEGG. 11 | 3. Sample from multivariate normal defined by empirical data **via SVD trick** 12 | 4. For "positive" examples, shift mean values of proteins in pathway by a sample from their univariate normals in the empirical data 13 | 14 | ### This was one of the strategies we used in the final paper 15 | 16 | 17 | -------------------------------------------------------------------------------- /experiments/data_generation/3_multivariate_normal_svd_covariance/ludwig_svd_covariance.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=DATA_GEN1 5 | #SBATCH --output=/home/lenail/proteomics/synthetic_proteomics/data_generation/ludwig_svd_covariance/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | from functools import partial 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | import numpy as np 29 | import pandas as pd 30 | import pickle as pkl 31 | import math 32 | 33 | 34 | # data is n x d, where n is the number of samples and d the dimension 35 | def sample_cov(m, data): 36 | n, d = data.shape 37 | mean = np.mean(data, axis=0) 38 | _, S, V = np.linalg.svd((data - mean) / math.sqrt(n), full_matrices=False) 39 | randomness = np.random.randn(m, min(n, d)) 40 | return np.dot(randomness, np.dot(np.diag(S), V)) 41 | 42 | 43 | def generate_dataset(pathway_id, pathway_genes, proteomics, POSITIVE_SAMPLES=100, NEGATIVE_SAMPLES=100): 44 | 45 | print(pathway_id) 46 | 47 | means = proteomics.mean(axis=0) 48 | variances = proteomics.var(axis=0) 49 | 50 | negatives = sample_cov(100, proteomics) 51 | negatives = np.around(negatives + means.values, 6) 52 | negatives = pd.DataFrame(negatives, columns=proteomics.columns, index=['negative']*100) 53 | 54 | new_pathway_means = pd.Series(np.random.normal(0,variances), index=variances.index)[pathway_genes].fillna(0) 55 | new_means = pd.concat([means, new_pathway_means], axis=1).fillna(0).sum(axis=1).reindex(means.index) 56 | 57 | positives = sample_cov(100, proteomics) 58 | positives = np.around(positives + new_means.values, 6) 59 | positives = pd.DataFrame(positives, columns=proteomics.columns, index=[pathway_id]*100) 60 | 61 | dataset = pd.concat([positives, negatives]).sample(frac=1) # shuffle 62 | 63 | filename = '/home/lenail/proteomics/synthetic_proteomics/generated_data/ludwig_svd_normals/'+pathway_id+'_inbiomap_exp.csv' 64 | return dataset.to_csv(filename, index=True, header=True) 65 | 66 | 67 | 68 | if __name__ == "__main__": 69 | 70 | ovarian = pd.read_csv('/home/lenail/proteomics/data_preparation/proteomics_data/ovarian_inbiomap_exp.tsv', index_col=0) 71 | 72 | pathways_df = pd.read_pickle('/home/lenail/proteomics/synthetic_proteomics/data_generation/KEGG_df.filtered.with_correlates.pickle') 73 | 74 | pathways = [(pathway_id, pathways_df.loc[pd.IndexSlice[:, :, [pathway_id]],['genes', 'correlates']].values[0][0]) for pathway_id in pathways_df.index.get_level_values(2)] 75 | 76 | def generate_dataset_func(pathway): generate_dataset(pathway[0], np.unique(pathway[1]), ovarian) 77 | 78 | pool = multiprocessing.Pool(n_cpus) 79 | pool.map(generate_dataset_func, pathways) 80 | 81 | 82 | -------------------------------------------------------------------------------- /experiments/data_generation/3_multivariate_normal_svd_covariance/xor_kegg_pathways.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=KEGG 5 | #SBATCH --output=/home/lenail/sampling/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | from functools import partial 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | import numpy as np 29 | import pandas as pd 30 | import pickle as pkl 31 | import math 32 | 33 | def pairwise(iterable): 34 | "s -> (s0, s1), (s2, s3), (s4, s5), ..." 35 | a = iter(iterable) 36 | return zip(a, a) 37 | 38 | # data is n x d, where n is the number of samples and d the dimension 39 | def sample_cov(m, data): 40 | n, d = data.shape 41 | mean = np.mean(data, axis=0) 42 | _, S, V = np.linalg.svd((data - mean) / math.sqrt(n), full_matrices=False) 43 | randomness = np.random.randn(m, min(n, d)) 44 | return np.dot(randomness, np.dot(np.diag(S), V)) 45 | 46 | 47 | def generate_dataset(first_pathway_id, first_pathway_genes, second_pathway_id, second_pathway_genes, proteomics, POSITIVE_SAMPLES=100, NEGATIVE_SAMPLES=100): 48 | 49 | means = proteomics.mean(axis=0) 50 | variances = proteomics.var(axis=0) 51 | 52 | negatives = sample_cov(50, proteomics) 53 | negatives = np.around(negatives + means.values, 6) 54 | negatives = pd.DataFrame(negatives, columns=proteomics.columns, index=['negative']*50) 55 | 56 | first_new_pathway_means = pd.Series(np.random.normal(0,variances), index=variances.index)[first_pathway_genes].fillna(0) 57 | second_new_pathway_means = pd.Series(np.random.normal(0,variances), index=variances.index)[second_pathway_genes].fillna(0) 58 | 59 | first_new_means = pd.concat([means, first_new_pathway_means], axis=1).fillna(0).sum(axis=1).reindex(means.index) 60 | second_new_means = pd.concat([means, second_new_pathway_means], axis=1).fillna(0).sum(axis=1).reindex(means.index) 61 | both_new_means = pd.concat([means, first_new_pathway_means, second_new_pathway_means], axis=1).fillna(0).sum(axis=1).reindex(means.index) 62 | 63 | first = sample_cov(50, proteomics) 64 | first = np.around(first + first_new_means.values, 6) 65 | first = pd.DataFrame(first, columns=proteomics.columns, index=[first_pathway_id]*50) 66 | 67 | second = sample_cov(50, proteomics) 68 | second = np.around(second + second_new_means.values, 6) 69 | second = pd.DataFrame(second, columns=proteomics.columns, index=[second_pathway_id]*50) 70 | 71 | both = sample_cov(50, proteomics) 72 | both = np.around(both + both_new_means.values, 6) 73 | both = pd.DataFrame(both, columns=proteomics.columns, index=['negative']*50) 74 | 75 | dataset = pd.concat([negatives,first,second,both]).sample(frac=1) # shuffle 76 | 77 | filename = './xor_ludwig_svd_normals/'+first_pathway_id+'_'+second_pathway_id+'_inbiomap_exp.csv' 78 | return dataset.to_csv(filename, index=True, header=True) 79 | 80 | 81 | if __name__ == "__main__": 82 | 83 | ovarian = pd.read_csv('ovarian_inbiomap_exp.tsv', index_col=0) 84 | 85 | pathways = pkl.load(open("KEGG_pathway_gene_lists.pkl", "rb")) 86 | 87 | pathway_pairs = pairwise(pathways.items()) 88 | 89 | def generate_dataset_func(pathway_pair): generate_dataset(pathway_pair[0][0], np.unique(pathway_pair[0][1]), pathway_pair[1][0], np.unique(pathway_pair[1][1]), ovarian) 90 | 91 | pool = multiprocessing.Pool(n_cpus) 92 | pool.map(generate_dataset_func, pathway_pairs) 93 | 94 | 95 | -------------------------------------------------------------------------------- /experiments/data_generation/4_multivariate_normal_svd_covariance_greater_shift/README.md: -------------------------------------------------------------------------------- 1 | # Synthetic Data Generation Strategy #4: "Multivariate Normals with the SVD trick and greater perturbation" 2 | 3 | In this case, we do the exact same thing as Strategy #3 but the means of the proteins in the pathways are shifted more. 4 | 5 | ## Outline: 6 | 7 | 1. Get means and covariance from empirical data 8 | 2. Get pathway information from KEGG. 9 | 3. Sample from multivariate normal defined by empirical data via SVD trick 10 | 4. For "positive" examples, shift mean values of proteins in pathway by **one standard deviation** of their univariate normals in the empirical data 11 | 12 | ### This was one of the strategies we used in the final paper 13 | 14 | 15 | -------------------------------------------------------------------------------- /experiments/data_generation/4_multivariate_normal_svd_covariance_greater_shift/ludwig_svd_covariance_gaussian_mixture.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | #SBATCH --partition sched_mem1TB_centos7 4 | #SBATCH --job-name=DATA_GEN 5 | #SBATCH --output=/home/lenail/proteomics/synthetic_proteomics/data_generation/ludwig_svd_covariance_gaussian_mixture/multiprocess_%j.out 6 | #SBATCH -N 1 7 | #SBATCH -n 16 8 | #SBATCH --mem-per-cpu=8000 9 | 10 | 11 | import multiprocessing 12 | import sys 13 | import os 14 | 15 | from functools import partial 16 | 17 | # necessary to add cwd to path when script run by slurm (since it executes a copy) 18 | sys.path.append(os.getcwd()) 19 | 20 | # get number of cpus available to job 21 | try: 22 | n_cpus = int(os.environ["SLURM_JOB_CPUS_PER_NODE"]) 23 | except KeyError: 24 | n_cpus = multiprocessing.cpu_count() 25 | 26 | # ACTUAL APPLICATION LOGIC 27 | 28 | import numpy as np 29 | import pandas as pd 30 | import pickle as pkl 31 | import math 32 | 33 | 34 | # data is n x d, where n is the number of samples and d the dimension 35 | def sample_cov(m, data): 36 | n, d = data.shape 37 | mean = np.mean(data, axis=0) 38 | _, S, V = np.linalg.svd((data - mean) / math.sqrt(n), full_matrices=False) 39 | randomness = np.random.randn(m, min(n, d)) 40 | return np.dot(randomness, np.dot(np.diag(S), V)) 41 | 42 | 43 | def generate_dataset(pathway_id, pathway_genes, proteomics, POSITIVE_SAMPLES=100, NEGATIVE_SAMPLES=100): 44 | 45 | print(pathway_id) 46 | 47 | means = proteomics.mean(axis=0) 48 | variances = proteomics.var(axis=0) 49 | stddev = proteomics.std(axis=0) 50 | 51 | negatives = sample_cov(100, proteomics) 52 | negatives = np.around(negatives + means.values, 6) 53 | negatives = pd.DataFrame(negatives, columns=proteomics.columns, index=['negative']*100) 54 | 55 | shift_direction = np.random.randint(2, size=means.shape)*2-1 # vecrtor of +1/-1, "hack" 56 | new_pathway_means = pd.Series(np.random.normal(stddev*shift_direction,variances), index=variances.index)[pathway_genes].fillna(0) 57 | new_means = pd.concat([means, new_pathway_means], axis=1).fillna(0).sum(axis=1).reindex(means.index) 58 | 59 | positives = sample_cov(100, proteomics) 60 | positives = np.around(positives + new_means.values, 6) 61 | positives = pd.DataFrame(positives, columns=proteomics.columns, index=[pathway_id]*100) 62 | 63 | dataset = pd.concat([positives, negatives]).sample(frac=1) # shuffle 64 | 65 | filename = '/home/lenail/proteomics/synthetic_proteomics/generated_data/ludwig_svd_normals_gaussian_mixture/'+pathway_id+'_inbiomap_exp.csv' 66 | return dataset.to_csv(filename, index=True, header=True) 67 | 68 | 69 | 70 | if __name__ == "__main__": 71 | 72 | ovarian = pd.read_csv('/home/lenail/proteomics/data_preparation/proteomics_data/ovarian_inbiomap_exp.tsv', index_col=0) 73 | 74 | pathways_df = pd.read_pickle('/home/lenail/proteomics/synthetic_proteomics/data_generation/KEGG_df.filtered.with_correlates.pickle') 75 | 76 | pathways = [(pathway_id, pathways_df.loc[pd.IndexSlice[:, :, [pathway_id]],['genes', 'correlates']].values[0][0]) for pathway_id in pathways_df.index.get_level_values(2)] 77 | 78 | def generate_dataset_func(pathway): generate_dataset(pathway[0], np.unique(pathway[1]), ovarian) 79 | 80 | pool = multiprocessing.Pool(n_cpus) 81 | pool.map(generate_dataset_func, pathways) 82 | 83 | 84 | -------------------------------------------------------------------------------- /experiments/data_generation/5_conditional_multivariate_normal/README.md: -------------------------------------------------------------------------------- 1 | # Synthetic Data Generation Strategy #5: "Sampling from a Conditional Multivariate Normal" 2 | 3 | The goal here was to do the best possible job of matching our intuition in the biology. 4 | Sadly, we didn't have time to implement this fully. 5 | 6 | ## Outline: 7 | 8 | 1. Get means and covariance from empirical data 9 | 2. Get pathway information from KEGG. 10 | 3. Sample **negative exmples only** from multivariate normal defined by empirical data via SVD trick 11 | 4. For "positive" examples, shift mean values of proteins in pathway by a sample from their univariate normals in the empirical data 12 | 5. Sample the positive examples from a conditional multivariate gaussian where the proteins not in the pathway are sampled taking into account the values of the proteins in the pathway. 13 | 14 | ## Reason this did not work: 15 | 16 | From the biological perspective, we had sets of proteins (pathways) we described as ground truth. 17 | But if another protein covaries strongly with a pathway, in some sense, it is also part of that pathway. 18 | It would likely needlessly hurt our algorithmic performance to include effects on these other proteins, 19 | as well as the performances of all the other algorithms. 20 | 21 | We also didn't want to get bogged down in writing more and more data generation strategies and wanted to move on to writing our algorithm! 22 | -------------------------------------------------------------------------------- /experiments/data_generation/README.md: -------------------------------------------------------------------------------- 1 | # Semi-Synthetic Data Generation 2 | 3 | We considered 5 strategies for generating plausible semi-synthetic data, which are each 4 | described in their respective subdirectories. We ended up using strategies 3 and 4 for our 5 | experiments. 6 | 7 | `synthetic_vs_real.ipynb` compares those two approaches to the empirical data upon which they are based. 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /gslr/__init__.py: -------------------------------------------------------------------------------- 1 | from gslr import GraphOptions, gslr, softmax_gradient, softmax_loss, graph_proj_sparsity, proj_softmax_matrix 2 | -------------------------------------------------------------------------------- /gslr/__main__.py: -------------------------------------------------------------------------------- 1 | 2 | #!/usr/bin/env python 3 | 4 | # Core python modules 5 | import sys 6 | import os 7 | import math 8 | 9 | # Peripheral python modules 10 | import argparse 11 | import collections 12 | 13 | # python external libraries 14 | import numpy as np 15 | import pandas as pd 16 | import networkx as nx 17 | from networkx.readwrite import json_graph 18 | import community # pip install python-louvain 19 | from sklearn.cluster import SpectralClustering 20 | import jinja2 21 | 22 | # Lab modules 23 | from pcst_fast import pcst_fast 24 | 25 | 26 | -------------------------------------------------------------------------------- /gslr/gslr.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | # Core python modules 4 | import sys 5 | import os 6 | import math 7 | 8 | # Peripheral python modules 9 | import collections 10 | 11 | # python external libraries 12 | import numpy as np 13 | import numba 14 | 15 | # lab modules 16 | from pcst_fast import pcst_fast 17 | 18 | __all__ = ["GraphOptions", "gslr", "softmax_gradient", "softmax_loss", "graph_proj_sparsity", "proj_softmax_matrix"] 19 | 20 | 21 | GraphOptions = collections.namedtuple( 22 | 'GraphOptions', 23 | ['edges', 'root', 'num_clusters', 'pruning']) 24 | 25 | 26 | @numba.jit 27 | def softmax_gradient(X, y, W): 28 | """ 29 | Computes the multi-class softmax gradient. 30 | 31 | The gradient is for the *average* loss. 32 | 33 | Arguments: 34 | X (np.array): the n x d data matrix (n examples in dimension d) 35 | y (np.array): the n-dimensional label vector. Each entry is an integer between 0 and c-1 (inclusive), where c is the number of classes. 36 | W (np.array): the c x d weight matrix 37 | 38 | Returns: 39 | (np.array): the gradient of W as a C x d matrix. 40 | """ 41 | 42 | # TODO: make this work with nopython=True 43 | assert len(X.shape) == 2 44 | n, d = X.shape 45 | assert y.shape == (n,) 46 | 47 | assert len(W.shape) == 2 48 | assert W.shape[1] == d 49 | c = W.shape[0] 50 | # TODO: check that elements in y are in the correct range 51 | 52 | G = np.zeros_like(W) 53 | # TODO: replace with transpose_b=True ? 54 | prod = np.dot(X, W.transpose()) 55 | row_max = np.amax(prod, axis=1) 56 | prod_normalized = prod - np.expand_dims(row_max, 1) 57 | exp_prod = np.exp(prod_normalized) 58 | denom = np.sum(exp_prod, axis=1) 59 | 60 | for ii in range(n): 61 | cur_y = y[ii] 62 | cur_x = X[ii,:] 63 | G[cur_y,:] += (1.0 - exp_prod[ii, cur_y] / denom[ii]) * cur_x 64 | for jj in range(c): 65 | if jj == cur_y: 66 | continue 67 | G[jj,:] -= exp_prod[ii, jj] / denom[ii] * cur_x 68 | 69 | return -G / n 70 | 71 | 72 | @numba.jit 73 | def softmax_loss(X, y, W): 74 | """ 75 | Computes the softmax loss. 76 | 77 | Arguments: 78 | X (np.array): the n x d data matrix (n examples in dimension d) 79 | y (np.array): the n-dimensional label vector. Each entry is an integer between 0 and c-1 (inclusive), where c is the number of classes. 80 | W (np.array): the c x d weight matrix 81 | 82 | Returns: 83 | (np.array): the *average* loss as a scalar. 84 | """ 85 | 86 | # TODO: make this work with nopython=True 87 | assert len(X.shape) == 2 88 | n, d = X.shape 89 | assert y.shape == (n,) 90 | 91 | assert len(W.shape) == 2 92 | assert W.shape[1] == d 93 | c = W.shape[0] 94 | # TODO: check that elements in y are in the correct range 95 | 96 | # TODO: replace with transpose_b=True ? 97 | prod = np.dot(X, W.transpose()) 98 | row_max = np.amax(prod, axis=1) 99 | prod_normalized = prod - np.expand_dims(row_max, 1) 100 | exp_prod = np.exp(prod_normalized) 101 | denom = np.sum(exp_prod, axis=1) 102 | 103 | total_loss = 0.0 104 | for ii in range(n): 105 | cur_y = y[ii] 106 | cur_x = X[ii,:] 107 | total_loss += prod_normalized[ii, cur_y] - math.log(denom[ii]) 108 | 109 | return -total_loss / n 110 | 111 | 112 | def graph_proj_sparsity(prizes, sparsity_low, sparsity_high, opts, verbosity_level, max_num_iter=30, edge_costs=None, edge_costs_multiplier=None): 113 | """ 114 | Projects the input onto the graph sparsity model. 115 | 116 | Arguments: 117 | prizes (np.array): a real vector with non-negative node prizes (= parameter coefficients) 118 | sparsity_low (int): the (approximate) lower bound for the output sparsity 119 | sparsity_high (int): the (approximate) upper bound for the output sparsity 120 | opts (GraphOptions): passed directly to `pcst_fast` 121 | verbosity_level (int): indicates whether intermediate output should be printed verbosity_level - 1 is being passed to pcst_fast 122 | max_num_iter (int): maximum number of iterations 123 | edge_costs (np.array): a real vector with non-negative edge costs 124 | edge_costs_multiplier (np.array): a factor weighing edge costs vs prizes 125 | 126 | Returns: 127 | (np.array): the vector of graph-sparse prizes (0 for nodes not in the PCSF solution) 128 | (np.array): the list of indices of selected vertices 129 | (np.array): the list of indices of the selected edges 130 | """ 131 | 132 | num_v, = prizes.shape 133 | num_e, _ = opts.edges.shape 134 | 135 | if edge_costs is not None: 136 | assert edge_costs_multiplier is not None 137 | costs = edge_costs_multiplier * edge_costs 138 | else: 139 | costs = np.ones(num_e) 140 | 141 | lambda_r = 0.0 142 | lambda_l = 3.0 * np.sum(prizes) 143 | min_nonzero_prize = 0.0 144 | for ii in range(num_v): 145 | if prizes[ii] > 0.0 and prizes[ii] < min_nonzero_prize: 146 | min_nonzero_prize = prizes[ii] 147 | eps = 0.01 * min_nonzero_prize 148 | 149 | if verbosity_level >= 2: 150 | print("Initial lambda_l = "+str(lambda_l)+" lambda_r = "+str(lambda_r)+" eps = "+str(eps)) 151 | 152 | num_iter = 0 153 | while lambda_l - lambda_r > eps and num_iter < max_num_iter: 154 | num_iter += 1 155 | lambda_m = (lambda_l + lambda_r) / 2.0 156 | cur_vertices, cur_edges = pcst_fast(opts.edges, prizes, lambda_m * costs, opts.root, opts.num_clusters, opts.pruning, verbosity_level - 1) 157 | cur_sparsity = cur_vertices.size 158 | if verbosity_level >= 2: 159 | print("lambda_l = "+str(lambda_l)+" lambda_r = "+str(lambda_r)+" lambda_m = "+str(lambda_m)+" cur_sparsity = "+str(cur_sparsity)) 160 | if cur_sparsity >= sparsity_low and cur_sparsity <= sparsity_high: 161 | if verbosity_level >= 2: 162 | print('Returning intermediate solution for lambda_m') 163 | result = np.zeros_like(prizes) 164 | result[cur_vertices] = prizes[cur_vertices] 165 | return result, cur_vertices, cur_edges 166 | if cur_sparsity > sparsity_high: 167 | lambda_r = lambda_m 168 | else: 169 | lambda_l = lambda_m 170 | cur_vertices, cur_edges = pcst_fast(opts.edges, prizes, lambda_l * costs, opts.root, opts.num_clusters, opts.pruning, verbosity_level - 1) 171 | cur_sparsity = cur_vertices.size 172 | if cur_sparsity < sparsity_low: 173 | print("WARNING: returning sparsity "+str(cur_sparsity)+" although minimum sparsity "+str(sparsity_low)+" was requested.") 174 | if verbosity_level >= 2: 175 | print("Returning final solution for lambda_l (cur_sparsity = "+str(cur_sparsity)+")") 176 | result = np.zeros_like(prizes) 177 | result[cur_vertices] = prizes[cur_vertices] 178 | return result, cur_vertices, cur_edges 179 | 180 | 181 | def proj_softmax_matrix(W, sparsity_low, sparsity_high, opts, verbosity_level, graph_proj_max_num_iter, edge_costs=None, edge_costs_multiplier=None): 182 | """ 183 | 184 | 185 | Arguments: 186 | W (np.array): the c x d weight matrix 187 | sparsity_low (int): the (approximate) lower bound for the output sparsity 188 | sparsity_high (int): the (approximate) upper bound for the output sparsity 189 | opts (GraphOptions): passed directly to `pcst_fast` 190 | verbosity_level (int): indicates whether intermediate output should be printed verbosity_level - 1 is being passed to pcst_fast 191 | graph_proj_max_num_iter (int): the maximum number of iterations in the graph-sparsity projection. 192 | edge_costs (np.array): a real vector with non-negative edge costs 193 | edge_costs_multiplier (np.array): a factor weighing edge costs vs prizes 194 | 195 | Returns: 196 | (np.array): the graph-sparse c x d weight matrix 197 | """ 198 | 199 | c, d = W.shape 200 | W2 = np.square(W) 201 | for ii in range(c): 202 | W2[ii,:], _, _ = graph_proj_sparsity(W2[ii,:], sparsity_low, sparsity_high, opts, verbosity_level, graph_proj_max_num_iter, edge_costs, edge_costs_multiplier) 203 | return np.multiply(np.sign(W), np.sqrt(W2)) 204 | 205 | 206 | def gslr(X, y, W0, sparsity_low, sparsity_high, graph_opts, steps=None, verbosity_level=0, graph_proj_max_num_iter=20, edge_costs=None, edge_costs_multiplier=None): 207 | """ 208 | Performs softmax regression with graph-sparsity constraints. 209 | 210 | Arguments: 211 | X (np.array): the n x d data matrix (n examples in dimension d) 212 | y (np.array): the n-dimensional label vector. Each entry is an integer between 0 and c-1 (inclusive), where c is the number of classes. 213 | W0 (np.array): the c x d weight matrix 214 | sparsity_low (int): the (approximate) lower bound for the output sparsity 215 | sparsity_high (int): the (approximate) upper bound for the output sparsity 216 | graph_opts (GraphOptions): passed directly to `pcst_fast` 217 | steps (np.array): the step size schedule, represented by a matrix of size num_steps x num_choices. In each iteration, the algorithm tries all current choices for the step size and chooses the one that makes largest progress. 218 | verbosity_level (int): indicates whether intermediate output should be printed verbosity_level - 1 is being passed to pcst_fast 219 | graph_proj_max_num_iter (int): the maximum number of iterations in the graph-sparsity projection. 220 | edge_costs (np.array): a real vector with non-negative edge costs 221 | edge_costs_multiplier (np.array): a factor weighing edge costs vs prizes 222 | 223 | Returns: 224 | (np.array): the final c x d weight matrix 225 | (np.array): the loss at each step, shape is (steps x 1) 226 | """ 227 | 228 | assert len(steps.shape) == 2 229 | num_steps, num_choices = steps.shape 230 | 231 | losses = np.zeros(num_steps + 1) 232 | losses[0] = softmax_loss(X, y, W0) 233 | W_cur = np.copy(W0) 234 | for ii in range(num_steps): 235 | print("iteration "+str(ii+1)+":") 236 | gradients = softmax_gradient(X, y, W_cur) 237 | best_loss = losses[ii] 238 | best_step_size = 0.0 239 | # print("initially best loss "+str(best_loss)) 240 | for step_size in steps[ii,:]: 241 | W_tmp = W_cur - step_size * gradients 242 | # print('before') 243 | # print(W_tmp) 244 | # print(softmax_loss(X, y, W_tmp)) 245 | W_tmp = proj_softmax_matrix(W_tmp, sparsity_low, sparsity_high, graph_opts, verbosity_level, graph_proj_max_num_iter, edge_costs, edge_costs_multiplier) 246 | # print('after') 247 | # print(W_tmp) 248 | # print(softmax_loss(X, y, W_tmp)) 249 | loss_next = softmax_loss(X, y, W_tmp) 250 | if loss_next < best_loss: 251 | best_loss = loss_next 252 | best_step_size = step_size 253 | if verbosity_level >= 1: 254 | print(" loss_cur = "+str(losses[ii])+" loss_next = "+str(loss_next)+" step_size = "+str(step_size)) 255 | if verbosity_level >= 1: 256 | print(" best_step_size: "+str(best_step_size)) 257 | W_cur -= best_step_size * gradients 258 | W_cur = proj_softmax_matrix(W_cur, sparsity_low, sparsity_high, graph_opts, verbosity_level, graph_proj_max_num_iter, edge_costs, edge_costs_multiplier) 259 | losses[ii + 1] = softmax_loss(X, y, W_cur) 260 | 261 | return W_cur, losses 262 | 263 | 264 | 265 | # Helper functions 266 | def predict(X, W): 267 | return np.argmax(np.dot(X, W.transpose()), axis=1) 268 | 269 | def num_correct(y1, y2): 270 | return np.count_nonzero(np.equal(y1, y2)) 271 | -------------------------------------------------------------------------------- /poster/beamerthemeI6dv.sty: -------------------------------------------------------------------------------- 1 | \ProvidesPackage{beamerthemeI6dv} % this style was created by David Vilar 2 | 3 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 4 | \selectcolormodel{cmyk} 5 | \mode 6 | 7 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 8 | 9 | % custom colors 10 | \definecolor{i6blue}{cmyk}{1,0.305,0,0.06} 11 | \definecolor{i6bluedark}{rgb}{0.0156,0.2578,0.5625} 12 | % http://www.colorsontheweb.com/colorwizard.asp#wizard, used start set: #0066cc 13 | \definecolor{i6colorscheme1}{HTML}{FF6518} % e.g. for block title 14 | \definecolor{i6colorblockbg}{HTML}{0033cc} 15 | \definecolor{i6colorblockfg}{HTML}{FCE94F} 16 | \definecolor{i6colorscheme2}{HTML}{000000} % e.g. title in headline 17 | \definecolor{i6colorscheme3}{HTML}{C3DFFF} % e.g. for poster background 18 | \definecolor{i6colorscheme4}{HTML}{000000} 19 | \definecolor{i6colorschemeHeadline}{HTML}{0033cc} % for headline bg 20 | %\definecolor{i6colorschemeFootline}{HTML}{000000} % for headline bg 21 | \definecolor{i6colorschemeFootline}{HTML}{100D09} % for headline bg 22 | 23 | % headline colors and fonts 24 | %\setbeamercolor{headline}{fg=white,bg=i6colorschemeHeadline} 25 | \setbeamercolor{headline}{fg=white,bg=white} 26 | %\setbeamercolor{title in headline}{fg=white} 27 | \setbeamercolor{title in headline}{fg=black} 28 | %\setbeamercolor{author in headline}{fg=lightgray} 29 | %\setbeamercolor{institute in headline}{fg=lightgray} 30 | \setbeamercolor{author in headline}{fg=black} 31 | \setbeamercolor{institute in headline}{fg=black} 32 | \setbeamercolor{logo in headline}{fg=black,bg=lightgray} 33 | %\setbeamercolor{separation line}{bg=i6colorscheme1} 34 | \setbeamercolor{separation line}{bg=i6colorblockbg} 35 | 36 | % footline colors and fonts 37 | \setbeamercolor{footline}{fg=black,bg=white} 38 | \setbeamerfont{footline}{size=\normalsize} 39 | 40 | % body colors and fonts 41 | \setbeamercolor*{normal text}{fg=black,bg=i6colorscheme3} 42 | 43 | % block environment 44 | \setbeamercolor*{block body}{bg=white,fg=black} 45 | \setbeamercolor*{block title}{fg=white,bg=i6colorblockbg} 46 | \setbeamerfont{block title}{size=\large,series=\bf} 47 | 48 | \setbeamercolor*{exampleblock body}{bg=white,fg=black} 49 | \setbeamercolor*{exampleblock title}{fg=white,bg=i6colorblockbg} 50 | \setbeamerfont{exampleblock title}{size=\large,series=\bf} 51 | 52 | % example environment 53 | \setbeamercolor*{example title}{fg=white,bg=i6colorscheme1} 54 | \setbeamerfont{example title}{size=\large,series=\bf} 55 | 56 | 57 | %\setbeamercolor*{example body}{fg=white,bg=i6colorscheme4} 58 | %\setbeamercolor*{example title}{fg=white,bg=i6colorscheme1} 59 | 60 | 61 | % \setbeamercolor{framesubtitle}{fg=ta3orange, bg=ta2gray} 62 | % \setbeamercolor{author in head/foot}{fg=tabutter, bg=black} 63 | % \setbeamercolor{title in head/foot}{bg=tabutter, fg=black} 64 | 65 | 66 | \setbeamercolor{alerted text}{fg=i6colorscheme1} 67 | %\setbeamercolor{structure}{fg=i6blue} 68 | 69 | % \setbeamertemplate{itemize/enumerate body begin}{ 70 | % } 71 | % \setbeamertemplate{itemize/enumerate body end}{ 72 | % } 73 | 74 | \setbeamertemplate{itemize items}[triangle] 75 | \setbeamertemplate{navigation symbols}{} % no navigation on a poster 76 | 77 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 78 | \setbeamertemplate{block begin}{ 79 | \vskip.75ex 80 | \begin{beamercolorbox}[leftskip=1cm,colsep*=.75ex]{block title}% 81 | \usebeamerfont*{block title}\insertblocktitle 82 | \end{beamercolorbox}% 83 | {\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}% 84 | \usebeamerfont{block body}% 85 | \begin{beamercolorbox}[colsep*=.75ex,sep=.75ex,vmode]{block body}% 86 | \ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}% 87 | } 88 | \setbeamertemplate{block end}{ 89 | \end{beamercolorbox} 90 | } 91 | 92 | 93 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 94 | \setbeamertemplate{headline}{ 95 | \leavevmode 96 | 97 | \begin{beamercolorbox}[wd=\paperwidth]{headline} 98 | \begin{columns}[T] 99 | \begin{column}{.15\paperwidth} 100 | \vskip2cm 101 | \begin{center} 102 | \includegraphics[height=5cm]{images/mit-cropped.pdf} 103 | \end{center} 104 | \vskip1.5cm 105 | \end{column} 106 | \begin{column}{.85\paperwidth} 107 | \vskip4ex 108 | % \raggedleft 109 | \usebeamercolor{title in headline}{\color{fg}\textbf{\LARGE{\inserttitle}}\\[2ex]} 110 | \usebeamercolor{author in headline}{\color{fg}\Large{\insertauthor}\\[1ex]} 111 | \usebeamercolor{institute in headline}{\color{fg}\Large{\insertinstitute}\\[1ex]\vspace{.1cm}} 112 | \end{column} 113 | \end{columns} 114 | \end{beamercolorbox} 115 | 116 | %% \begin{beamercolorbox}[sep=0.1cm,wd=.1\paperwidth,center]{logo in headline} 117 | %% \vskip2ex 118 | %% \end{beamercolorbox} 119 | %% \begin{beamercolorbox}[sep=1cm,wd=.7\paperwidth]{headline} 120 | %% \usebeamercolor{title in headline}{\raggedright\color{fg}\textbf{\LARGE{\inserttitle}}\\[1ex]} 121 | %% \usebeamercolor{author in headline}{\raggedright\color{fg}\large{\insertauthor}\\[1ex]} 122 | %% \usebeamercolor{institute in headline}{\raggedright\color{fg}\large{\insertinstitute}\\[1ex]} 123 | %% \end{beamercolorbox}% 124 | %% \begin{beamercolorbox}[sep=0.1cm,wd=.18\paperwidth,center]{logo in headline} 125 | %% \includegraphics[height=5cm]{logos/rwth-hks44} 126 | %% \vskip2ex 127 | %% \end{beamercolorbox} 128 | %% \end{beamercolorbox} 129 | 130 | \begin{beamercolorbox}[wd=\paperwidth]{lower separation line head} 131 | % \rule{0pt}{2pt} 132 | \end{beamercolorbox} 133 | } 134 | 135 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 136 | \setbeamertemplate{footline}{ 137 | } 138 | 139 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 140 | \mode 141 | 142 | 143 | 144 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 145 | %%% Local Variables: 146 | %%% mode: latex 147 | %%% TeX-master: "poster" 148 | %%% TeX-PDF-mode: t 149 | %%% End: 150 | -------------------------------------------------------------------------------- /poster/graph_sparsity_picture.tex: -------------------------------------------------------------------------------- 1 | \begin{columns} 2 | \column{.5\textwidth} 3 | \begin{center} 4 | \begin{tikzpicture}[scale=1.5] 5 | \tikzstyle{mythick}=[line width=.12cm]; 6 | \tikzstyle{gn}=[draw=black,circle,inner sep=1pt,minimum size=.9cm,mythick] 7 | \tikzstyle{ed}=[draw=black,mythick] 8 | \tikzstyle{selection}=[double=blue!20,double distance=34pt,mythick,draw=blue!50,line cap=round,line join=round]; 9 | \node [gn] (a) at (0,0) {}; 10 | \node [gn] (b) at (3,0) {}; 11 | \node [gn] (c) at (2,2.8) {}; 12 | \node [gn] (d) at (3.5,1.7) {}; 13 | \node [gn] (e) at (-1.4, 1) {}; 14 | \node [gn] (f) at (.4,3.0) {}; 15 | \node [gn] (g) at (.3,1.8) {}; 16 | \node [gn] (h) at (-.6,2.3) {}; 17 | \draw [ed] (a) -- (b); 18 | \draw [ed] (c) -- (d); 19 | \draw [ed] (a) -- (e); 20 | \draw [ed] (d) -- (b); 21 | \draw [ed] (a) -- (c); 22 | \draw [ed] (b) -- (c); 23 | \draw [ed] (a) -- (g); 24 | \draw [ed] (g) -- (c); 25 | \draw [ed] (g) -- (h); 26 | \draw [ed] (e) -- (h); 27 | \draw [ed] (f) -- (h); 28 | \begin{scope}[on background layer] 29 | \draw [selection] (-.6,2.3) -- (-1.4,1) -- (0,0); 30 | \end{scope} 31 | \end{tikzpicture} 32 | 33 | \green{Graph-sparse}\\[.5cm] 34 | \end{center} 35 | \column{.5\textwidth} 36 | \begin{center} 37 | \begin{tikzpicture}[scale=1.5] 38 | \tikzstyle{mythick}=[line width=.12cm]; 39 | \tikzstyle{gn}=[draw=black,circle,mythick,inner sep=1pt,minimum size=.9cm] 40 | \tikzstyle{ed}=[draw=black,mythick] 41 | \tikzstyle{selection}=[double=blue!20,double distance=9pt,mythick,draw=blue!50,line cap=round,line join=round]; 42 | \node [gn] (a) at (0,0) {}; 43 | \node [gn] (b) at (3,0) {}; 44 | \node [gn] (c) at (2,2.8) {}; 45 | \node [gn] (d) at (3.5,1.7) {}; 46 | \node [gn] (e) at (-1.4, 1) {}; 47 | \node [gn] (f) at (.4,3.0) {}; 48 | \node [gn] (g) at (.3,1.8) {}; 49 | \node [gn] (h) at (-.6,2.3) {}; 50 | \draw [ed] (a) -- (b); 51 | \draw [ed] (c) -- (d); 52 | \draw [ed] (a) -- (e); 53 | \draw [ed] (d) -- (b); 54 | \draw [ed] (a) -- (c); 55 | \draw [ed] (b) -- (c); 56 | \draw [ed] (a) -- (g); 57 | \draw [ed] (g) -- (c); 58 | \draw [ed] (g) -- (h); 59 | \draw [ed] (e) -- (h); 60 | \draw [ed] (f) -- (h); 61 | \begin{scope}[on background layer] 62 | \node [circle,mythick,draw=blue!50,fill=blue!20,inner sep=0pt,minimum size=\gselradius] at (f) {}; 63 | \node [circle,mythick,draw=blue!50,fill=blue!20,inner sep=0pt,minimum size=\gselradius] at (b) {}; 64 | \node [circle,mythick,draw=blue!50,fill=blue!20,inner sep=0pt,minimum size=\gselradius] at (g) {}; 65 | \end{scope} 66 | \end{tikzpicture} 67 | 68 | \red{Not graph-sparse} 69 | \end{center} 70 | \end{columns} 71 | -------------------------------------------------------------------------------- /poster/images/1.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/images/1.pdf -------------------------------------------------------------------------------- /poster/images/2.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/images/2.pdf -------------------------------------------------------------------------------- /poster/images/3.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/images/3.pdf -------------------------------------------------------------------------------- /poster/images/4.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/images/4.pdf -------------------------------------------------------------------------------- /poster/images/algo.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/images/algo.pdf -------------------------------------------------------------------------------- /poster/images/graph.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/images/graph.pdf -------------------------------------------------------------------------------- /poster/images/matrix.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/images/matrix.pdf -------------------------------------------------------------------------------- /poster/images/mit-cropped.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/images/mit-cropped.pdf -------------------------------------------------------------------------------- /poster/images/selected.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/images/selected.pdf -------------------------------------------------------------------------------- /poster/middle-col-low.tex: -------------------------------------------------------------------------------- 1 | 2 | \begin{columns} 3 | \begin{column}{.5\linewidth} 4 | \begin{center} 5 | \begin{tikzpicture}[scale=2.5] 6 | \tikzstyle{mythick}=[line width=.12cm]; 7 | \tikzstyle{gn}=[draw=black,circle,thick,inner sep=7pt,minimum size=1cm,mythick] 8 | \tikzstyle{ed}=[draw=black,mythick] 9 | \node [gn] (a) at (0,0) {$3$}; 10 | \node [gn] (b) at (3,0) {$5$}; 11 | \node [gn] (c) at (2,2.8) {$7$}; 12 | \node [gn] (d) at (3.5,1.7) {$2$}; 13 | \node [gn] (e) at (-1.4, 1) {$6$}; 14 | \node [gn] (f) at (.4,3.0) {$8$}; 15 | \node [gn] (g) at (.3,1.8) {$1$}; 16 | \node [gn] (h) at (-.6,2.3) {$0$}; 17 | \draw [ed] (a) -- (b); 18 | \draw [ed] (c) -- (d); 19 | \draw [ed] (a) -- (e); 20 | \draw [ed] (d) -- (b); 21 | \draw [ed] (a) -- (c); 22 | \draw [ed] (b) -- (c); 23 | \draw [ed] (a) -- (g); 24 | \draw [ed] (g) -- (c); 25 | \draw [ed] (g) -- (h); 26 | \draw [ed] (e) -- (h); 27 | \draw [ed] (f) -- (h); 28 | \end{tikzpicture} 29 | 30 | Input 31 | \end{center} 32 | \end{column} 33 | \begin{column}{.5\linewidth} 34 | \begin{center} 35 | \begin{tikzpicture}[scale=2.5] 36 | \tikzstyle{mythick}=[line width=.12cm]; 37 | \tikzstyle{gn}=[draw=black,circle,thick,inner sep=7pt,minimum size=1cm,mythick] 38 | \tikzstyle{ed}=[draw=black,mythick] 39 | \tikzstyle{selection}=[double=blue!20,double distance=60pt,line width=.2cm,draw=blue!50,line cap=round,line join=round]; 40 | \node [gn] (a) at (0,0) {$3$}; 41 | \node [gn] (b) at (3,0) {$5$}; 42 | \node [gn] (c) at (2,2.8) {$7$}; 43 | \node [gn] (d) at (3.5,1.7) {$2$}; 44 | \node [gn] (e) at (-1.4, 1) {$6$}; 45 | \node [gn] (f) at (.4,3.0) {$8$}; 46 | \node [gn] (g) at (.3,1.8) {$1$}; 47 | \node [gn] (h) at (-.6,2.3) {$0$}; 48 | \draw [ed] (a) -- (b); 49 | \draw [ed] (c) -- (d); 50 | \draw [ed] (a) -- (e); 51 | \draw [ed] (d) -- (b); 52 | \draw [ed] (a) -- (c); 53 | \draw [ed] (b) -- (c); 54 | \draw [ed] (a) -- (g); 55 | \draw [ed] (g) -- (c); 56 | \draw [ed] (g) -- (h); 57 | \draw [ed] (e) -- (h); 58 | \draw [ed] (f) -- (h); 59 | \begin{scope}[on background layer] 60 | \draw [selection] (0,0) -- (3,0) -- (2,2.8); 61 | \end{scope} 62 | \end{tikzpicture} 63 | 64 | Output 65 | \end{center} 66 | \end{column} 67 | \end{columns} 68 | 69 | \vspace{1.2cm} 70 | 71 | We solve \textbf{approximate} versions of the projection problem via reductions to the \textbf{prize-collecting Steiner tree problem} (PCST).\\[1.5cm] 72 | 73 | \textbf{Objective of PCST:} Given a graph with edge costs $c$ and node prizes $\pi$, find a subtree $T$ minimizing $c(T) + \pi(\overline{T})$. 74 | 75 | \vspace{.7cm} 76 | 77 | \begin{columns} 78 | \begin{column}{.5\linewidth} 79 | \begin{center} 80 | \begin{tikzpicture}[scale=2.5] 81 | \tikzstyle{mythick}=[line width=.12cm]; 82 | \tikzstyle{gn}=[draw=black,circle,thick,inner sep=7pt,minimum size=1cm,mythick,text=red] 83 | \tikzstyle{ed}=[draw=black,mythick] 84 | \tikzstyle{selection}=[double=blue!20,double distance=60pt,line width=.2cm,draw=blue!50,line cap=round,line join=round]; 85 | \node [gn] (a) at (0,0) {7}; 86 | \node [gn] (b) at (3,0) {6}; 87 | \node [gn] (c) at (2,2.8) {2}; 88 | \node [gn] (d) at (3.5,1.7) {5}; 89 | \node [gn] (e) at (-1.4, 1) {4}; 90 | \node [gn] (f) at (.4,3.0) {1}; 91 | \node [gn] (g) at (.3,1.8) {8}; 92 | \node [gn] (h) at (-.6,2.3) {3}; 93 | \draw [ed] (a) -- (b) node [below,midway] {1}; 94 | \draw [ed] (c) -- (d) node [above,midway,xshift=10pt,yshift=-4pt] {2}; 95 | \draw [ed] (a) -- (e) node [below=-7.5pt,midway,xshift=-10pt] {3}; 96 | \draw [ed] (d) -- (b) node [below=-20pt,midway,xshift=14pt] {4}; 97 | \draw [ed] (a) -- (c) node [below=-4pt,midway,xshift=10pt] {5}; 98 | \draw [ed] (b) -- (c) node [above=-4pt,midway,xshift=9pt] {6}; 99 | \draw [ed] (a) -- (g) node [above=-10pt,midway,xshift=-14pt] {7}; 100 | \draw [ed] (g) -- (c) node [above,midway,xshift=-2pt] {8}; 101 | \draw [ed] (g) -- (h) node [above=-4pt,midway,xshift=8pt] {9}; 102 | \draw [ed] (e) -- (h) node [above=-10pt,midway,xshift=-20pt] {10}; 103 | \draw [ed] (f) -- (h) node [above=-2pt,midway,xshift=-11pt] {11}; 104 | \end{tikzpicture} 105 | 106 | Input 107 | \end{center} 108 | \end{column} 109 | \begin{column}{.5\linewidth} 110 | \begin{center} 111 | \begin{tikzpicture}[scale=2.5] 112 | \tikzstyle{mythick}=[line width=.12cm]; 113 | \tikzstyle{gn}=[draw=black,circle,thick,inner sep=7pt,minimum size=1cm,mythick,text=red] 114 | \tikzstyle{ed}=[draw=black,mythick] 115 | \tikzstyle{selection}=[double=blue!20,double distance=60pt,line width=.2cm,draw=blue!50,line cap=round,line join=round]; 116 | \node [gn] (a) at (0,0) {7}; 117 | \node [gn] (b) at (3,0) {6}; 118 | \node [gn] (c) at (2,2.8) {2}; 119 | \node [gn] (d) at (3.5,1.7) {5}; 120 | \node [gn] (e) at (-1.4, 1) {4}; 121 | \node [gn] (f) at (.4,3.0) {1}; 122 | \node [gn] (g) at (.3,1.8) {8}; 123 | \node [gn] (h) at (-.6,2.3) {3}; 124 | \draw [ed] (a) -- (b) node [below,midway] {1}; 125 | \draw [ed] (c) -- (d) node [above,midway,xshift=10pt,yshift=-4pt] {2}; 126 | \draw [ed] (a) -- (e) node [below=-7.5pt,midway,xshift=-10pt] {3}; 127 | \draw [ed] (d) -- (b) node [below=-20pt,midway,xshift=14pt] {4}; 128 | \draw [ed] (a) -- (c) node [below=-4pt,midway,xshift=10pt] {5}; 129 | \draw [ed] (b) -- (c) node [above=-4pt,midway,xshift=9pt] {6}; 130 | \draw [ed] (a) -- (g) node [above=-10pt,midway,xshift=-14pt] {7}; 131 | \draw [ed] (g) -- (c) node [above,midway,xshift=-2pt] {8}; 132 | \draw [ed] (g) -- (h) node [above=-4pt,midway,xshift=8pt] {9}; 133 | \draw [ed] (e) -- (h) node [above=-10pt,midway,xshift=-20pt] {10}; 134 | \draw [ed] (f) -- (h) node [above=-2pt,midway,xshift=-11pt] {11}; 135 | \begin{scope}[on background layer] 136 | \draw [selection] (3.5,1.7) -- (3,0) -- (0,0) -- (-1.4,1) -- (0,0) -- (.3,1.8); 137 | \end{scope} 138 | \end{tikzpicture} 139 | 140 | Output 141 | \end{center} 142 | \end{column} 143 | \end{columns} 144 | 145 | \vspace{1.5cm} 146 | 147 | $\rightarrow$ \textbf{Nearly-linear} time approximate projections. 148 | -------------------------------------------------------------------------------- /poster/poster.out: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/poster.out -------------------------------------------------------------------------------- /poster/poster.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fraenkel-lab/GSLR/7a10e8823a7edb7f0eb1f5f1801e711002560b09/poster/poster.pdf -------------------------------------------------------------------------------- /poster/poster.tex: -------------------------------------------------------------------------------- 1 | \documentclass[svgnames,final]{beamer} 2 | \usepackage{etex} 3 | \mode { 4 | \usetheme{I6dv} 5 | } 6 | \usepackage[utf8]{inputenc} 7 | %\usepackage[T1]{fontenc} 8 | \usepackage[english]{babel} 9 | \usepackage{amsmath,amsfonts,amsthm} 10 | \usepackage{mathtools} 11 | \usepackage{booktabs} 12 | \usepackage[orientation=landscape,size=a0,scale=1.4]{beamerposter} 13 | \usepackage{pgfplots} 14 | \usepackage{comment} 15 | % \usepackage{algorithm} 16 | \usepackage[noend]{algpseudocode} 17 | \usepackage{etoolbox} 18 | \pgfplotsset{compat=1.12} 19 | \usepackage{tikz} 20 | \usetikzlibrary{positioning,plotmarks,calc,arrows,decorations.markings,intersections,backgrounds} 21 | \usepackage{amsmath,amsfonts,amsthm,bm} % Math packages 22 | \usepackage{hyperref} 23 | \hypersetup{ 24 | colorlinks=true, 25 | linkcolor=blue, 26 | filecolor=magenta, 27 | urlcolor=cyan, 28 | } 29 | 30 | \newcommand{\thetatilde}{\ensuremath{\tilde{\theta}}} 31 | %\tikzexternalize[prefix=tikz_output/] 32 | 33 | \usepackage [english]{babel} 34 | \usepackage [autostyle, english = american]{csquotes} 35 | \MakeOuterQuote{"} 36 | 37 | \newtoggle{plotexperiments} 38 | \toggletrue{plotexperiments} 39 | %\togglefalse{plotexperiments} 40 | 41 | \newcommand{\numplotsamples}{200} 42 | 43 | \newcommand{\red}[1]{\textcolor{red}{#1}} 44 | \newcommand{\green}[1]{\textcolor{Green}{#1}} 45 | \newcommand{\blue}[1]{\textcolor{blue}{#1}} 46 | \newcommand{\eps}{\ensuremath{\epsilon}} 47 | \newcommand{\R}{\ensuremath{\mathbb{R}}} 48 | \newcommand{\setC}{\ensuremath{\mathcal{C}}} 49 | \newcommand{\thetahat}{\ensuremath{\hat{\theta}}} 50 | \newcommand{\thetastar}{\ensuremath{\theta^*}} 51 | \newcommand{\Otilde}{\ensuremath{\widetilde{O}}} 52 | \newcommand{\OPT}{\ensuremath{\textnormal{OPT}}} 53 | \newcommand{\projH}{\ensuremath{\mathcal{H}}} 54 | \newcommand{\projT}{\ensuremath{\mathcal{T}}} 55 | \newcommand{\Usubspaces}{\ensuremath{\mathbb{U}}} 56 | \DeclarePairedDelimiter{\abs}{\lvert}{\rvert} 57 | \DeclareMathOperator*{\argmin}{arg\,min} 58 | \DeclarePairedDelimiter{\norm}{\lVert}{\rVert} 59 | \newcommand{\specialcell}[2][c]{% 60 | \begin{tabular}[#1]{@{}c@{}}#2\end{tabular}} 61 | 62 | \newcommand{\prospoint}[1]{\textcolor{Green}{Pros: #1}} 63 | \newcommand{\conspoint}[1]{\textcolor{red}{Cons: #1}} 64 | 65 | \newcommand{\greencell}[1]{\green{#1}} 66 | \newcommand{\redcell}[1]{\red{#1}} 67 | \newcommand{\yellowcell}[1]{\textcolor{orange!40!yellow}{#1}} 68 | 69 | \title{Graph-Sparse Logistic Regression} 70 | \author{Alexander LeNail$^1$, Ludwig Schmidt$^2$, Jonathan Li$^1$, Tobias Ehrenberger$^1$, Karen Sachs$^1$, Stefanie Jegelka$^2$, Ernest Fraenkel$^1$} 71 | \institute{$^1$MIT BE, $^2$MIT CSAIL} 72 | 73 | \begin{document} 74 | 75 | \newlength{\gextlength} 76 | \setlength{\gextlength}{14pt} 77 | \newlength{\gselradius} 78 | \setlength{\gselradius}{38pt} 79 | 80 | \begin{frame} 81 | \vspace{-.5cm} 82 | \begin{columns}[T] 83 | 84 | \begin{column}{.3\linewidth} 85 | 86 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 87 | \begin{block}{Problem Setup} 88 | 89 | \vspace{-.8cm} 90 | 91 | \textbf{Variable selection} in a linear model: 92 | {\Large 93 | \[ 94 | y \; = \; \sigma(X \, \thetastar) 95 | \] 96 | } 97 | 98 | \vspace{-.7cm} 99 | 100 | \begin{itemize} 101 | \item Data matrix $X \in \R^{n \times d}$\\[.2cm] 102 | \item Unknown parameters $\thetastar \in \R^d$\\[.2cm] 103 | \item Binary labels $y \in \{0,1\}^n$\\[.2cm] 104 | \item $\sigma: \R \rightarrow \R$ is the logistic function $\sigma(x) = \frac{1}{1 + e^{-x}}$ 105 | \end{itemize} 106 | 107 | \vspace{1.2cm} 108 | \textbf{This work:} our goal is to select a \textbf{graph-sparse} set of variables.\\[.5cm] 109 | $\quad\rightarrow$ \textbf{Statistical efficiency:} fewer variables for same error.\\[.3cm] 110 | $\quad\rightarrow$ \textbf{Interpretability:} graph-structure in many applications. 111 | 112 | \vspace{1.2cm} 113 | \textbf{Graph sparsity} 114 | \begin{itemize} 115 | \item Every variable (parameter index) corresponds to a node.\\[.2cm] 116 | \item Selected variables form a \textbf{connected subgraph.} 117 | \end{itemize} 118 | 119 | \input{graph_sparsity_picture} 120 | 121 | \end{block} 122 | 123 | \vspace{1.0cm} 124 | 125 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 126 | \begin{block}{Motivation: graph-structed data in biology} 127 | Protein expression data with a \textbf{protein-protein interation network.}\\[-.2cm] 128 | \begin{figure}[h] 129 | \centering 130 | \includegraphics[width=.8\linewidth]{images/matrix.pdf} 131 | \end{figure} 132 | 133 | Graph given by prior knowledge from biology:\\[-.6cm] 134 | 135 | \begin{figure}[h] 136 | \centering 137 | \includegraphics[width=0.7\linewidth]{images/graph.pdf} 138 | \end{figure} 139 | 140 | \vspace{-1.5cm} 141 | 142 | \end{block} 143 | 144 | \vspace{2cm} 145 | 146 | \end{column} 147 | 148 | \begin{column}{.3\linewidth} 149 | 150 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 151 | \begin{block}{Approach} 152 | We build on results in \textbf{compressive sensing} for graph-sparse data.\\[.3cm] 153 | $\qquad$\textcolor{darkgray}{[Huang, Zhang, Metaxas, 2011], [Hegde, Indyk, Schmidt, 2015]} 154 | \vspace{1.2cm} 155 | 156 | $\rightarrow$ We introduce \textbf{Graph-Sparse Logistic Regression} (GSLR).\\[.2cm] 157 | \begin{itemize} 158 | \item Gradient descent on logistic loss.\\[.2cm] 159 | \item Efficient projections onto the graph sparse set. 160 | \end{itemize} 161 | 162 | \vspace{1cm} 163 | 164 | \begin{tikzpicture} 165 | \node [rectangle,draw,black,line width=.2cm,text width=33cm,align=left] {\begin{algorithmic}[1] 166 | \vspace{-.3cm} 167 | \Function{GSLR}{$X$, $y$, $G$, $s$, $\eta$, $k$} 168 | \State Let $f(X, y, \theta)$ be the logistic loss. 169 | \State $\thetahat^0 \gets 0$ 170 | \For{$i \gets 0, \ldots, k-1$} 171 | \State $\thetatilde^{i+1} \gets \thetahat^i - \eta \cdot \nabla f(X, y, \thetahat^i)$ 172 | \State $\thetahat^{i+1} \gets P_{G,s}(\thetatilde^{i+1})$ \Comment{Graph-sparse projection \hspace{.5cm}$ \;$ } 173 | \EndFor 174 | \State \textbf{return} $\thetahat^k$ 175 | \EndFunction 176 | \vspace{.7cm} 177 | \end{algorithmic}}; 178 | \end{tikzpicture} 179 | \end{block} 180 | 181 | \vspace{1.0cm} 182 | 183 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 184 | \begin{block}{Efficient Graph-Sparse Projections} 185 | \vspace{-.5cm} 186 | \textbf{Projection problem}: Given $b \in \R^d$ and a graph-sparse set $\mathbb{G}$, find 187 | {\Large 188 | \[ 189 | \Omega^* \; = \; \argmin_{\Omega \in \mathbb{G}} \, \norm{b - b_{\Omega}} \; . 190 | \] 191 | } 192 | \input{middle-col-low.tex} 193 | \end{block} 194 | \end{column} 195 | 196 | \begin{column}{.3\linewidth} 197 | 198 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 199 | \begin{block}{Experimental Setup} 200 | 201 | Since we don't have the ground truth subgraphs for the real Ovarian Cancer data, 202 | we generate synthetic data by this procedure: 203 | 204 | 1. Determine $\mu$ and $\bm{\Sigma}$ from real Ovarian Cancer Proteomics data. 205 | 206 | 2. Sample from multivariate $\mathcal{N} (\vec{\mu}, \bm{\Sigma} )$ 207 | 208 | 3. Sample perturbation vector $\vec{x}$: 209 | 210 | \setlength\parindent{96pt} 211 | 212 | scheme 1: $\vec{x_p} = \mathcal{N} (0, \sigma_p^2 )$ if $p \in$ KEGG, 0 otherwise 213 | 214 | scheme 2: $\vec{x_p} = \mathcal{N} (\pm\sigma_p, \sigma_p^2 )$ if $p \in$ KEGG, 0 otherwise 215 | 216 | \setlength\parindent{0pt} 217 | 218 | 4. Translate "positive" samples by perturbation vector 219 | 220 | 221 | \begin{figure}[h] 222 | \centering 223 | \begin{tikzpicture}[ 224 | declare function={mu1=1;}, 225 | declare function={mu2=2;}, 226 | declare function={mu3=2;}, 227 | declare function={sigma1=0.5;}, 228 | declare function={sigma2=1;}, 229 | declare function={normal(\m,\s)=1/(2*\s*sqrt(pi))*exp(-(x-\m)^2/(2*\s^2));}, 230 | declare function={bivar(\ma,\sa,\mb,\sb)=3.3/(2*pi*\sa*\sb) * exp(-((x-\ma)^2/\sa^2 + (y-\mb)^2/\sb^2))/2;}] 231 | \begin{axis}[ 232 | ticks=none, 233 | colormap name=whitered, 234 | width=18cm, 235 | view={35}{65}, 236 | enlargelimits=false, 237 | grid=major, 238 | domain=-1:4, 239 | y domain=-1:4, 240 | samples=26, 241 | xlabel=$x_1$, 242 | ylabel=$x_2$, 243 | zlabel={$P$}, 244 | ] 245 | 246 | \addplot3 [opacity=1,surf,colormap={whitered}{color(0cm)=(white); color(1cm)=(orange!75!red)}] {bivar(mu1,sigma1,mu2,sigma2)}; 247 | \addplot3 [opacity=0.5,surf,colormap={whiteyellow}{color(0cm)=(white); color(1cm)=(orange!75!yellow)}] {bivar(mu3,sigma1,mu2,sigma2)}; 248 | 249 | \addplot3 [domain=-1:4,samples=31, samples y=0, thin, smooth] (x,4,{normal(mu1,sigma1)}); 250 | \addplot3 [domain=-1:4,samples=31, samples y=0, thin, smooth] (-1,x,{normal(mu2,sigma2)}); 251 | \addplot3 [domain=-1:4,samples=31, samples y=0, thin, smooth] (x,4,{normal(mu3,sigma1)}); 252 | 253 | \draw [black!50] (axis cs:-1,0,0) -- (axis cs:4,0,0); 254 | \draw [black!50] (axis cs:0,-1,0) -- (axis cs:0,4,0); 255 | 256 | \end{axis} 257 | \end{tikzpicture} 258 | \end{figure} 259 | 260 | 261 | Since we know the perturbation vector, we know the ground truth! 262 | 263 | We can then evaluate algorithms on the feature selection task. 264 | 265 | \end{block} 266 | 267 | \vspace{1.0cm} 268 | 269 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 270 | \begin{block}{Experimental Results} 271 | 272 | We benchmark GSLR against the LASSO by how many of the truly "perturbed" features each uses in its support. 273 | 274 | \begin{figure}[h] 275 | \centering 276 | %\begin{subfigure}{.5\textwidth} 277 | % \centering 278 | \includegraphics[width=.5\linewidth]{images/2.pdf} 279 | %\end{subfigure}% 280 | %\begin{subfigure}{.5\textwidth} 281 | % \centering 282 | \includegraphics[width=.5\linewidth]{images/1.pdf} 283 | \newline 284 | %\end{subfigure} 285 | %\begin{subfigure}{.5\textwidth} 286 | % \centering 287 | \includegraphics[width=.5\linewidth]{images/4.pdf} 288 | %\end{subfigure}% 289 | %\begin{subfigure}{.5\textwidth} 290 | % \centering 291 | \includegraphics[width=.5\linewidth]{images/3.pdf} 292 | %\end{subfigure} 293 | \label{fig:perf} 294 | \end{figure} 295 | 296 | We then use our technique on real Ovarian Cancer data, 297 | and find that the support chosen by GSLR is qualitatively superior. 298 | 299 | \end{block} 300 | 301 | \vspace{1.0cm} 302 | 303 | % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 304 | \begin{block}{Conclusion} 305 | 306 | Source code and experimental code at \href{https://github.com/fraenkel-lab/gslr}{https://github.com/fraenkel-lab/gslr} 307 | 308 | \vspace{1.0cm} 309 | 310 | \textbf{Future Work:} Benchmark against related approaches which incorporate the feature graph. 311 | 312 | \end{block} 313 | 314 | \end{column} 315 | \end{columns} 316 | \end{frame} 317 | \end{document} 318 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | numpy 2 | numba 3 | pcst_fast 4 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | from setuptools import setup 2 | 3 | setup( 4 | name='gslr', 5 | packages=['gslr'], 6 | version='0.0.1', 7 | url='https://github.com/fraenkel-lab/GSLR', 8 | classifiers=[ 9 | 'Programming Language :: Python :: 2.7', 10 | 'Programming Language :: Python :: 3.6'], 11 | license='MIT', 12 | author='zfrenchee ludwigschmidt', 13 | author_email='alex@lenail.org', 14 | description='', 15 | install_requires=[ 16 | 'numpy', 17 | 'numba', 18 | 'pcst_fast', 19 | ], 20 | ) 21 | 22 | --------------------------------------------------------------------------------