1 %feature("docstring") gum::LabelizedVariable 2 " 3 LabelizedVariable is a discrete random variable with a customizable sequence of labels. 4 5 LabelizedVariable(aName, aDesc='', nbrLabel=2) -> LabelizedVariable 6 Parameters: 7 * **aName** (*str*) -- the name of the variable 8 * **aDesc** (*str*) -- the (optional) description of the variable 9 * **nbrLabel** (*int*) -- the number of labels to create (2 by default) 10 11 LabelizedVariable(aLDRV) -> LabelizedVariable 12 Parameters: 13 * **aLDRV** (*pyAgrum.LabelizedVariable*) -- The pyAgrum.LabelizedVariable that will be copied 14 15 Examples 16 -------- 17 >>> import pyAgrum as gum 18 >>> # creating a variable with 3 labels : '0', '1' and '2' 19 >>> va=gum.LabelizedVariable('a','a labelized variable',3) 20 >>> print(va) 21 a:Labelized(<0,1,2>) 22 >>> va.addLabel('foo') 23 (gum::LabelizedVariable@0x7fc4c840dd90) a:Labelized(<0,1,2,foo>) 24 >>> va.changeLabel(1,'bar') 25 >>> print(va) 26 a:Labelized(<0,bar,2,foo>) 27 >>> vb=gum.LabelizedVariable('b','b',0).addLabel('A').addLabel('B').addLabel('C') 28 >>> print(vb) 29 b:Labelized(<A,B,C>) 30 >>> vb.labels() 31 ('A', 'B', 'C') 32 >>> vb.isLabel('E') 33 False 34 >>> vb.label(2) 35 'C' 36 >>> vc=gum.LabelizedVariable('b','b',['one','two','three']) 37 >>> vc 38 (gum::LabelizedVariable@0x7fc4c840c130) b:Labelized(<one,two,three>) 39 " 40 41 %feature("docstring") gum::LabelizedVariable::changeLabel 42 " 43 Change the label at the specified index 44 45 Parameters 46 ---------- 47 pos : int 48 the index of the label to be changed 49 aLabel : str 50 the label to be added to the labelized variable 51 52 Raises 53 ------ 54 pyAgrum.DuplicatedElement 55 If the variable already contains the new label 56 pyAgrum.OutOfBounds 57 If the index is greater than the size of the variable 58 " 59 60 %feature("docstring") gum::LabelizedVariable::eraseLabels 61 " 62 Erase all the labels from the variable. 63 " 64 65 %feature("docstring") gum::LabelizedVariable::isLabel 66 " 67 Indicates whether the variable already has the label passed in argument 68 69 Parameters 70 ---------- 71 aLabel : str 72 the label to be tested 73 74 Returns 75 ------- 76 bool 77 True if the label already exists 78 " 79 80 %feature("docstring") gum::LabelizedVariable::domain 81 " 82 Returns 83 ------- 84 str 85 the domain of the variable as a string 86 " 87 88 %feature("docstring") gum::LabelizedVariable::clone 89 " 90 Returns 91 ------- 92 pyAgrum.LabelizedVariable 93 a copy of the LabelizedVariable 94 " 95