-
Notifications
You must be signed in to change notification settings - Fork 0
/
forUsing.i
664 lines (577 loc) · 22.5 KB
/
forUsing.i
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
/**
*
* Copyright 2005-2024 Pierre-Henri WUILLEMIN et Christophe GONZALES (LIP6)
* {prenom.nom}_at_lip6.fr
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this library. If not, see <http://www.gnu.org/licenses/>.
*
*/
// this file is for giving access to methods defined in ancestor.
%define ADD_APPROXIMATIONSCHEME_API(parent,classname...)
%extend classname {
using parent::setVerbosity;
using parent::setEpsilon;
using parent::setMinEpsilonRate;
using parent::setMaxIter;
using parent::setMaxTime;
using parent::setPeriodSize;
using parent::verbosity;
using parent::epsilon;
using parent::minEpsilonRate;
using parent::maxIter;
using parent::maxTime;
using parent::periodSize;
using parent::nbrIterations;
using parent::currentTime;
using parent::messageApproximationScheme;
using parent::history;
const gum::IApproximationSchemeConfiguration& _asIApproximationSchemeConfiguration() const {
return *(dynamic_cast<const gum::IApproximationSchemeConfiguration *>(self));
}
}
%enddef
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::GibbsSampling<double>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::ImportanceSampling<double>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::WeightedSampling<double>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::MonteCarloSampling<double>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::LoopySamplingInference<double,gum::ImportanceSampling>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::LoopySamplingInference<double,gum::WeightedSampling>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::LoopySamplingInference<double,gum::GibbsSampling>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::LoopySamplingInference<double,gum::MonteCarloSampling>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::LoopyBeliefPropagation<double>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::GibbsBNdistance<double>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::credal::CNMonteCarloSampling<double>)
ADD_APPROXIMATIONSCHEME_API(gum::ApproximationScheme,gum::credal::CNLoopyPropagation<double>)
ADD_APPROXIMATIONSCHEME_API(gum::learning::IBNLearner,gum::learning::BNLearner<double>)
%extend gum::learning::BNLearner<double> {
using gum::learning::IBNLearner::setMaxTime;
using gum::learning::IBNLearner::maxTime;
using gum::learning::IBNLearner::currentTime;
using gum::learning::IBNLearner::learnDAG;
using gum::learning::IBNLearner::learnPDAG;
using gum::learning::IBNLearner::names;
using gum::learning::IBNLearner::idFromName;
using gum::learning::IBNLearner::nameFromId;
using gum::learning::IBNLearner::setDatabaseWeight;
using gum::learning::IBNLearner::setRecordWeight;
using gum::learning::IBNLearner::databaseWeight;
using gum::learning::IBNLearner::recordWeight;
using gum::learning::IBNLearner::hasMissingValues;
using gum::learning::IBNLearner::logLikelihood;
using gum::learning::IBNLearner::score;
using gum::learning::IBNLearner::mutualInformation;
using gum::learning::IBNLearner::correctedMutualInformation;
using gum::learning::IBNLearner::rawPseudoCount;
using gum::learning::IBNLearner::nbRows;
using gum::learning::IBNLearner::nbCols;
using gum::learning::IBNLearner::domainSize;
using gum::learning::IBNLearner::evEq;
using gum::learning::IBNLearner::evIn;
using gum::learning::IBNLearner::setNumberOfThreads;
Size getNumberOfThreads() const override {
return self->getNumberOfThreads();
}
bool isGumNumberOfThreadsOverriden() const override {
return self->isGumNumberOfThreadsOverriden();
}
}
#####################################
%define ADD_NODEGRAPHPART_API(classname)
%extend classname {
// erase node is not in this list since it is redefined by the very classes {Mixed|Di|Undi}Graph)
gum::NodeId addNode() {
return self->gum::NodeGraphPart::addNode();
}
std::vector<gum::NodeId> addNodes(gum::Size n) {
return self->gum::NodeGraphPart::addNodes(n);
}
void addNodeWithId(const gum::NodeId id) {
self->gum::NodeGraphPart::addNodeWithId(id);
}
bool existsNode(const gum::NodeId id) const {
return self->gum::NodeGraphPart::existsNode(id);
}
gum::Size size() const {
return self->gum::NodeGraphPart::size();
}
bool empty() const {
return self->gum::NodeGraphPart::empty();
}
}
%enddef
ADD_NODEGRAPHPART_API(gum::DiGraph)
ADD_ARCGRAPHPART_API(gum::DAG);
ADD_NODEGRAPHPART_API(gum::UndiGraph)
ADD_NODEGRAPHPART_API(gum::MixedGraph)
ADD_NODEGRAPHPART_API(gum::PDAG)
%define ADD_EDGEGRAPHPART_API(classname)
%extend classname {
void addEdge(const NodeId n1,const NodeId n2) {
self->addEdge(n1,n2);
}
void eraseEdge(const NodeId n1,const NodeId n2) {
self->eraseEdge(gum::Edge(n1,n2));
}
bool existsEdge(const NodeId n1, const NodeId n2) const {
return self->existsEdge(n1,n2);
}
gum::Size sizeEdges() const {
return self->sizeEdges();
}
bool emptyEdges() const {
return self->emptyEdges();
}
void eraseNeighbours(const gum::NodeId n) {
self->eraseNeighbours(n);
}
}
%enddef
ADD_EDGEGRAPHPART_API(gum::UndiGraph)
ADD_EDGEGRAPHPART_API(gum::MixedGraph)
ADD_EDGEGRAPHPART_API(gum::PDAG)
%define ADD_ARCGRAPHPART_API(classname)
%extend classname {
void addArc(const gum::NodeId n1,const gum::NodeId n2) {
self->addArc(n1,n2);
}
void eraseArc(const gum::NodeId n1,const gum::NodeId n2) {
self->eraseArc(gum::Arc(n1,n2));
}
bool existsArc(const gum::NodeId n1,const gum::NodeId n2) const {
return self->existsArc(n1,n2);
}
void eraseParents(const gum::NodeId n) {
self->eraseParents(n);
}
void eraseChildren(const gum::NodeId n) {
self->eraseChildren(n);
}
gum::Size sizeArcs() const {
return self->sizeArcs();
}
bool emptyArcs() const {
return self->emptyArcs();
}
}
%enddef
ADD_ARCGRAPHPART_API(gum::DiGraph)
ADD_ARCGRAPHPART_API(gum::DAG)
ADD_ARCGRAPHPART_API(gum::MixedGraph)
ADD_ARCGRAPHPART_API(gum::PDAG)
%define ADD_MIXEDGRAPHPART_API(classname)
%extend classname {
NodeSet boundary(NodeId id) const {
return self->boundary(id);
}
std::vector< NodeId > mixedOrientedPath(NodeId node1, NodeId node2) const {
return self->mixedOrientedPath(node1,node2);
}
std::vector< NodeId > mixedUnorientedPath(NodeId node1, NodeId node2) const {
return self->mixedUnorientedPath(node1,node2);
}
}
%enddef
ADD_MIXEDGRAPHPART_API(gum::MixedGraph)
ADD_MIXEDGRAPHPART_API(gum::PDAG)
#####################################
%define ADD_MULTIDIMDECORATOR_API(classname)
%extend classname {
/* wrapping the minimal interface from MultiDimDecorator */
double get(const gum::Instantiation& i) const {
return self->gum::MultiDimDecorator<double>::get(i);
}
void set ( const Instantiation& i, const double& value ) const {
self->gum::MultiDimDecorator<double>::set(i,value);
}
bool empty() const {
return self->gum::MultiDimDecorator<double>::empty();
}
gum::Idx pos ( const gum::DiscreteVariable& v) const {
return self->gum::MultiDimDecorator<double>::pos(v);
}
bool contains ( const gum::DiscreteVariable& v) const {
return self->gum::MultiDimDecorator<double>::contains(v);
}
gum::Idx nbrDim() const {
return self->gum::MultiDimDecorator<double>::nbrDim();
}
const gum::DiscreteVariable& variable ( Idx i) const {
return self->gum::MultiDimDecorator<double>::variable(i);
}
const gum::DiscreteVariable& variable ( const std::string& name) const {
return self->gum::MultiDimDecorator<double>::variable(name);
}
void remove(const gum::DiscreteVariable& var) {
self->erase(var);
}
void add ( const DiscreteVariable& v ) {
self->gum::MultiDimDecorator<double>::add(v);
}
}
%enddef
ADD_MULTIDIMDECORATOR_API(gum::Potential<double>)
#####################################
#####################################
%define ADD_CREDALINFERENCEENGINE_API(classname)
%extend classname {
void setRepetitiveInd(const bool flag) {
self->gum::credal::InferenceEngine<double>::setRepetitiveInd(flag);
}
Potential<double> marginalMax ( const NodeId id ) const {
return self->gum::credal::InferenceEngine<double>::marginalMax(id);
}
Potential<double> marginalMin ( const NodeId id ) const {
return self->gum::credal::InferenceEngine<double>::marginalMin(id);
}
Potential<double> marginalMax ( const std::string name ) const {
return self->gum::credal::InferenceEngine<double>::marginalMax(name);
}
Potential<double> marginalMin ( const std::string name) const {
return self->gum::credal::InferenceEngine<double>::marginalMin(name);
}
void insertModalsFile ( const std::string& path ) {
self->gum::credal::InferenceEngine<double>::insertModalsFile(path);
}
const std::vector< double >& dynamicExpMax ( const std::string& varName ) const {
return self->gum::credal::InferenceEngine<double>::dynamicExpMax(varName);
}
const std::vector< double >& dynamicExpMin ( const std::string& varName ) const {
return self->gum::credal::InferenceEngine<double>::dynamicExpMin(varName);
}
void eraseAllEvidence() {
self->gum::credal::InferenceEngine<double>::eraseAllEvidence();
}
//######## EVIDENCE ##########
//############################
void addEvidence( const NodeId id, const Idx val ) {
self->gum::credal::InferenceEngine<double>::addEvidence(id,val);
}
void addEvidence( const std::string& nodeName, const Idx val ) {
self->gum::credal::InferenceEngine<double>::addEvidence(nodeName,val);
}
void addEvidence( const NodeId id, const std::string& val ) {
self->gum::credal::InferenceEngine<double>::addEvidence(id,val);
}
void addEvidence( const std::string& nodeName, const std::string& val ) {
self->gum::credal::InferenceEngine<double>::addEvidence(nodeName,val);
}
void addEvidence( const NodeId id,const std::vector<double>& vals ) {
self->gum::credal::InferenceEngine<double>::addEvidence(id,vals);
}
void addEvidence( const std::string& nodeName,
const std::vector<double>& vals ) {
self->gum::credal::InferenceEngine<double>::addEvidence(nodeName,vals);
}
void addEvidence(const gum::Potential<double>& p) {
self->gum::credal::InferenceEngine<double>::addEvidence(p);
}
}
%enddef
ADD_CREDALINFERENCEENGINE_API(gum::credal::CNMonteCarloSampling<double>)
ADD_CREDALINFERENCEENGINE_API(gum::credal::CNLoopyPropagation<double>)
#####################################
#####################################
%define ADD_INFERENCE_API(baseclassname,classname...)
%extend classname {
void makeInference(void) {
self->baseclassname::makeInference();
}
const Potential<double> posterior( const NodeId var ) {
return self->baseclassname::posterior(var);
}
const Potential<double> posterior( const std::string& nodeName ) {
return self->baseclassname::posterior(nodeName);
}
//######## EVIDENCE ##########
//############################
void addEvidence( const NodeId id, const Idx val ) {
self->baseclassname::addEvidence(id,val);
}
void addEvidence( const std::string& nodeName, const Idx val ) {
self->baseclassname::addEvidence(nodeName,val);
}
void addEvidence( const NodeId id, const std::string& val ) {
self->baseclassname::addEvidence(id,val);
}
void addEvidence( const std::string& nodeName, const std::string& val ) {
self->baseclassname::addEvidence(nodeName,val);
}
void addEvidence( const NodeId id,const std::vector<double>& vals ) {
self->baseclassname::addEvidence(id,vals);
}
void addEvidence( const std::string& nodeName,
const std::vector<double>& vals ) {
self->baseclassname::addEvidence(nodeName,vals);
}
void addEvidence(const gum::Potential<double>& p) {
self->baseclassname::addEvidence(p);
}
void chgEvidence( const NodeId id, const Idx val ) {
self->baseclassname::chgEvidence(id,val);
}
void chgEvidence( const std::string& nodeName, const Idx val ) {
self->baseclassname::chgEvidence(nodeName,val);
}
void chgEvidence( const NodeId id, const std::string& val ) {
self->baseclassname::chgEvidence(id,val);
}
void chgEvidence( const std::string& nodeName, const std::string& val ) {
self->baseclassname::chgEvidence(nodeName,val);
}
void chgEvidence(const gum::Potential<double>& p) {
self->baseclassname::chgEvidence(p);
}
void chgEvidence( const NodeId id,const std::vector<double>& vals ) {
self->baseclassname::chgEvidence(id,vals);
}
void chgEvidence( const std::string& nodeName,
const std::vector<double>& vals ) {
self->baseclassname::chgEvidence(nodeName,vals);
}
bool hasEvidence( const NodeId id ) const {
return self->baseclassname::hasEvidence(id);
}
bool hasEvidence( const std::string& nodeName) const {
return self->baseclassname::hasEvidence(nodeName);
}
void eraseAllEvidence() {
self->baseclassname::eraseAllEvidence();
}
void eraseEvidence( const NodeId id ) {
self->baseclassname::eraseEvidence(id);
}
void eraseEvidence( const std::string& nodeName ) {
self->baseclassname::eraseEvidence(nodeName);
}
bool hasSoftEvidence( const NodeId id ) const {
return self->baseclassname::hasSoftEvidence(id);
}
bool hasHardEvidence( const std::string& nodeName ) const {
return self->baseclassname::hasHardEvidence(nodeName);
}
bool hasSoftEvidence( const std::string& nodeName ) const {
return self->baseclassname::hasSoftEvidence(nodeName);
}
gum::Size nbrEvidence() const {
return self->baseclassname::nbrEvidence();
}
gum::Size nbrHardEvidence() const {
return self->baseclassname::nbrHardEvidence();
}
gum::Size nbrSoftEvidence() const {
return self->baseclassname::nbrSoftEvidence();
}
}
%enddef
%define ADD_MONOTARGET_INFERENCE_API(baseclassname,classname...)
ADD_INFERENCE_API(baseclassname,classname)
%extend classname {
//######## TARGETS ##########
//############################
void eraseAllTargets() {
self->baseclassname::eraseAllTargets();
}
void addAllTargets() {
self->baseclassname::addAllTargets();
}
void addTarget( const NodeId target ) {
self->baseclassname::addTarget(target);
}
void addTarget( const std::string& nodeName ) {
self->baseclassname::addTarget(nodeName);
}
void eraseTarget( const NodeId target ) {
self->baseclassname::eraseTarget(target);
}
void eraseTarget( const std::string& nodeName ) {
self->baseclassname::eraseTarget(nodeName);
}
bool isTarget( const NodeId variable ) const {
return self->baseclassname::isTarget(variable);
}
bool isTarget( const std::string& nodeName ) const {
return self->baseclassname::isTarget(nodeName);
}
gum::Size nbrTargets( ) const {
return self->baseclassname::nbrTargets();
}
double H( const NodeId X ) {
return self->baseclassname::H(X);
}
double H( const std::string& nodeName ) {
return self->baseclassname::H(nodeName);
}
Potential<double> evidenceImpact(NodeId target,const NodeSet& evs){
return self->baseclassname::evidenceImpact(target,evs);
}
Potential<double> evidenceImpact(const std::string& target,const std::vector<std::string>& evs){
return self->baseclassname::evidenceImpact(target,evs);
}
}
%enddef
%define ADD_BN_MONOTARGET_INFERENCE_API(baseclassname,classname...)
ADD_MONOTARGET_INFERENCE_API(baseclassname,classname)
%extend classname {
const IBayesNet< double >& BN() const { return self->baseclassname::BN(); }
}
%enddef
ADD_BN_MONOTARGET_INFERENCE_API(gum::MarginalTargetedInference<double>,gum::VariableElimination<double>)
ADD_BN_MONOTARGET_INFERENCE_API(gum::MarginalTargetedInference<double>,gum::LoopyBeliefPropagation<double>)
%define ADD_SAMPLING_INFERENCE_API(classname...)
ADD_BN_MONOTARGET_INFERENCE_API(gum::MarginalTargetedInference<double>,classname)
%extend classname {
const gum::Potential<double>& currentPosterior(const NodeId id)
{return self->gum::SamplingInference<double>::currentPosterior(id);};
const gum::Potential<double>& currentPosterior(const std::string& name)
{return self->gum::SamplingInference<double>::currentPosterior(name);};
}
%enddef
ADD_SAMPLING_INFERENCE_API(gum::GibbsSampling<double>)
ADD_SAMPLING_INFERENCE_API(gum::MonteCarloSampling<double>)
ADD_SAMPLING_INFERENCE_API(gum::WeightedSampling<double>)
ADD_SAMPLING_INFERENCE_API(gum::ImportanceSampling<double>)
ADD_SAMPLING_INFERENCE_API(gum::LoopySamplingInference<double,gum::ImportanceSampling>)
ADD_SAMPLING_INFERENCE_API(gum::LoopySamplingInference<double,gum::GibbsSampling>)
ADD_SAMPLING_INFERENCE_API(gum::LoopySamplingInference<double,gum::WeightedSampling>)
ADD_SAMPLING_INFERENCE_API(gum::LoopySamplingInference<double,gum::MonteCarloSampling>)
%define ADD_JOINT_INFERENCE_API(classname)
ADD_BN_MONOTARGET_INFERENCE_API(gum::MarginalTargetedInference<double>,classname)
%extend classname {
const Potential<double> posterior( const NodeId var ) {
return self->JointTargetedInference<double>::posterior(var);
}
const Potential<double> posterior( const std::string nodeName ) {
return self->JointTargetedInference<double>::posterior(nodeName);
}
void eraseAllTargets() {
self->gum::JointTargetedInference<double>::eraseAllTargets();
}
void eraseAllJointTargets() {
self->gum::JointTargetedInference<double>::eraseAllJointTargets();
}
void eraseAllMarginalTargets() {
self->gum::JointTargetedInference<double>::eraseAllMarginalTargets();
}
gum::Size nbrJointTargets() {
return self->gum::JointTargetedInference<double>::nbrJointTargets();
}
Potential<double> evidenceJointImpact(const NodeSet& targets,const NodeSet& evs){
return self->gum::JointTargetedInference<double>::evidenceJointImpact(targets,evs);
}
Potential<double> evidenceJointImpact(const std::vector<std::string>& targets,const std::vector<std::string>& evs){
return self->gum::JointTargetedInference<double>::evidenceJointImpact(targets,evs);
}
}
%enddef
ADD_JOINT_INFERENCE_API(gum::LazyPropagation<double>)
ADD_JOINT_INFERENCE_API(gum::ShaferShenoyInference<double>)
%define ADD_PARALLELIZED_INFERENCE_API(classname)
%extend classname {
void setNumberOfThreads (int nb) {
self->setNumberOfThreads(nb);
}
int getNumberOfThreads () {
return self->getNumberOfThreads();
}
bool isGumNumberOfThreadsOverriden () {
return self->isGumNumberOfThreadsOverriden();
}
void setMaxMemory (int gigabytes) {
self->setMaxMemory(gigabytes);
}
}
%enddef
ADD_PARALLELIZED_INFERENCE_API(gum::LazyPropagation<double>)
ADD_PARALLELIZED_INFERENCE_API(gum::ShaferShenoyInference<double>)
ADD_PARALLELIZED_INFERENCE_API(gum::VariableElimination<double>)
ADD_PARALLELIZED_INFERENCE_API(gum::ShaferShenoyMRFInference<double>)
%define ADD_GIBBS_OPERATOR_API(classname...)
%extend classname {
/** Getters and setters*/
gum::Size nbrDrawnVar() const { return self->GibbsOperator<double>::nbrDrawnVar(); }
void setNbrDrawnVar(Size _nbr) { self->GibbsOperator<double>::setNbrDrawnVar(_nbr); }
bool isDrawnAtRandom() const { return self->GibbsOperator<double>::isDrawnAtRandom(); }
void setDrawnAtRandom(bool _atRandom) { self->GibbsOperator<double>::setDrawnAtRandom(_atRandom); }
}
%enddef
ADD_GIBBS_OPERATOR_API(gum::GibbsSampling<double>)
ADD_GIBBS_OPERATOR_API(gum::LoopySamplingInference<double,gum::GibbsSampling>)
ADD_GIBBS_OPERATOR_API(gum::GibbsBNdistance<double>)
%extend gum::LoopySamplingInference<double,gum::GibbsSampling> {
gum::Size burnIn() const { return self->gum::GibbsSampling<double>::burnIn();}
void setBurnIn(gum::Size b) { self->gum::GibbsSampling<double>::setBurnIn(b);}
}
%extend gum::Potential<double> {
gum::Size domainSize() {return self->gum::MultiDimDecorator<double>::domainSize();}
gum::Size nbrDim() {return self->gum::MultiDimDecorator<double>::nbrDim();}
}
#################
%define ADD_MRF_INFERENCE_API(classname...)
ADD_MONOTARGET_INFERENCE_API (gum::MarginalTargetedMRFInference<double>,classname)
%extend classname {
const IMarkovRandomField<double>& MRF() const { return self->gum::MarginalTargetedMRFInference<double>::MRF(); }
}
%enddef
%define ADD_JOINT_MRF_INFERENCE_API(classname)
ADD_MRF_INFERENCE_API(classname)
%extend classname {
const Potential<double> posterior( const NodeId var ) {
return self->JointTargetedMRFInference<double>::posterior(var);
}
const Potential<double> posterior( const std::string nodeName ) {
return self->JointTargetedMRFInference<double>::posterior(nodeName);
}
void eraseAllTargets() {
self->gum::JointTargetedMRFInference<double>::eraseAllTargets();
}
void eraseAllJointTargets() {
self->gum::JointTargetedMRFInference<double>::eraseAllJointTargets();
}
void eraseAllMarginalTargets() {
self->gum::JointTargetedMRFInference<double>::eraseAllMarginalTargets();
}
gum::Size nbrJointTargets() {
return self->gum::JointTargetedMRFInference<double>::nbrJointTargets();
}
Potential<double> evidenceJointImpact(const NodeSet& targets,const NodeSet& evs){
return self->gum::JointTargetedMRFInference<double>::evidenceJointImpact(targets,evs);
}
Potential<double> evidenceJointImpact(const std::vector<std::string>& targets,const std::vector<std::string>& evs){
return self->gum::JointTargetedMRFInference<double>::evidenceJointImpact(targets,evs);
}
}
%enddef
ADD_JOINT_MRF_INFERENCE_API(gum::ShaferShenoyMRFInference<double>)
#################
%define ADD_ID_INFERENCE_API(classname...)
ADD_INFERENCE_API(classname,classname)
%extend classname {
void makeInference(void) {
self->gum::InfluenceDiagramInference<double>::makeInference();
}
const InfluenceDiagram<double>& influenceDiagram() const { return self->gum::InfluenceDiagramInference<double>::influenceDiagram(); }
}
%enddef
ADD_ID_INFERENCE_API(gum::ShaferShenoyLIMIDInference<double >)
###################
%define ADD_CN_INFERENCE_API(classname...)
%extend classname {
const CredalNet< double >& CN() const { return self->gum::credal::InferenceEngine<double>::credalNet(); }
}
%enddef
ADD_CN_INFERENCE_API(gum::credal::CNMonteCarloSampling<double>)
ADD_CN_INFERENCE_API(gum::credal::CNLoopyPropagation<double>)
extend gum::DiscreteVariable {
std::string toFast() const {return "virtual method";}
}