Source code for _io
35 |
36 |
├── .gitignore ├── .travis.yml ├── LICENSE ├── changelog.md ├── doc ├── Makefile ├── _build │ ├── doctrees │ │ ├── autoencoder-integration.doctree │ │ ├── data-normalization.doctree │ │ ├── environment.pickle │ │ ├── filtering-and-merging-latent-factors.doctree │ │ ├── index.doctree │ │ ├── maui.doctree │ │ ├── saving-and-loading-models.doctree │ │ └── utils.doctree │ └── html │ │ ├── .buildinfo │ │ ├── _images │ │ ├── colinearity-merged.png │ │ ├── colinearity.png │ │ ├── hist.png │ │ └── integration-autoencoder.png │ │ ├── _modules │ │ ├── _io.html │ │ ├── builtins.html │ │ ├── index.html │ │ ├── io.html │ │ └── maui │ │ │ ├── model.html │ │ │ └── utils.html │ │ ├── _sources │ │ ├── autoencoder-integration.rst.txt │ │ ├── data-normalization.rst.txt │ │ ├── filtering-and-merging-latent-factors.rst.txt │ │ ├── index.rst.txt │ │ ├── maui.rst.txt │ │ ├── saving-and-loading-models.rst.txt │ │ └── utils.rst.txt │ │ ├── _static │ │ ├── ajax-loader.gif │ │ ├── alabaster.css │ │ ├── basic.css │ │ ├── classic.css │ │ ├── colinearity-merged.png │ │ ├── colinearity.png │ │ ├── comment-bright.png │ │ ├── comment-close.png │ │ ├── comment.png │ │ ├── custom.css │ │ ├── doctools.js │ │ ├── documentation_options.js │ │ ├── down-pressed.png │ │ ├── down.png │ │ ├── file.png │ │ ├── hex-maui-120.png │ │ ├── hex-maui-200.png │ │ ├── hex-maui.png │ │ ├── hist.png │ │ ├── icons8-beach-30.png │ │ ├── integration-autoencoder.png │ │ ├── jquery-3.2.1.js │ │ ├── jquery.js │ │ ├── minus.png │ │ ├── plus.png │ │ ├── pygments.css │ │ ├── searchtools.js │ │ ├── sidebar.js │ │ ├── underscore-1.3.1.js │ │ ├── underscore.js │ │ ├── up-pressed.png │ │ ├── up.png │ │ └── websupport.js │ │ ├── autoencoder-integration.html │ │ ├── data-normalization.html │ │ ├── filtering-and-merging-latent-factors.html │ │ ├── genindex.html │ │ ├── index.html │ │ ├── maui.html │ │ ├── objects.inv │ │ ├── py-modindex.html │ │ ├── saving-and-loading-models.html │ │ ├── search.html │ │ ├── searchindex.js │ │ └── utils.html ├── _static │ ├── colinearity-merged.png │ ├── colinearity.png │ ├── hist.png │ ├── icons8-beach-30.png │ └── integration-autoencoder.png ├── autoencoder-integration.rst ├── conf.py ├── data-normalization.rst ├── filtering-and-merging-latent-factors.rst ├── index.rst ├── maui.rst ├── saving-and-loading-models.rst └── utils.rst ├── hex-maui.png ├── maui ├── __init__.py ├── _version.py ├── autoencoders_architectures.py ├── maui_warnings.py ├── model.py └── utils.py ├── pytest.ini ├── readme.md ├── readthedocs.yml ├── setup.cfg ├── setup.py ├── test ├── __init__.py ├── test_maui.py └── test_utils.py └── vignette └── maui_vignette.ipynb /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.egg-info 3 | build/ 4 | dist/ 5 | **/.ipynb_checkpoints 6 | vignette/data 7 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | python: 3 | - "3.6" 4 | # command to install dependencies 5 | install: 6 | - pip install --upgrade setuptools>=41.0.0 7 | - pip install scipy==1.2.1 8 | - pip install lifelines patsy pytest>=3.6.0 pytest-cov>=2.6.1 codecov 9 | - pip install tensorflow==1.* 10 | - pip install keras==2.2.4 11 | - python setup.py install 12 | # command to run tests 13 | script: 14 | - pytest --cov=maui/ 15 | after_success: 16 | - codecov 17 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ## [unreleased] - ????-??-?? 4 | 5 | ### Fixed 6 | 7 | - Fixed a bug in fine-tuning models that were pre-trained, when the pre-trained model is first deserialized from disk. 8 | 9 | ## [0.1.7] - 2019-10-08 10 | 11 | - `maui_model.transform()` no longer automatically computes feature correlations. Added a method `maui_model.get_feature_correlations()` to use when this is desirable. This is a huge performance enhancement when feature correlations aren't necessary. 12 | -------------------------------------------------------------------------------- /doc/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 | SOURCEDIR = . 8 | BUILDDIR = _build 9 | 10 | # Put it first so that "make" without argument is like "make help". 11 | help: 12 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 13 | 14 | .PHONY: help Makefile 15 | 16 | # Catch-all target: route all unknown targets to Sphinx using the new 17 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 18 | %: Makefile 19 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) -------------------------------------------------------------------------------- /doc/_build/doctrees/autoencoder-integration.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/doctrees/autoencoder-integration.doctree -------------------------------------------------------------------------------- /doc/_build/doctrees/data-normalization.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/doctrees/data-normalization.doctree -------------------------------------------------------------------------------- /doc/_build/doctrees/environment.pickle: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/doctrees/environment.pickle -------------------------------------------------------------------------------- /doc/_build/doctrees/filtering-and-merging-latent-factors.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/doctrees/filtering-and-merging-latent-factors.doctree -------------------------------------------------------------------------------- /doc/_build/doctrees/index.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/doctrees/index.doctree -------------------------------------------------------------------------------- /doc/_build/doctrees/maui.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/doctrees/maui.doctree -------------------------------------------------------------------------------- /doc/_build/doctrees/saving-and-loading-models.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/doctrees/saving-and-loading-models.doctree -------------------------------------------------------------------------------- /doc/_build/doctrees/utils.doctree: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/doctrees/utils.doctree -------------------------------------------------------------------------------- /doc/_build/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: c43a4816b99b5dc9cdac2f6e58de33c9 4 | tags: 645f666f9bcd5a90fca523b33c5a78b7 5 | -------------------------------------------------------------------------------- /doc/_build/html/_images/colinearity-merged.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_images/colinearity-merged.png -------------------------------------------------------------------------------- /doc/_build/html/_images/colinearity.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_images/colinearity.png -------------------------------------------------------------------------------- /doc/_build/html/_images/hist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_images/hist.png -------------------------------------------------------------------------------- /doc/_build/html/_images/integration-autoencoder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_images/integration-autoencoder.png -------------------------------------------------------------------------------- /doc/_build/html/_modules/_io.html: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 |
7 | 8 | 9 |
35 |
36 |
35 |
36 |
35 | """The io module provides the Python interfaces to stream handling. The
36 | builtin open function is defined in this module.
37 |
38 | At the top of the I/O hierarchy is the abstract base class IOBase. It
39 | defines the basic interface to a stream. Note, however, that there is no
40 | separation between reading and writing to streams; implementations are
41 | allowed to raise an OSError if they do not support a given operation.
42 |
43 | Extending IOBase is RawIOBase which deals simply with the reading and
44 | writing of raw bytes to a stream. FileIO subclasses RawIOBase to provide
45 | an interface to OS files.
46 |
47 | BufferedIOBase deals with buffering on a raw byte stream (RawIOBase). Its
48 | subclasses, BufferedWriter, BufferedReader, and BufferedRWPair buffer
49 | streams that are readable, writable, and both respectively.
50 | BufferedRandom provides a buffered interface to random access
51 | streams. BytesIO is a simple stream of in-memory bytes.
52 |
53 | Another IOBase subclass, TextIOBase, deals with the encoding and decoding
54 | of streams into text. TextIOWrapper, which extends it, is a buffered text
55 | interface to a buffered raw stream (`BufferedIOBase`). Finally, StringIO
56 | is an in-memory stream for text.
57 |
58 | Argument names are not part of the specification, and only the arguments
59 | of open() are intended to be used as keyword arguments.
60 |
61 | data:
62 |
63 | DEFAULT_BUFFER_SIZE
64 |
65 | An int containing the default buffer size used by the module's buffered
66 | I/O classes. open() uses the file's blksize (as obtained by os.stat) if
67 | possible.
68 | """
69 | # New I/O library conforming to PEP 3116.
70 |
71 | __author__ = ("Guido van Rossum <guido@python.org>, "
72 | "Mike Verdone <mike.verdone@gmail.com>, "
73 | "Mark Russell <mark.russell@zen.co.uk>, "
74 | "Antoine Pitrou <solipsis@pitrou.net>, "
75 | "Amaury Forgeot d'Arc <amauryfa@gmail.com>, "
76 | "Benjamin Peterson <benjamin@python.org>")
77 |
78 | __all__ = ["BlockingIOError", "open", "IOBase", "RawIOBase", "FileIO",
79 | "BytesIO", "StringIO", "BufferedIOBase",
80 | "BufferedReader", "BufferedWriter", "BufferedRWPair",
81 | "BufferedRandom", "TextIOBase", "TextIOWrapper",
82 | "UnsupportedOperation", "SEEK_SET", "SEEK_CUR", "SEEK_END"]
83 |
84 |
85 | import _io
86 | import abc
87 |
88 | from _io import (DEFAULT_BUFFER_SIZE, BlockingIOError, UnsupportedOperation,
89 | open, FileIO, BytesIO, StringIO, BufferedReader,
90 | BufferedWriter, BufferedRWPair, BufferedRandom,
91 | IncrementalNewlineDecoder, TextIOWrapper)
92 |
93 | OpenWrapper = _io.open # for compatibility with _pyio
94 |
95 | # Pretend this exception was created here.
96 | UnsupportedOperation.__module__ = "io"
97 |
98 | # for seek()
99 | SEEK_SET = 0
100 | SEEK_CUR = 1
101 | SEEK_END = 2
102 |
103 | # Declaring ABCs in C is tricky so we do it here.
104 | # Method descriptions and default implementations are inherited from the C
105 | # version however.
106 |
108 |
109 |
111 |
112 | [docs]class BufferedIOBase(_io._BufferedIOBase, IOBase):
113 | __doc__ = _io._BufferedIOBase.__doc__
114 |
115 |
117 |
118 | RawIOBase.register(FileIO)
119 |
120 | for klass in (BytesIO, BufferedReader, BufferedWriter, BufferedRandom,
121 | BufferedRWPair):
122 | BufferedIOBase.register(klass)
123 |
124 | for klass in (StringIO, TextIOWrapper):
125 | TextIOBase.register(klass)
126 | del klass
127 |
128 | try:
129 | from _io import _WindowsConsoleIO
130 | except ImportError:
131 | pass
132 | else:
133 | RawIOBase.register(_WindowsConsoleIO)
134 |
' + _('Hide Search Matches') + '
') 235 | .appendTo($('#searchbox')); 236 | } 237 | }, 238 | 239 | /** 240 | * init the domain index toggle buttons 241 | */ 242 | initIndexTable : function() { 243 | var togglers = $('img.toggler').click(function() { 244 | var src = $(this).attr('src'); 245 | var idnum = $(this).attr('id').substr(7); 246 | $('tr.cg-' + idnum).toggle(); 247 | if (src.substr(-9) === 'minus.png') 248 | $(this).attr('src', src.substr(0, src.length-9) + 'plus.png'); 249 | else 250 | $(this).attr('src', src.substr(0, src.length-8) + 'minus.png'); 251 | }).css('display', ''); 252 | if (DOCUMENTATION_OPTIONS.COLLAPSE_INDEX) { 253 | togglers.click(); 254 | } 255 | }, 256 | 257 | /** 258 | * helper function to hide the search marks again 259 | */ 260 | hideSearchWords : function() { 261 | $('#searchbox .highlight-link').fadeOut(300); 262 | $('span.highlighted').removeClass('highlighted'); 263 | }, 264 | 265 | /** 266 | * make the url absolute 267 | */ 268 | makeURL : function(relativeURL) { 269 | return DOCUMENTATION_OPTIONS.URL_ROOT + '/' + relativeURL; 270 | }, 271 | 272 | /** 273 | * get the current relative url 274 | */ 275 | getCurrentURL : function() { 276 | var path = document.location.pathname; 277 | var parts = path.split(/\//); 278 | $.each(DOCUMENTATION_OPTIONS.URL_ROOT.split(/\//), function() { 279 | if (this === '..') 280 | parts.pop(); 281 | }); 282 | var url = parts.join('/'); 283 | return path.substring(url.lastIndexOf('/') + 1, path.length - 1); 284 | }, 285 | 286 | initOnKeyListeners: function() { 287 | $(document).keyup(function(event) { 288 | var activeElementType = document.activeElement.tagName; 289 | // don't navigate when in search box or textarea 290 | if (activeElementType !== 'TEXTAREA' && activeElementType !== 'INPUT' && activeElementType !== 'SELECT') { 291 | switch (event.keyCode) { 292 | case 37: // left 293 | var prevHref = $('link[rel="prev"]').prop('href'); 294 | if (prevHref) { 295 | window.location.href = prevHref; 296 | return false; 297 | } 298 | case 39: // right 299 | var nextHref = $('link[rel="next"]').prop('href'); 300 | if (nextHref) { 301 | window.location.href = nextHref; 302 | return false; 303 | } 304 | } 305 | } 306 | }); 307 | } 308 | }; 309 | 310 | // quick alias for translations 311 | _ = Documentation.gettext; 312 | 313 | $(document).ready(function() { 314 | Documentation.init(); 315 | }); 316 | -------------------------------------------------------------------------------- /doc/_build/html/_static/documentation_options.js: -------------------------------------------------------------------------------- 1 | var DOCUMENTATION_OPTIONS = { 2 | URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), 3 | VERSION: '0.1', 4 | LANGUAGE: 'None', 5 | COLLAPSE_INDEX: false, 6 | FILE_SUFFIX: '.html', 7 | HAS_SOURCE: true, 8 | SOURCELINK_SUFFIX: '.txt', 9 | NAVIGATION_WITH_KEYS: false, 10 | SEARCH_LANGUAGE_STOP_WORDS: ["a","and","are","as","at","be","but","by","for","if","in","into","is","it","near","no","not","of","on","or","such","that","the","their","then","there","these","they","this","to","was","will","with"] 11 | }; 12 | 13 | 14 | 15 | /* Non-minified version JS is _stemmer.js if file is provided */ 16 | /** 17 | * Porter Stemmer 18 | */ 19 | var Stemmer = function() { 20 | 21 | var step2list = { 22 | ational: 'ate', 23 | tional: 'tion', 24 | enci: 'ence', 25 | anci: 'ance', 26 | izer: 'ize', 27 | bli: 'ble', 28 | alli: 'al', 29 | entli: 'ent', 30 | eli: 'e', 31 | ousli: 'ous', 32 | ization: 'ize', 33 | ation: 'ate', 34 | ator: 'ate', 35 | alism: 'al', 36 | iveness: 'ive', 37 | fulness: 'ful', 38 | ousness: 'ous', 39 | aliti: 'al', 40 | iviti: 'ive', 41 | biliti: 'ble', 42 | logi: 'log' 43 | }; 44 | 45 | var step3list = { 46 | icate: 'ic', 47 | ative: '', 48 | alize: 'al', 49 | iciti: 'ic', 50 | ical: 'ic', 51 | ful: '', 52 | ness: '' 53 | }; 54 | 55 | var c = "[^aeiou]"; // consonant 56 | var v = "[aeiouy]"; // vowel 57 | var C = c + "[^aeiouy]*"; // consonant sequence 58 | var V = v + "[aeiou]*"; // vowel sequence 59 | 60 | var mgr0 = "^(" + C + ")?" + V + C; // [C]VC... is m>0 61 | var meq1 = "^(" + C + ")?" + V + C + "(" + V + ")?$"; // [C]VC[V] is m=1 62 | var mgr1 = "^(" + C + ")?" + V + C + V + C; // [C]VCVC... is m>1 63 | var s_v = "^(" + C + ")?" + v; // vowel in stem 64 | 65 | this.stemWord = function (w) { 66 | var stem; 67 | var suffix; 68 | var firstch; 69 | var origword = w; 70 | 71 | if (w.length < 3) 72 | return w; 73 | 74 | var re; 75 | var re2; 76 | var re3; 77 | var re4; 78 | 79 | firstch = w.substr(0,1); 80 | if (firstch == "y") 81 | w = firstch.toUpperCase() + w.substr(1); 82 | 83 | // Step 1a 84 | re = /^(.+?)(ss|i)es$/; 85 | re2 = /^(.+?)([^s])s$/; 86 | 87 | if (re.test(w)) 88 | w = w.replace(re,"$1$2"); 89 | else if (re2.test(w)) 90 | w = w.replace(re2,"$1$2"); 91 | 92 | // Step 1b 93 | re = /^(.+?)eed$/; 94 | re2 = /^(.+?)(ed|ing)$/; 95 | if (re.test(w)) { 96 | var fp = re.exec(w); 97 | re = new RegExp(mgr0); 98 | if (re.test(fp[1])) { 99 | re = /.$/; 100 | w = w.replace(re,""); 101 | } 102 | } 103 | else if (re2.test(w)) { 104 | var fp = re2.exec(w); 105 | stem = fp[1]; 106 | re2 = new RegExp(s_v); 107 | if (re2.test(stem)) { 108 | w = stem; 109 | re2 = /(at|bl|iz)$/; 110 | re3 = new RegExp("([^aeiouylsz])\\1$"); 111 | re4 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 112 | if (re2.test(w)) 113 | w = w + "e"; 114 | else if (re3.test(w)) { 115 | re = /.$/; 116 | w = w.replace(re,""); 117 | } 118 | else if (re4.test(w)) 119 | w = w + "e"; 120 | } 121 | } 122 | 123 | // Step 1c 124 | re = /^(.+?)y$/; 125 | if (re.test(w)) { 126 | var fp = re.exec(w); 127 | stem = fp[1]; 128 | re = new RegExp(s_v); 129 | if (re.test(stem)) 130 | w = stem + "i"; 131 | } 132 | 133 | // Step 2 134 | re = /^(.+?)(ational|tional|enci|anci|izer|bli|alli|entli|eli|ousli|ization|ation|ator|alism|iveness|fulness|ousness|aliti|iviti|biliti|logi)$/; 135 | if (re.test(w)) { 136 | var fp = re.exec(w); 137 | stem = fp[1]; 138 | suffix = fp[2]; 139 | re = new RegExp(mgr0); 140 | if (re.test(stem)) 141 | w = stem + step2list[suffix]; 142 | } 143 | 144 | // Step 3 145 | re = /^(.+?)(icate|ative|alize|iciti|ical|ful|ness)$/; 146 | if (re.test(w)) { 147 | var fp = re.exec(w); 148 | stem = fp[1]; 149 | suffix = fp[2]; 150 | re = new RegExp(mgr0); 151 | if (re.test(stem)) 152 | w = stem + step3list[suffix]; 153 | } 154 | 155 | // Step 4 156 | re = /^(.+?)(al|ance|ence|er|ic|able|ible|ant|ement|ment|ent|ou|ism|ate|iti|ous|ive|ize)$/; 157 | re2 = /^(.+?)(s|t)(ion)$/; 158 | if (re.test(w)) { 159 | var fp = re.exec(w); 160 | stem = fp[1]; 161 | re = new RegExp(mgr1); 162 | if (re.test(stem)) 163 | w = stem; 164 | } 165 | else if (re2.test(w)) { 166 | var fp = re2.exec(w); 167 | stem = fp[1] + fp[2]; 168 | re2 = new RegExp(mgr1); 169 | if (re2.test(stem)) 170 | w = stem; 171 | } 172 | 173 | // Step 5 174 | re = /^(.+?)e$/; 175 | if (re.test(w)) { 176 | var fp = re.exec(w); 177 | stem = fp[1]; 178 | re = new RegExp(mgr1); 179 | re2 = new RegExp(meq1); 180 | re3 = new RegExp("^" + C + v + "[^aeiouwxy]$"); 181 | if (re.test(stem) || (re2.test(stem) && !(re3.test(stem)))) 182 | w = stem; 183 | } 184 | re = /ll$/; 185 | re2 = new RegExp(mgr1); 186 | if (re.test(w) && re2.test(w)) { 187 | re = /.$/; 188 | w = w.replace(re,""); 189 | } 190 | 191 | // and turn initial Y back to y 192 | if (firstch == "y") 193 | w = firstch.toLowerCase() + w.substr(1); 194 | return w; 195 | } 196 | } 197 | 198 | 199 | 200 | 201 | 202 | var splitChars = (function() { 203 | var result = {}; 204 | var singles = [96, 180, 187, 191, 215, 247, 749, 885, 903, 907, 909, 930, 1014, 1648, 205 | 1748, 1809, 2416, 2473, 2481, 2526, 2601, 2609, 2612, 2615, 2653, 2702, 206 | 2706, 2729, 2737, 2740, 2857, 2865, 2868, 2910, 2928, 2948, 2961, 2971, 207 | 2973, 3085, 3089, 3113, 3124, 3213, 3217, 3241, 3252, 3295, 3341, 3345, 208 | 3369, 3506, 3516, 3633, 3715, 3721, 3736, 3744, 3748, 3750, 3756, 3761, 209 | 3781, 3912, 4239, 4347, 4681, 4695, 4697, 4745, 4785, 4799, 4801, 4823, 210 | 4881, 5760, 5901, 5997, 6313, 7405, 8024, 8026, 8028, 8030, 8117, 8125, 211 | 8133, 8181, 8468, 8485, 8487, 8489, 8494, 8527, 11311, 11359, 11687, 11695, 212 | 11703, 11711, 11719, 11727, 11735, 12448, 12539, 43010, 43014, 43019, 43587, 213 | 43696, 43713, 64286, 64297, 64311, 64317, 64319, 64322, 64325, 65141]; 214 | var i, j, start, end; 215 | for (i = 0; i < singles.length; i++) { 216 | result[singles[i]] = true; 217 | } 218 | var ranges = [[0, 47], [58, 64], [91, 94], [123, 169], [171, 177], [182, 184], [706, 709], 219 | [722, 735], [741, 747], [751, 879], [888, 889], [894, 901], [1154, 1161], 220 | [1318, 1328], [1367, 1368], [1370, 1376], [1416, 1487], [1515, 1519], [1523, 1568], 221 | [1611, 1631], [1642, 1645], [1750, 1764], [1767, 1773], [1789, 1790], [1792, 1807], 222 | [1840, 1868], [1958, 1968], [1970, 1983], [2027, 2035], [2038, 2041], [2043, 2047], 223 | [2070, 2073], [2075, 2083], [2085, 2087], [2089, 2307], [2362, 2364], [2366, 2383], 224 | [2385, 2391], [2402, 2405], [2419, 2424], [2432, 2436], [2445, 2446], [2449, 2450], 225 | [2483, 2485], [2490, 2492], [2494, 2509], [2511, 2523], [2530, 2533], [2546, 2547], 226 | [2554, 2564], [2571, 2574], [2577, 2578], [2618, 2648], [2655, 2661], [2672, 2673], 227 | [2677, 2692], [2746, 2748], [2750, 2767], [2769, 2783], [2786, 2789], [2800, 2820], 228 | [2829, 2830], [2833, 2834], [2874, 2876], [2878, 2907], [2914, 2917], [2930, 2946], 229 | [2955, 2957], [2966, 2968], [2976, 2978], [2981, 2983], [2987, 2989], [3002, 3023], 230 | [3025, 3045], [3059, 3076], [3130, 3132], [3134, 3159], [3162, 3167], [3170, 3173], 231 | [3184, 3191], [3199, 3204], [3258, 3260], [3262, 3293], [3298, 3301], [3312, 3332], 232 | [3386, 3388], [3390, 3423], [3426, 3429], [3446, 3449], [3456, 3460], [3479, 3481], 233 | [3518, 3519], [3527, 3584], [3636, 3647], [3655, 3663], [3674, 3712], [3717, 3718], 234 | [3723, 3724], [3726, 3731], [3752, 3753], [3764, 3772], [3774, 3775], [3783, 3791], 235 | [3802, 3803], [3806, 3839], [3841, 3871], [3892, 3903], [3949, 3975], [3980, 4095], 236 | [4139, 4158], [4170, 4175], [4182, 4185], [4190, 4192], [4194, 4196], [4199, 4205], 237 | [4209, 4212], [4226, 4237], [4250, 4255], [4294, 4303], [4349, 4351], [4686, 4687], 238 | [4702, 4703], [4750, 4751], [4790, 4791], [4806, 4807], [4886, 4887], [4955, 4968], 239 | [4989, 4991], [5008, 5023], [5109, 5120], [5741, 5742], [5787, 5791], [5867, 5869], 240 | [5873, 5887], [5906, 5919], [5938, 5951], [5970, 5983], [6001, 6015], [6068, 6102], 241 | [6104, 6107], [6109, 6111], [6122, 6127], [6138, 6159], [6170, 6175], [6264, 6271], 242 | [6315, 6319], [6390, 6399], [6429, 6469], [6510, 6511], [6517, 6527], [6572, 6592], 243 | [6600, 6607], [6619, 6655], [6679, 6687], [6741, 6783], [6794, 6799], [6810, 6822], 244 | [6824, 6916], [6964, 6980], [6988, 6991], [7002, 7042], [7073, 7085], [7098, 7167], 245 | [7204, 7231], [7242, 7244], [7294, 7400], [7410, 7423], [7616, 7679], [7958, 7959], 246 | [7966, 7967], [8006, 8007], [8014, 8015], [8062, 8063], [8127, 8129], [8141, 8143], 247 | [8148, 8149], [8156, 8159], [8173, 8177], [8189, 8303], [8306, 8307], [8314, 8318], 248 | [8330, 8335], [8341, 8449], [8451, 8454], [8456, 8457], [8470, 8472], [8478, 8483], 249 | [8506, 8507], [8512, 8516], [8522, 8525], [8586, 9311], [9372, 9449], [9472, 10101], 250 | [10132, 11263], [11493, 11498], [11503, 11516], [11518, 11519], [11558, 11567], 251 | [11622, 11630], [11632, 11647], [11671, 11679], [11743, 11822], [11824, 12292], 252 | [12296, 12320], [12330, 12336], [12342, 12343], [12349, 12352], [12439, 12444], 253 | [12544, 12548], [12590, 12592], [12687, 12689], [12694, 12703], [12728, 12783], 254 | [12800, 12831], [12842, 12880], [12896, 12927], [12938, 12976], [12992, 13311], 255 | [19894, 19967], [40908, 40959], [42125, 42191], [42238, 42239], [42509, 42511], 256 | [42540, 42559], [42592, 42593], [42607, 42622], [42648, 42655], [42736, 42774], 257 | [42784, 42785], [42889, 42890], [42893, 43002], [43043, 43055], [43062, 43071], 258 | [43124, 43137], [43188, 43215], [43226, 43249], [43256, 43258], [43260, 43263], 259 | [43302, 43311], [43335, 43359], [43389, 43395], [43443, 43470], [43482, 43519], 260 | [43561, 43583], [43596, 43599], [43610, 43615], [43639, 43641], [43643, 43647], 261 | [43698, 43700], [43703, 43704], [43710, 43711], [43715, 43738], [43742, 43967], 262 | [44003, 44015], [44026, 44031], [55204, 55215], [55239, 55242], [55292, 55295], 263 | [57344, 63743], [64046, 64047], [64110, 64111], [64218, 64255], [64263, 64274], 264 | [64280, 64284], [64434, 64466], [64830, 64847], [64912, 64913], [64968, 65007], 265 | [65020, 65135], [65277, 65295], [65306, 65312], [65339, 65344], [65371, 65381], 266 | [65471, 65473], [65480, 65481], [65488, 65489], [65496, 65497]]; 267 | for (i = 0; i < ranges.length; i++) { 268 | start = ranges[i][0]; 269 | end = ranges[i][1]; 270 | for (j = start; j <= end; j++) { 271 | result[j] = true; 272 | } 273 | } 274 | return result; 275 | })(); 276 | 277 | function splitQuery(query) { 278 | var result = []; 279 | var start = -1; 280 | for (var i = 0; i < query.length; i++) { 281 | if (splitChars[query.charCodeAt(i)]) { 282 | if (start !== -1) { 283 | result.push(query.slice(start, i)); 284 | start = -1; 285 | } 286 | } else if (start === -1) { 287 | start = i; 288 | } 289 | } 290 | if (start !== -1) { 291 | result.push(query.slice(start)); 292 | } 293 | return result; 294 | } 295 | 296 | 297 | -------------------------------------------------------------------------------- /doc/_build/html/_static/down-pressed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/down-pressed.png -------------------------------------------------------------------------------- /doc/_build/html/_static/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/down.png -------------------------------------------------------------------------------- /doc/_build/html/_static/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/file.png -------------------------------------------------------------------------------- /doc/_build/html/_static/hex-maui-120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/hex-maui-120.png -------------------------------------------------------------------------------- /doc/_build/html/_static/hex-maui-200.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/hex-maui-200.png -------------------------------------------------------------------------------- /doc/_build/html/_static/hex-maui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/hex-maui.png -------------------------------------------------------------------------------- /doc/_build/html/_static/hist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/hist.png -------------------------------------------------------------------------------- /doc/_build/html/_static/icons8-beach-30.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/icons8-beach-30.png -------------------------------------------------------------------------------- /doc/_build/html/_static/integration-autoencoder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/integration-autoencoder.png -------------------------------------------------------------------------------- /doc/_build/html/_static/minus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/minus.png -------------------------------------------------------------------------------- /doc/_build/html/_static/plus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/BIMSBbioinfo/maui/7d329c736b681216093fd725b134a68e6e914c8e/doc/_build/html/_static/plus.png -------------------------------------------------------------------------------- /doc/_build/html/_static/pygments.css: -------------------------------------------------------------------------------- 1 | .highlight .hll { background-color: #ffffcc } 2 | .highlight { background: #f8f8f8; } 3 | .highlight .c { color: #8f5902; font-style: italic } /* Comment */ 4 | .highlight .err { color: #a40000; border: 1px solid #ef2929 } /* Error */ 5 | .highlight .g { color: #000000 } /* Generic */ 6 | .highlight .k { color: #004461; font-weight: bold } /* Keyword */ 7 | .highlight .l { color: #000000 } /* Literal */ 8 | .highlight .n { color: #000000 } /* Name */ 9 | .highlight .o { color: #582800 } /* Operator */ 10 | .highlight .x { color: #000000 } /* Other */ 11 | .highlight .p { color: #000000; font-weight: bold } /* Punctuation */ 12 | .highlight .ch { color: #8f5902; font-style: italic } /* Comment.Hashbang */ 13 | .highlight .cm { color: #8f5902; font-style: italic } /* Comment.Multiline */ 14 | .highlight .cp { color: #8f5902 } /* Comment.Preproc */ 15 | .highlight .cpf { color: #8f5902; font-style: italic } /* Comment.PreprocFile */ 16 | .highlight .c1 { color: #8f5902; font-style: italic } /* Comment.Single */ 17 | .highlight .cs { color: #8f5902; font-style: italic } /* Comment.Special */ 18 | .highlight .gd { color: #a40000 } /* Generic.Deleted */ 19 | .highlight .ge { color: #000000; font-style: italic } /* Generic.Emph */ 20 | .highlight .gr { color: #ef2929 } /* Generic.Error */ 21 | .highlight .gh { color: #000080; font-weight: bold } /* Generic.Heading */ 22 | .highlight .gi { color: #00A000 } /* Generic.Inserted */ 23 | .highlight .go { color: #888888 } /* Generic.Output */ 24 | .highlight .gp { color: #745334 } /* Generic.Prompt */ 25 | .highlight .gs { color: #000000; font-weight: bold } /* Generic.Strong */ 26 | .highlight .gu { color: #800080; font-weight: bold } /* Generic.Subheading */ 27 | .highlight .gt { color: #a40000; font-weight: bold } /* Generic.Traceback */ 28 | .highlight .kc { color: #004461; font-weight: bold } /* Keyword.Constant */ 29 | .highlight .kd { color: #004461; font-weight: bold } /* Keyword.Declaration */ 30 | .highlight .kn { color: #004461; font-weight: bold } /* Keyword.Namespace */ 31 | .highlight .kp { color: #004461; font-weight: bold } /* Keyword.Pseudo */ 32 | .highlight .kr { color: #004461; font-weight: bold } /* Keyword.Reserved */ 33 | .highlight .kt { color: #004461; font-weight: bold } /* Keyword.Type */ 34 | .highlight .ld { color: #000000 } /* Literal.Date */ 35 | .highlight .m { color: #990000 } /* Literal.Number */ 36 | .highlight .s { color: #4e9a06 } /* Literal.String */ 37 | .highlight .na { color: #c4a000 } /* Name.Attribute */ 38 | .highlight .nb { color: #004461 } /* Name.Builtin */ 39 | .highlight .nc { color: #000000 } /* Name.Class */ 40 | .highlight .no { color: #000000 } /* Name.Constant */ 41 | .highlight .nd { color: #888888 } /* Name.Decorator */ 42 | .highlight .ni { color: #ce5c00 } /* Name.Entity */ 43 | .highlight .ne { color: #cc0000; font-weight: bold } /* Name.Exception */ 44 | .highlight .nf { color: #000000 } /* Name.Function */ 45 | .highlight .nl { color: #f57900 } /* Name.Label */ 46 | .highlight .nn { color: #000000 } /* Name.Namespace */ 47 | .highlight .nx { color: #000000 } /* Name.Other */ 48 | .highlight .py { color: #000000 } /* Name.Property */ 49 | .highlight .nt { color: #004461; font-weight: bold } /* Name.Tag */ 50 | .highlight .nv { color: #000000 } /* Name.Variable */ 51 | .highlight .ow { color: #004461; font-weight: bold } /* Operator.Word */ 52 | .highlight .w { color: #f8f8f8; text-decoration: underline } /* Text.Whitespace */ 53 | .highlight .mb { color: #990000 } /* Literal.Number.Bin */ 54 | .highlight .mf { color: #990000 } /* Literal.Number.Float */ 55 | .highlight .mh { color: #990000 } /* Literal.Number.Hex */ 56 | .highlight .mi { color: #990000 } /* Literal.Number.Integer */ 57 | .highlight .mo { color: #990000 } /* Literal.Number.Oct */ 58 | .highlight .sa { color: #4e9a06 } /* Literal.String.Affix */ 59 | .highlight .sb { color: #4e9a06 } /* Literal.String.Backtick */ 60 | .highlight .sc { color: #4e9a06 } /* Literal.String.Char */ 61 | .highlight .dl { color: #4e9a06 } /* Literal.String.Delimiter */ 62 | .highlight .sd { color: #8f5902; font-style: italic } /* Literal.String.Doc */ 63 | .highlight .s2 { color: #4e9a06 } /* Literal.String.Double */ 64 | .highlight .se { color: #4e9a06 } /* Literal.String.Escape */ 65 | .highlight .sh { color: #4e9a06 } /* Literal.String.Heredoc */ 66 | .highlight .si { color: #4e9a06 } /* Literal.String.Interpol */ 67 | .highlight .sx { color: #4e9a06 } /* Literal.String.Other */ 68 | .highlight .sr { color: #4e9a06 } /* Literal.String.Regex */ 69 | .highlight .s1 { color: #4e9a06 } /* Literal.String.Single */ 70 | .highlight .ss { color: #4e9a06 } /* Literal.String.Symbol */ 71 | .highlight .bp { color: #3465a4 } /* Name.Builtin.Pseudo */ 72 | .highlight .fm { color: #000000 } /* Name.Function.Magic */ 73 | .highlight .vc { color: #000000 } /* Name.Variable.Class */ 74 | .highlight .vg { color: #000000 } /* Name.Variable.Global */ 75 | .highlight .vi { color: #000000 } /* Name.Variable.Instance */ 76 | .highlight .vm { color: #000000 } /* Name.Variable.Magic */ 77 | .highlight .il { color: #990000 } /* Literal.Number.Integer.Long */ -------------------------------------------------------------------------------- /doc/_build/html/_static/sidebar.js: -------------------------------------------------------------------------------- 1 | /* 2 | * sidebar.js 3 | * ~~~~~~~~~~ 4 | * 5 | * This script makes the Sphinx sidebar collapsible. 6 | * 7 | * .sphinxsidebar contains .sphinxsidebarwrapper. This script adds 8 | * in .sphixsidebar, after .sphinxsidebarwrapper, the #sidebarbutton 9 | * used to collapse and expand the sidebar. 10 | * 11 | * When the sidebar is collapsed the .sphinxsidebarwrapper is hidden 12 | * and the width of the sidebar and the margin-left of the document 13 | * are decreased. When the sidebar is expanded the opposite happens. 14 | * This script saves a per-browser/per-session cookie used to 15 | * remember the position of the sidebar among the pages. 16 | * Once the browser is closed the cookie is deleted and the position 17 | * reset to the default (expanded). 18 | * 19 | * :copyright: Copyright 2007-2018 by the Sphinx team, see AUTHORS. 20 | * :license: BSD, see LICENSE for details. 21 | * 22 | */ 23 | 24 | $(function() { 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | // global elements used by the functions. 34 | // the 'sidebarbutton' element is defined as global after its 35 | // creation, in the add_sidebar_button function 36 | var bodywrapper = $('.bodywrapper'); 37 | var sidebar = $('.sphinxsidebar'); 38 | var sidebarwrapper = $('.sphinxsidebarwrapper'); 39 | 40 | // for some reason, the document has no sidebar; do not run into errors 41 | if (!sidebar.length) return; 42 | 43 | // original margin-left of the bodywrapper and width of the sidebar 44 | // with the sidebar expanded 45 | var bw_margin_expanded = bodywrapper.css('margin-left'); 46 | var ssb_width_expanded = sidebar.width(); 47 | 48 | // margin-left of the bodywrapper and width of the sidebar 49 | // with the sidebar collapsed 50 | var bw_margin_collapsed = '.8em'; 51 | var ssb_width_collapsed = '.8em'; 52 | 53 | // colors used by the current theme 54 | var dark_color = $('.related').css('background-color'); 55 | var light_color = $('.document').css('background-color'); 56 | 57 | function sidebar_is_collapsed() { 58 | return sidebarwrapper.is(':not(:visible)'); 59 | } 60 | 61 | function toggle_sidebar() { 62 | if (sidebar_is_collapsed()) 63 | expand_sidebar(); 64 | else 65 | collapse_sidebar(); 66 | } 67 | 68 | function collapse_sidebar() { 69 | sidebarwrapper.hide(); 70 | sidebar.css('width', ssb_width_collapsed); 71 | bodywrapper.css('margin-left', bw_margin_collapsed); 72 | sidebarbutton.css({ 73 | 'margin-left': '0', 74 | 'height': bodywrapper.height() 75 | }); 76 | sidebarbutton.find('span').text('»'); 77 | sidebarbutton.attr('title', _('Expand sidebar')); 78 | document.cookie = 'sidebar=collapsed'; 79 | } 80 | 81 | function expand_sidebar() { 82 | bodywrapper.css('margin-left', bw_margin_expanded); 83 | sidebar.css('width', ssb_width_expanded); 84 | sidebarwrapper.show(); 85 | sidebarbutton.css({ 86 | 'margin-left': ssb_width_expanded-12, 87 | 'height': bodywrapper.height() 88 | }); 89 | sidebarbutton.find('span').text('«'); 90 | sidebarbutton.attr('title', _('Collapse sidebar')); 91 | document.cookie = 'sidebar=expanded'; 92 | } 93 | 94 | function add_sidebar_button() { 95 | sidebarwrapper.css({ 96 | 'float': 'left', 97 | 'margin-right': '0', 98 | 'width': ssb_width_expanded - 28 99 | }); 100 | // create the button 101 | sidebar.append( 102 | ' ' 103 | ); 104 | var sidebarbutton = $('#sidebarbutton'); 105 | light_color = sidebarbutton.css('background-color'); 106 | // find the height of the viewport to center the '<<' in the page 107 | var viewport_height; 108 | if (window.innerHeight) 109 | viewport_height = window.innerHeight; 110 | else 111 | viewport_height = $(window).height(); 112 | sidebarbutton.find('span').css({ 113 | 'display': 'block', 114 | 'margin-top': (viewport_height - sidebar.position().top - 20) / 2 115 | }); 116 | 117 | sidebarbutton.click(toggle_sidebar); 118 | sidebarbutton.attr('title', _('Collapse sidebar')); 119 | sidebarbutton.css({ 120 | 'color': '#FFFFFF', 121 | 'border-left': '1px solid ' + dark_color, 122 | 'font-size': '1.2em', 123 | 'cursor': 'pointer', 124 | 'height': bodywrapper.height(), 125 | 'padding-top': '1px', 126 | 'margin-left': ssb_width_expanded - 12 127 | }); 128 | 129 | sidebarbutton.hover( 130 | function () { 131 | $(this).css('background-color', dark_color); 132 | }, 133 | function () { 134 | $(this).css('background-color', light_color); 135 | } 136 | ); 137 | } 138 | 139 | function set_position_from_cookie() { 140 | if (!document.cookie) 141 | return; 142 | var items = document.cookie.split(';'); 143 | for(var k=0; kAutoencoders are hourglass-shaped neural networks that are trained to reconstruct the input data after passing it through a bottleneck layer. Thereby, autoencoders learn an efficient lower dimension representation of high-dimensional data, a “latent factor” representation of the data. The Multi-modal autoencoders take data from different modalities and learn latent factor representations of the data. In the figure below, the direction of data flow is left to right. The three different-colored matrices on the left represent data from three different modalities. The three matrices on the right represent the reconstruction of the input data, and the mixed-color matrix on the bottom represents the latent factor view of the data.
41 |Integration Autoencoder
45 |Maui uses a Variational Autoencoder, which means it learns a bayesian latent variable model. This is achieved by minimizing the following loss function:
48 |\(\mathcal{L} = -\mathbf{E}_{q(z|x)}\big[ log(p(x|z)) \big] + D_{KL}\big( q(z|x)~\|~p(z) \big)\)
49 |The first term represents the cross-entropy reconstruction loss, and the second term is the Kullback-Leibler divergence between the latent factors distribution and a gaussian prior \(p(z)\).
50 |As the figure above indicates, it is possible to insert extra layers between the input and the bottleneck layers, and between the bottleneck and the output layers. This is sometimes called stacked autoencoders. The Maui Class allows this architecture to be varied when instantiating the model, using the n_hidden
parameter. The n_latent
parameter determines the size of the bottleneck layer (latent factor layer).
maui_model = maui.Maui(n_hidden=[900], n_latent=70)
55 |
instantiates a Maui model with one hidden layer with 900 units, and 70 units in the bottleneck layer, while
58 |maui_model = maui.Maui(n_hidden=[1300, 900], n_latent=60)
59 |
will instantiate a maui model with two hidden layers with 1300 and 900 units, respectively.
62 |All features need to be scaled and centered prior to feeding to the neural network of maui. This limitation comes from the fact that the last layer, where the input data is reconstructed, uses Sigmoid activations. Maui uses Batch Normalization during training, where each input feature is normalized at each minibatch. We still recommend that data be scaled prior to training. We provide a function that does this in the Maui Utilities.
41 | 48 | 49 |
|
62 |
|
74 |
|
86 |
|
94 |
|
102 |
|
108 |
|
116 |
|
128 |
|
140 |
|
152 |
|
164 |
|
174 |
|
182 |
maui is an autoencoder-based framework for multi-omics data analysis. It consists of two main modules, The Maui Class, and Maui Utilities. For an introduction of the use of autoencoders for multi-omics integration, see Multi-modal Autoencoders.
40 |The Maui
class implements scikit-learn
’s BaseEstimator
. In order to infer latent factors in multi-omics data, first instantiate a Maui
model with the desired parameters, and then fit it to some data:
from maui import Maui
70 |
71 | maui_model = maui.Maui(n_hidden=[900], n_latent=70, epochs=100)
72 | z = maui_model.fit_transform({'mRNA': gex, 'Mutations': mut, 'CNV': cnv})
73 |
This will instantiate a maui model with one hidden layer of 900 nodes, and a middle layer of 70 nodes, which will be traiend for 100 epochs. It then feeds the multi-omics data in gex
, mut
, and cnv
to the fitting procedure. The omics data (gex
et. al.) are pandas.DataFrame
objects of dimension (n_features, n_samples). The return object z
is a pandas.DataFrame
(n_samples, n_latent), and may be used for further analysis.
In order to check the model’s convergance, the hist
object may be inspected, and plotted:
maui_model.hist.plot()
78 |
For a more comprehensive example, check out our vignette.
82 |49 | m | ||
53 | |
54 | maui | 55 | |
58 | |
59 | maui.utils | 60 | |
Maui models may be saved to disk, so that they may be loaded again at a later time.
41 |Saving a model to disk involves saving two files to a target directory. These files store the model weights and the maui parameters (the arguments the maui model was instantiated with). The Maui Class implements a the save function
44 |maui.Maui.
save
(self, destdir)¶Save a maui model to disk, so that it may be reloaded later using load()
destdir: destination directory in which to save model files
49 |The function takes one required parameter, the destination directory where the two files will be saved. It is called directly on a maui model, like
52 |maui_model.save('/path/to/dir')
53 |
Loading a model involves instantiating a new Maui instance using the parameters that were used on the model that is saved to disk, and then populating the weights of the model to the previously trained weights. Once a model is loaded, it can be used to transform new data to the latent space, or it can be trained further. The Maui Class has a static function to load a model from disk
59 |maui.Maui.
load
(dir)¶Load a maui model from disk, which was previously saved using save()
dir: The directory from which to load the maui model
64 |maui_model: a maui model that was previously saved to disk
65 |It is called directly on the Maui class, like
68 |maui.Maui.load('/path/to/dir')
69 |
49 | Please activate JavaScript to enable the search 50 | functionality. 51 |
52 |54 | From here you can search these documents. Enter your search 55 | words into the box below and click "search". Note that the search 56 | function will automatically search for all of the words. Pages 57 | containing fewer words won't appear in the result list. 58 |
59 | 64 | 65 |