LabelizedVariable.posLabel

LabelizedVariable.posLabel(label)

Return the position (index) of a label in the variable’s domain.

Parameters:

label (str) – the label to look up

Returns:

the index of the label in the domain

Return type:

int

Raises:

pyagrum.NotFound – if the label does not exist in the domain

Example

import pyagrum as gum

c = gum.LabelizedVariable("c", "color", ["red", "green", "blue"])
c.posLabel("green")
# 1

Class

LabelizedVariable