-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmicroscopes.mixture.html
More file actions
711 lines (633 loc) · 40.6 KB
/
microscopes.mixture.html
File metadata and controls
711 lines (633 loc) · 40.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>mixturemodel</title>
<link rel="stylesheet" href="_static/basic.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<link rel="stylesheet" href="_static/bootswatch-3.3.4/lumen/bootstrap.min.css" type="text/css" />
<link rel="stylesheet" href="_static/bootstrap-sphinx.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: './',
VERSION: '0.1.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_HTMLorMML"></script>
<script type="text/javascript" src="_static/js/jquery-1.11.0.min.js"></script>
<script type="text/javascript" src="_static/js/jquery-fix.js"></script>
<script type="text/javascript" src="_static/bootstrap-3.3.4/js/bootstrap.min.js"></script>
<script type="text/javascript" src="_static/bootstrap-sphinx.js"></script>
<link rel="top" title="None" href="index.html" />
<link rel="up" title="API Reference" href="api.html" />
<link rel="next" title="irm" href="microscopes.irm.html" />
<link rel="prev" title="parallel" href="microscopes.kernels.parallel.html" />
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'>
<meta name='viewport' content='width=device-width, initial-scale=1.0, maximum-scale=1'>
<meta name="apple-mobile-web-app-capable" content="yes">
</head>
<body role="document">
<div id="navbar" class="navbar navbar-inverse navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="index.html">
datamicroscopes</a>
<span class="navbar-text navbar-version pull-left"><b>0.1</b></span>
</div>
<div class="collapse navbar-collapse nav-collapse">
<ul class="nav navbar-nav">
<li><a href="https://github.com/datamicroscopes">GitHub</a></li>
<li><a href="https://qadium.com/">Qadium</a></li>
<li class="dropdown globaltoc-container">
<a role="button"
id="dLabelGlobalToc"
data-toggle="dropdown"
data-target="#"
href="index.html">Site <b class="caret"></b></a>
<ul class="dropdown-menu globaltoc"
role="menu"
aria-labelledby="dLabelGlobalToc"><ul>
<li class="toctree-l1"><a class="reference internal" href="intro.html">Discovering structure in your data: an overview of clustering</a></li>
<li class="toctree-l1"><a class="reference internal" href="ncluster.html">Finding the number of clusters with the Dirichlet Process</a></li>
<li class="toctree-l1"><a class="reference internal" href="enron_blog.html">Network Modeling with the Infinite Relational Model</a></li>
<li class="toctree-l1"><a class="reference internal" href="topic.html">Bayesian Nonparametric Topic Modeling with the Daily Kos</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="datatypes.html">Datatypes and Bayesian Nonparametric Models</a></li>
<li class="toctree-l1"><a class="reference internal" href="bb.html">Binary Data with the Beta Bernouli Distribution</a></li>
<li class="toctree-l1"><a class="reference internal" href="dd.html">Categorical Data and the Dirichlet Discrete Distribution</a></li>
<li class="toctree-l1"><a class="reference internal" href="niw.html">Real Valued Data and the Normal Inverse-Wishart Distribution</a></li>
<li class="toctree-l1"><a class="reference internal" href="nic.html">Univariate Data with the Normal Inverse Chi-Square Distribution</a></li>
<li class="toctree-l1"><a class="reference internal" href="gamma_poisson.html">Count Data and Ordinal Data with the Gamma-Poisson Distribution</a></li>
</ul>
<ul>
<li class="toctree-l1"><a class="reference internal" href="gauss2d.html">Inferring Gaussians with the Dirichlet Process Mixture Model</a></li>
<li class="toctree-l1"><a class="reference internal" href="mnist_predictions.html">Digit recognition with the MNIST dataset</a></li>
<li class="toctree-l1"><a class="reference internal" href="enron_email.html">Clustering the Enron e-mail corpus using the Infinite Relational Model</a></li>
<li class="toctree-l1"><a class="reference internal" href="hdp.html">Learning Topics in The Daily Kos with the Hierarchical Dirichlet Process</a></li>
</ul>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="docs.html">Tutorials</a><ul>
<li class="toctree-l2"><a class="reference internal" href="intro.html">Discovering structure in your data: an overview of clustering</a></li>
<li class="toctree-l2"><a class="reference internal" href="ncluster.html">Finding the number of clusters with the Dirichlet Process</a></li>
<li class="toctree-l2"><a class="reference internal" href="enron_blog.html">Network Modeling with the Infinite Relational Model</a></li>
<li class="toctree-l2"><a class="reference internal" href="topic.html">Bayesian Nonparametric Topic Modeling with the Daily Kos</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="docs.html#datatypes-and-likelihood-models-in-datamicroscopes">Datatypes and likelihood models in datamicroscopes</a><ul>
<li class="toctree-l2"><a class="reference internal" href="datatypes.html">Datatypes and Bayesian Nonparametric Models</a></li>
<li class="toctree-l2"><a class="reference internal" href="bb.html">Binary Data with the Beta Bernouli Distribution</a></li>
<li class="toctree-l2"><a class="reference internal" href="dd.html">Categorical Data and the Dirichlet Discrete Distribution</a></li>
<li class="toctree-l2"><a class="reference internal" href="niw.html">Real Valued Data and the Normal Inverse-Wishart Distribution</a></li>
<li class="toctree-l2"><a class="reference internal" href="nic.html">Univariate Data with the Normal Inverse Chi-Square Distribution</a></li>
<li class="toctree-l2"><a class="reference internal" href="gamma_poisson.html">Count Data and Ordinal Data with the Gamma-Poisson Distribution</a></li>
</ul>
</li>
<li class="toctree-l1"><a class="reference internal" href="docs.html#examples">Examples</a><ul>
<li class="toctree-l2"><a class="reference internal" href="gauss2d.html">Inferring Gaussians with the Dirichlet Process Mixture Model</a></li>
<li class="toctree-l2"><a class="reference internal" href="mnist_predictions.html">Digit recognition with the MNIST dataset</a></li>
<li class="toctree-l2"><a class="reference internal" href="enron_email.html">Clustering the Enron e-mail corpus using the Infinite Relational Model</a></li>
<li class="toctree-l2"><a class="reference internal" href="hdp.html">Learning Topics in The Daily Kos with the Hierarchical Dirichlet Process</a></li>
</ul>
</li>
<li class="toctree-l1 current"><a class="reference internal" href="api.html">API Reference</a><ul class="current">
<li class="toctree-l2"><a class="reference internal" href="microscopes.common.dataview.html">dataviews</a></li>
<li class="toctree-l2"><a class="reference internal" href="microscopes.common.util.html">util</a></li>
<li class="toctree-l2"><a class="reference internal" href="microscopes.common.random.html">microscopes.common.random</a></li>
<li class="toctree-l2"><a class="reference internal" href="microscopes.common.query.html">query</a></li>
<li class="toctree-l2"><a class="reference internal" href="microscopes.common.validator.html">microscopes.common.validator</a></li>
<li class="toctree-l2"><a class="reference internal" href="microscopes.kernels.parallel.html">parallel</a></li>
<li class="toctree-l2 current"><a class="current reference internal" href="">mixturemodel</a></li>
<li class="toctree-l2"><a class="reference internal" href="microscopes.irm.html">irm</a></li>
<li class="toctree-l2"><a class="reference internal" href="microscopes.kernels.html">kernels</a></li>
<li class="toctree-l2"><a class="reference internal" href="api.html#indices-and-tables">Indices and tables</a></li>
</ul>
</li>
</ul>
</ul>
</li>
<li class="dropdown">
<a role="button"
id="dLabelLocalToc"
data-toggle="dropdown"
data-target="#"
href="#">Contents <b class="caret"></b></a>
<ul class="dropdown-menu localtoc"
role="menu"
aria-labelledby="dLabelLocalToc"><ul>
<li><a class="reference internal" href="#">mixturemodel</a><ul>
<li><a class="reference internal" href="#module-microscopes.mixture.definition">microscopes.mixture.definition</a></li>
<li><a class="reference internal" href="#module-microscopes.mixture.model">microscopes.mixture.model</a></li>
<li><a class="reference internal" href="#module-microscopes.mixture.runner">microscopes.mixture.runner</a></li>
<li><a class="reference internal" href="#module-microscopes.mixture.query">microscopes.mixture.query</a></li>
</ul>
</li>
</ul>
</ul>
</li>
<li class="hidden-sm">
<div id="sourcelink">
<a href="_sources/microscopes.mixture.txt"
rel="nofollow">Source</a>
</div></li>
</ul>
<form class="navbar-form navbar-right" action="search.html" method="get">
<div class="form-group">
<input type="text" name="q" class="form-control" placeholder="Search" />
</div>
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="section" id="mixturemodel">
<h1>mixturemodel<a class="headerlink" href="#mixturemodel" title="Permalink to this headline">¶</a></h1>
<div class="section" id="module-microscopes.mixture.definition">
<span id="microscopes-mixture-definition"></span><h2>microscopes.mixture.definition<a class="headerlink" href="#module-microscopes.mixture.definition" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="microscopes.mixture.definition.model_definition">
<em class="property">class </em><code class="descclassname">microscopes.mixture.definition.</code><code class="descname">model_definition</code><a class="headerlink" href="#microscopes.mixture.definition.model_definition" title="Permalink to this definition">¶</a></dt>
<dd><p>Structural definition for a dirichlet process mixture model</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>n</strong> : int</p>
<blockquote>
<div><p>Number of observations</p>
</div></blockquote>
<p><strong>models</strong> : iterable of model descriptors</p>
<blockquote>
<div><p>The component likelihood models. Each element is either <cite>x</cite> or
<cite>(x, y)</cite>, where <cite>x</cite> is a <code class="docutils literal"><span class="pre">model_descriptor</span></code> and <cite>y</cite> is a dict
containing the hyperpriors. If <cite>y</cite> is not given, then the default
hyperpriors are used per model.</p>
</div></blockquote>
<p><strong>cluster_hyperprior</strong> : dict, optional</p>
<blockquote class="last">
<div><p>Describes the hyperior for the CRP</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>This class is not meant to be sub-classable.</p>
<dl class="method">
<dt id="microscopes.mixture.definition.model_definition.cluster_hyperprior">
<code class="descname">cluster_hyperprior</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.definition.model_definition.cluster_hyperprior" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.definition.model_definition.hyperpriors">
<code class="descname">hyperpriors</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.definition.model_definition.hyperpriors" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.definition.model_definition.models">
<code class="descname">models</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.definition.model_definition.models" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.definition.model_definition.n">
<code class="descname">n</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.definition.model_definition.n" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
</div>
<div class="section" id="module-microscopes.mixture.model">
<span id="microscopes-mixture-model"></span><h2>microscopes.mixture.model<a class="headerlink" href="#module-microscopes.mixture.model" title="Permalink to this headline">¶</a></h2>
<dl class="class">
<dt id="microscopes.mixture.model.state">
<em class="property">class </em><code class="descclassname">microscopes.mixture.model.</code><code class="descname">state</code><a class="headerlink" href="#microscopes.mixture.model.state" title="Permalink to this definition">¶</a></dt>
<dd><p>The underlying state of a Dirichlet Process mixture model.</p>
<p>You should not explicitly construct a state object.
Instead, use <cite>initialize</cite>.</p>
<dl class="method">
<dt id="microscopes.mixture.model.state.add_value">
<code class="descname">add_value</code><span class="sig-paren">(</span><em>self</em>, <em>int gid</em>, <em>int eid</em>, <em>y</em>, <em>rng r</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.add_value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.assignments">
<code class="descname">assignments</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.assignments" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.create_group">
<code class="descname">create_group</code><span class="sig-paren">(</span><em>self</em>, <em>rng r</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.create_group" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.dcheck_consistency">
<code class="descname">dcheck_consistency</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.dcheck_consistency" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.delete_group">
<code class="descname">delete_group</code><span class="sig-paren">(</span><em>self</em>, <em>int gid</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.delete_group" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.empty_groups">
<code class="descname">empty_groups</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.empty_groups" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.get_cluster_hp">
<code class="descname">get_cluster_hp</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.get_cluster_hp" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.get_feature_dtypes">
<code class="descname">get_feature_dtypes</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.get_feature_dtypes" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.get_feature_hp">
<code class="descname">get_feature_hp</code><span class="sig-paren">(</span><em>self</em>, <em>int i</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.get_feature_hp" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.get_feature_types">
<code class="descname">get_feature_types</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.get_feature_types" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.get_suffstats">
<code class="descname">get_suffstats</code><span class="sig-paren">(</span><em>self</em>, <em>int gid</em>, <em>int fid</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.get_suffstats" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.groups">
<code class="descname">groups</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.groups" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.groupsize">
<code class="descname">groupsize</code><span class="sig-paren">(</span><em>self</em>, <em>int gid</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.groupsize" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.is_group_empty">
<code class="descname">is_group_empty</code><span class="sig-paren">(</span><em>self</em>, <em>int gid</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.is_group_empty" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.nentities">
<code class="descname">nentities</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.nentities" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.nfeatures">
<code class="descname">nfeatures</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.nfeatures" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.ngroups">
<code class="descname">ngroups</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.ngroups" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.remove_value">
<code class="descname">remove_value</code><span class="sig-paren">(</span><em>self</em>, <em>int eid</em>, <em>y</em>, <em>rng r</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.remove_value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.sample_post_pred">
<code class="descname">sample_post_pred</code><span class="sig-paren">(</span><em>self</em>, <em>y_new</em>, <em>rng r</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.sample_post_pred" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.score_assignment">
<code class="descname">score_assignment</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.score_assignment" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.score_data">
<code class="descname">score_data</code><span class="sig-paren">(</span><em>self</em>, <em>features</em>, <em>groups</em>, <em>rng r</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.score_data" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.score_joint">
<code class="descname">score_joint</code><span class="sig-paren">(</span><em>self</em>, <em>rng r</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.score_joint" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.score_value">
<code class="descname">score_value</code><span class="sig-paren">(</span><em>self</em>, <em>y</em>, <em>rng r</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.score_value" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.serialize">
<code class="descname">serialize</code><span class="sig-paren">(</span><em>self</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.serialize" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.set_cluster_hp">
<code class="descname">set_cluster_hp</code><span class="sig-paren">(</span><em>self</em>, <em>dict raw</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.set_cluster_hp" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.set_feature_hp">
<code class="descname">set_feature_hp</code><span class="sig-paren">(</span><em>self</em>, <em>int i</em>, <em>dict d</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.set_feature_hp" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.model.state.set_suffstats">
<code class="descname">set_suffstats</code><span class="sig-paren">(</span><em>self</em>, <em>int gid</em>, <em>int fid</em>, <em>dict d</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.state.set_suffstats" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
</dd></dl>
<dl class="function">
<dt id="microscopes.mixture.model.initialize">
<code class="descclassname">microscopes.mixture.model.</code><code class="descname">initialize</code><span class="sig-paren">(</span><em>model_definition defn</em>, <em>abstract_dataview data</em>, <em>rng r</em>, <em>**kwargs</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.initialize" title="Permalink to this definition">¶</a></dt>
<dd><p>Initialize state to a random, valid point in the state space</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>defn</strong> : model definition</p>
<p><strong>data</strong> : recarray dataview</p>
<p class="last"><strong>rng</strong> : random state</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="microscopes.mixture.model.bind">
<code class="descclassname">microscopes.mixture.model.</code><code class="descname">bind</code><span class="sig-paren">(</span><em>state s</em>, <em>abstract_dataview data</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.bind" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="function">
<dt id="microscopes.mixture.model.deserialize">
<code class="descclassname">microscopes.mixture.model.</code><code class="descname">deserialize</code><span class="sig-paren">(</span><em>model_definition defn</em>, <em>bytes</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.model.deserialize" title="Permalink to this definition">¶</a></dt>
<dd><p>Restore a state object from a bytestring representation.</p>
<p>Note that a serialized representation of a state object does
not contain its own structural definition.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>defn</strong> : model definition</p>
<p class="last"><strong>bytes</strong> : bytestring representation</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</div>
<div class="section" id="module-microscopes.mixture.runner">
<span id="microscopes-mixture-runner"></span><h2>microscopes.mixture.runner<a class="headerlink" href="#module-microscopes.mixture.runner" title="Permalink to this headline">¶</a></h2>
<p>Implements the Runner interface for mixture models</p>
<dl class="function">
<dt id="microscopes.mixture.runner.default_assign_kernel_config">
<code class="descclassname">microscopes.mixture.runner.</code><code class="descname">default_assign_kernel_config</code><span class="sig-paren">(</span><em>defn</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.runner.default_assign_kernel_config" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a default kernel configuration for sampling the assignment
(clustering) vector. The default kernel is currently a gibbs sampler.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>defn</strong> : mixturemodel definition</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="microscopes.mixture.runner.default_cluster_hp_kernel_config">
<code class="descclassname">microscopes.mixture.runner.</code><code class="descname">default_cluster_hp_kernel_config</code><span class="sig-paren">(</span><em>defn</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.runner.default_cluster_hp_kernel_config" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a default kernel configuration for sampling the clustering
(Chinese Restaurant Process) model hyper-parameter. The default kernel is
currently a one-dimensional slice sampler.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>defn</strong> : mixturemodel definition</p>
<blockquote class="last">
<div><p>The hyper-priors set in the definition are used to configure the
hyper-parameter sampling kernels.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="microscopes.mixture.runner.default_feature_hp_kernel_config">
<code class="descclassname">microscopes.mixture.runner.</code><code class="descname">default_feature_hp_kernel_config</code><span class="sig-paren">(</span><em>defn</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.runner.default_feature_hp_kernel_config" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a default kernel configuration for sampling the component
(feature) model hyper-parameters. The default kernel is currently
a one-dimensional slice sampler.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>defn</strong> : mixturemodel definition</p>
<blockquote class="last">
<div><p>The hyper-priors set in the definition are used to configure the
hyper-parameter sampling kernels.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="microscopes.mixture.runner.default_grid_feature_hp_kernel_config">
<code class="descclassname">microscopes.mixture.runner.</code><code class="descname">default_grid_feature_hp_kernel_config</code><span class="sig-paren">(</span><em>defn</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.runner.default_grid_feature_hp_kernel_config" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a default kernel configuration for sampling the component
(feature) model hyper-parameters via gridded gibbs.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>defn</strong> : mixturemodel definition</p>
<blockquote class="last">
<div><p>The hyper-priors set in the definition are used to configure the
hyper-parameter sampling kernels.</p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="function">
<dt id="microscopes.mixture.runner.default_kernel_config">
<code class="descclassname">microscopes.mixture.runner.</code><code class="descname">default_kernel_config</code><span class="sig-paren">(</span><em>defn</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.runner.default_kernel_config" title="Permalink to this definition">¶</a></dt>
<dd><p>Creates a default kernel configuration suitable for general purpose
inference. Currently configures an assignment sampler followed by a
component hyper-parameter sampler.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><strong>defn</strong> : mixturemodel definition</td>
</tr>
</tbody>
</table>
</dd></dl>
<dl class="class">
<dt id="microscopes.mixture.runner.runner">
<em class="property">class </em><code class="descclassname">microscopes.mixture.runner.</code><code class="descname">runner</code><span class="sig-paren">(</span><em>defn</em>, <em>view</em>, <em>latent</em>, <em>kernel_config</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.runner.runner" title="Permalink to this definition">¶</a></dt>
<dd><p>The dirichlet process mixture model runner</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>defn</strong> : <code class="docutils literal"><span class="pre">model_definition</span></code></p>
<blockquote>
<div><p>The structural definition.</p>
</div></blockquote>
<p><strong>view</strong> : a recarray dataview</p>
<blockquote>
<div><p>The observations.</p>
</div></blockquote>
<p><strong>latent</strong> : <code class="docutils literal"><span class="pre">state</span></code></p>
<blockquote>
<div><p>The initialization state. Note that a <em>copy</em> of <cite>latent</cite> is
made. Use <a class="reference internal" href="#microscopes.mixture.runner.runner.get_latent" title="microscopes.mixture.runner.runner.get_latent"><code class="xref py py-meth docutils literal"><span class="pre">get_latent()</span></code></a> to access the modified state.</p>
</div></blockquote>
<p><strong>kernel_config</strong> : list</p>
<blockquote class="last">
<div><p>A list of either <cite>x</cite> strings or <cite>(x, y)</cite> tuples, where <cite>x</cite> is a string
containing the name of the kernel and <cite>y</cite> is a dict which configures
the particular kernel. In the former case where <cite>y</cite> is omitted, then
the defaults parameters for each kernel are used.</p>
<p>Possible values of <cite>x</cite> are:
{assign’, ‘assign_resample’, ‘grid_feature_hp’, ‘slice_feature_hp’,</p>
<blockquote>
<div><p>‘slice_cluster_hp’}</p>
</div></blockquote>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<dl class="attribute">
<dt id="microscopes.mixture.runner.runner.expensive_state">
<code class="descname">expensive_state</code><a class="headerlink" href="#microscopes.mixture.runner.runner.expensive_state" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.runner.runner.expensive_state_digest">
<code class="descname">expensive_state_digest</code><span class="sig-paren">(</span><em>h</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.runner.runner.expensive_state_digest" title="Permalink to this definition">¶</a></dt>
<dd></dd></dl>
<dl class="method">
<dt id="microscopes.mixture.runner.runner.get_latent">
<code class="descname">get_latent</code><span class="sig-paren">(</span><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.runner.runner.get_latent" title="Permalink to this definition">¶</a></dt>
<dd><p>Returns the current value of the underlying state object.</p>
<p>Note that the returned value is a <em>copy</em>, so modifications to it will
not be seen by the runner.</p>
</dd></dl>
<dl class="method">
<dt id="microscopes.mixture.runner.runner.run">
<code class="descname">run</code><span class="sig-paren">(</span><em>r</em>, <em>niters=10000</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.runner.runner.run" title="Permalink to this definition">¶</a></dt>
<dd><p>Run the specified mixturemodel kernel for <cite>niters</cite>, in a single
thread.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>r</strong> : random state</p>
<p class="last"><strong>niters</strong> : int</p>
</td>
</tr>
</tbody>
</table>
</dd></dl>
</dd></dl>
</div>
<div class="section" id="module-microscopes.mixture.query">
<span id="microscopes-mixture-query"></span><h2>microscopes.mixture.query<a class="headerlink" href="#module-microscopes.mixture.query" title="Permalink to this headline">¶</a></h2>
<p>The query interface for mixturemodels.</p>
<p>Note that the methods of this interface all take a list of latent state objects
(as opposed to a single latent).</p>
<dl class="function">
<dt id="microscopes.mixture.query.posterior_predictive">
<code class="descclassname">microscopes.mixture.query.</code><code class="descname">posterior_predictive</code><span class="sig-paren">(</span><em>q</em>, <em>latents</em>, <em>r</em>, <em>samples_per_chain=1</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.query.posterior_predictive" title="Permalink to this definition">¶</a></dt>
<dd><p>Generate a bag of samples from the posterior distribution of each
mixturemodel state object.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>q</strong> : (N,) masked recarray</p>
<blockquote>
<div><p>The query object</p>
</div></blockquote>
<p><strong>latents</strong> : list of mixturemodel latent objects</p>
<p><strong>r</strong> : random state</p>
<p><strong>samples_per_chain</strong> : int, optional</p>
<blockquote>
<div><p>Default is 1.</p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first"><strong>samples</strong> : (N, M) recarray</p>
<blockquote class="last">
<div><p>where <code class="docutils literal"><span class="pre">M</span> <span class="pre">=</span> <span class="pre">len(latents)</span> <span class="pre">*</span> <span class="pre">samples_per_chain</span></code></p>
</div></blockquote>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>If <code class="docutils literal"><span class="pre">N=1</span></code>, the resultng <cite>samples</cite> will <em>not</em> be collasped into a (M,)
shape recarray for consistency purposes.</p>
</dd></dl>
<dl class="function">
<dt id="microscopes.mixture.query.posterior_predictive_statistic">
<code class="descclassname">microscopes.mixture.query.</code><code class="descname">posterior_predictive_statistic</code><span class="sig-paren">(</span><em>q</em>, <em>latents</em>, <em>r</em>, <em>samples_per_chain=1</em>, <em>merge='avg'</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.query.posterior_predictive_statistic" title="Permalink to this definition">¶</a></dt>
<dd><p>Sample many values and combine each feature independently using the
given <cite>merge</cite> strategy.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>q</strong> : (N,) masked recarray</p>
<blockquote>
<div><p>The query object</p>
</div></blockquote>
<p><strong>latents</strong> : list of mixturemodel latent objects</p>
<p><strong>r</strong> : random state</p>
<p><strong>samples_per_chain</strong> : int, optional</p>
<blockquote>
<div><p>Default is 1.</p>
</div></blockquote>
<p><strong>merge</strong> : str or list of strs, each str is one of {‘avg’, ‘mode’}</p>
<blockquote>
<div><p>Note that ‘mode’ only works for discrete data types.</p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>statistic</strong> : (N,) recarray</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>This method exists as a convenience, primarily because ndarray methods such
as <cite>mean()</cite> do not work with recarrays.</p>
</dd></dl>
<dl class="function">
<dt id="microscopes.mixture.query.zmatrix">
<code class="descclassname">microscopes.mixture.query.</code><code class="descname">zmatrix</code><span class="sig-paren">(</span><em>latents</em><span class="sig-paren">)</span><a class="headerlink" href="#microscopes.mixture.query.zmatrix" title="Permalink to this definition">¶</a></dt>
<dd><p>Compute a z-matrix (cluster co-assignment matrix). The ij-th entry of a
z-matrix is a real value scalar between [0, 1] indicating the frequency of
how often entities i and j appear in the same cluster.</p>
<table class="docutils field-list" frame="void" rules="none">
<col class="field-name" />
<col class="field-body" />
<tbody valign="top">
<tr class="field-odd field"><th class="field-name">Parameters:</th><td class="field-body"><p class="first"><strong>latents</strong> : list of mixturemodel latent objects</p>
<blockquote>
<div><p>The latents should all be points in the state space of the same
structural model. The implementation currently does not check for this.</p>
</div></blockquote>
</td>
</tr>
<tr class="field-even field"><th class="field-name">Returns:</th><td class="field-body"><p class="first last"><strong>zmat</strong> : (N, N) ndarray</p>
</td>
</tr>
</tbody>
</table>
<p class="rubric">Notes</p>
<p>Currently does not support a sparse zmatrix representation, so only use
this for small N.</p>
</dd></dl>
</div>
</div>
</div>
</div>
</div>
<!-- your html code here -->
<center> Datamicroscopes is developed by <a href="http://www.qadium.com">Qadium</a>, with funding from the <a href="http://www.darpa.mil">DARPA</a> <a href="http://www.darpa.mil/program/xdata">XDATA</a> program. Copyright Qadium 2015. </center>
</body>
</html>