1 %feature("docstring") gum::credal::CredalNet 2 " 3 Constructor used to create a CredalNet (step by step or with two BayesNet) 4 5 CredalNet() -> CredalNet 6 default constructor 7 8 CredalNet(src_min_num,src_max_den) -> CredalNet 9 10 Parameters 11 ---------- 12 src_min_num : str or pyAgrum.BayesNet 13 The path to a BayesNet or the BN itself which contains lower probabilities. 14 src_max_den : str or pyAgrum.BayesNet 15 The (optional) path to a BayesNet or the BN itself which contains upper probabilities. 16 17 " 18 19 %feature("docstring") gum::credal::CredalNet::addArc 20 " 21 Adds an arc between two nodes 22 23 Parameters 24 ---------- 25 tail : 26 the id of the tail node 27 head : int 28 the id of the head node 29 30 Raises 31 ------ 32 pyAgrum.InvalidDirectedCircle 33 If any (directed) cycle is created by this arc 34 pyAgrum.InvalidNode 35 If head or tail does not belong to the graph nodes 36 pyAgrum.DuplicateElement 37 If one of the arc already exists 38 " 39 40 %feature("docstring") gum::credal::CredalNet::addNodeWithId 41 " 42 Adds a discrete node into the network. 43 44 Parameters 45 ---------- 46 name : str 47 The name of the discrete variable to be added 48 card : int 49 The cardinality of the variable 50 51 Returns 52 ------- 53 int 54 The NodeId of the variable in the network 55 56 Raises 57 ------ 58 pyAgrum.DuplicateLabel 59 If a node with the label already exists. 60 " 61 62 %feature("docstring") gum::credal::CredalNet::approximatedBinarization 63 " 64 Approximate binarization. 65 66 Each bit has a lower and upper probability which is the lowest - resp. highest - over all vertices of the credal set. Enlarge the orignal credal sets and may induce huge imprecision. 67 68 Warnings 69 -------- 70 Enlarge the orignal credal sets and therefor induce huge imprecision by propagation. Not recommended, use MCSampling or something else instead 71 " 72 73 %feature("docstring") gum::credal::CredalNet::bnToCredal 74 " 75 Perturbates the BayesNet provided as input for this CredalNet by generating intervals instead of point probabilities and then computes each vertex of each credal set. 76 77 Parameters 78 ---------- 79 beta : double 80 The beta used to perturbate the network 81 oneNet : bool 82 used as a flag. Set to True if one BayesNet if provided with counts, to False if two BayesNet are provided; one with probabilities (the lower net) and one with denominators over the first modalities (the upper net) 83 keepZeroes : bool 84 used as a flag as whether or not - respectively True or False - we keep zeroes as zeroes. Default is False, i.e. zeroes are not kept 85 " 86 87 %feature("docstring") gum::credal::CredalNet::computeCPTMinMax 88 " 89 Used with binary networks to speed-up L2U inference. 90 91 Store the lower and upper probabilities of each node X over the 'True' modality. 92 " 93 94 %feature("docstring") gum::credal::CredalNet::credalNet_currentCpt 95 " 96 Warnings 97 -------- 98 Experimental function - Return type to be wrapped 99 100 Returns 101 ------- 102 tbw 103 a constant reference to the (up-to-date) CredalNet CPTs. 104 " 105 106 %feature("docstring") gum::credal::CredalNet::credalNet_srcCpt 107 " 108 Warnings 109 -------- 110 Experimental function - Return type to be wrapped 111 112 Returns 113 ------- 114 tbw 115 a constant reference to the (up-to-date) CredalNet CPTs. 116 " 117 118 %feature("docstring") gum::credal::CredalNet::currentNodeType 119 " 120 Parameters 121 ---------- 122 id : int 123 The constant reference to the choosen NodeId 124 125 Returns 126 ------- 127 pyAgrum.CredalNet 128 the type of the choosen node in the (up-to-date) CredalNet __current_bn if any, __src_bn otherwise. 129 " 130 131 %feature("docstring") gum::credal::CredalNet::current_bn 132 " 133 Returns 134 ------- 135 pyAgrum.BayesNet 136 Returs a constant reference to the actual BayesNet (used as a DAG, it's CPTs does not matter). 137 " 138 139 %feature("docstring") gum::credal::CredalNet::domainSize 140 " 141 Parameters 142 ---------- 143 id : int 144 The id of the node 145 146 Returns 147 ------- 148 int 149 The cardinality of the node 150 " 151 152 %feature("docstring") gum::credal::CredalNet::epsilonMax 153 " 154 Returns 155 ------- 156 double 157 a constant reference to the highest perturbation of the BayesNet provided as input for this CredalNet. 158 " 159 160 %feature("docstring") gum::credal::CredalNet::epsilonMean 161 " 162 Returns 163 ------- 164 double 165 a constant reference to the average perturbation of the BayesNet provided as input for this CredalNet. 166 " 167 168 %feature("docstring") gum::credal::CredalNet::epsilonMin 169 " 170 Returns 171 ------- 172 double 173 a constant reference to the lowest perturbation of the BayesNet provided as input for this CredalNet. 174 " 175 176 %feature("docstring") gum::credal::CredalNet::fillConstraint 177 " 178 Set the interval constraints of a credal set of a given node (from an instantiation index) 179 180 Parameters 181 ---------- 182 id : int 183 The id of the node 184 entry : int 185 The index of the instantiation excluding the given node (only the parents are used to compute the index of the credal set) 186 ins : pyAgrum.Instantiation 187 The Instantiation 188 lower : list 189 The lower value for each probability in correct order 190 upper : list 191 The upper value for each probability in correct order 192 193 Warnings 194 -------- 195 You need to call intervalToCredal when done filling all constraints. 196 197 Warning 198 ------- 199 DOES change the BayesNet (s) associated to this credal net ! 200 " 201 202 %feature("docstring") gum::credal::CredalNet::fillConstraints 203 " 204 Set the interval constraints of the credal sets of a given node (all instantiations) 205 206 Parameters 207 ---------- 208 id : int 209 The id of the node 210 lower : list 211 The lower value for each probability in correct order 212 upper : list 213 The upper value for each probability in correct order 214 215 Warnings 216 -------- 217 You need to call intervalToCredal when done filling all constraints. 218 219 Warning 220 ------- 221 DOES change the BayesNet (s) associated to this credal net ! 222 " 223 224 %feature("docstring") gum::credal::CredalNet::get_binaryCPT_max 225 " 226 Warnings 227 -------- 228 Experimental function - Return type to be wrapped 229 230 Returns 231 ------- 232 tbw 233 a constant reference to the upper probabilities of each node X over the 'True' modality 234 " 235 236 %feature("docstring") gum::credal::CredalNet::get_binaryCPT_min 237 " 238 Warnings 239 -------- 240 Experimental function - Return type to be wrapped 241 242 Returns 243 ------- 244 tbw 245 a constant reference to the lower probabilities of each node X over the 'True' modality 246 " 247 248 %feature("docstring") gum::credal::CredalNet::hasComputedCPTMinMax 249 " 250 Returns 251 ------- 252 bool 253 True this CredalNet has called computeCPTMinMax() to speed-up inference with binary networks and L2U. 254 " 255 256 %feature("docstring") gum::credal::CredalNet::idmLearning 257 " 258 Learns parameters from a BayesNet storing counts of events. 259 260 Use this method when using a single BayesNet storing counts of events. IDM model if s > 0, standard point probability if s = 0 (default value if none precised). 261 262 Parameters 263 ---------- 264 s : int 265 the IDM parameter. 266 keepZeroes : bool 267 used as a flag as whether or not - respectively True or False - we keep zeroes as zeroes. Default is False, i.e. zeroes are not kept. 268 " 269 270 %feature("docstring") gum::credal::CredalNet::instantiation 271 " 272 Get an Instantiation from a node id, usefull to fill the constraints of the network. 273 274 bnet accessors / shortcuts. 275 276 Parameters 277 ---------- 278 id : int 279 the id of the node we want an instantiation from 280 281 Returns 282 ------- 283 pyAgrum.Instantiation 284 the instantiation 285 " 286 287 %feature("docstring") gum::credal::CredalNet::intervalToCredal 288 " 289 Computes the vertices of each credal set according to their interval definition (uses lrs). 290 291 Use this method when using two BayesNet, one with lower probabilities and one with upper probabilities. 292 " 293 294 %feature("docstring") gum::credal::CredalNet::intervalToCredalWithFiles 295 " 296 Warnings 297 -------- 298 Deprecated : use intervalToCredal (lrsWrapper with no input / output files needed). 299 300 301 Computes the vertices of each credal set according to their interval definition (uses lrs). 302 303 Use this method when using a single BayesNet storing counts of events. 304 " 305 306 %feature("docstring") gum::credal::CredalNet::isSeparatelySpecified 307 " 308 Returns 309 ------- 310 bool 311 True if this CredalNet is separately and interval specified, False otherwise. 312 " 313 314 %feature("docstring") gum::credal::CredalNet::lagrangeNormalization 315 " 316 Normalize counts of a BayesNet storing counts of each events such that no probability is 0. 317 318 Use this method when using a single BayesNet storing counts of events. Lagrange normalization. This call is irreversible and modify counts stored by __src_bn. 319 320 Doest not performs computations of the parameters but keeps normalized counts of events only. Call idmLearning to compute the probabilities (with any parameter value). 321 " 322 323 %feature("docstring") gum::credal::CredalNet::addVariable 324 " 325 Parameters 326 ---------- 327 name : str 328 the name of the new variable 329 card: int 330 the domainSize of the new variable 331 332 Returns 333 ------- 334 int 335 the id of the new node 336 " 337 338 %feature("docstring") gum::credal::CredalNet::nodeType 339 " 340 Parameters 341 ---------- 342 id : int 343 the constant reference to the choosen NodeId 344 345 Returns 346 ------- 347 pyAgrum.CredalNet 348 the type of the choosen node in the (up-to-date) CredalNet in __src_bn. 349 " 350 351 %feature("docstring") gum::credal::CredalNet::saveBNsMinMax 352 " 353 If this CredalNet was built over a perturbed BayesNet, one can save the intervals as two BayesNet. 354 355 to call after bnToCredal(GUM_SCALAR beta) save a BN with lower probabilities and a BN with upper ones 356 357 Parameters 358 ---------- 359 min_path : str 360 the path to save the BayesNet which contains the lower probabilities of each node X. 361 max_path : str 362 the path to save the BayesNet which contains the upper probabilities of each node X. 363 " 364 365 %feature("docstring") gum::credal::CredalNet::setCPT 366 " 367 Warnings 368 -------- 369 (experimental function) - Parameters to be wrapped 370 371 372 Set the vertices of one credal set of a given node (any instantiation index) 373 374 Parameters 375 ---------- 376 id : int 377 the Id of the node 378 entry : int 379 the index of the instantiation (from 0 to K - 1) excluding the given node (only the parents are used to compute the index of the credal set) 380 ins : pyAgrum.Instantiation 381 the Instantiation (only the parents matter to find the credal set index) 382 cpt : tbw 383 the vertices of every credal set (for each instantiation of the parents) 384 385 Warnings 386 -------- 387 DOES not change the BayesNet(s) associated to this credal net ! 388 " 389 390 %feature("docstring") gum::credal::CredalNet::setCPTs 391 " 392 Warnings 393 -------- 394 (experimental function) - Parameters to be wrapped 395 396 397 Set the vertices of the credal sets (all of the conditionals) of a given node 398 399 Parameters 400 ---------- 401 id : int 402 the NodeId of the node 403 cpt : tbw 404 the vertices of every credal set (for each instantiation of the parents) 405 406 Warning 407 ------- 408 DOES not change the BayesNet (s) associated to this credal net ! 409 " 410 411 %feature("docstring") gum::credal::CredalNet::src_bn 412 " 413 Returns 414 ------- 415 pyAgrum.BayesNet 416 Returns a constant reference to the original BayesNet (used as a DAG, it's CPTs does not matter). 417 " 418