BNDatabaseGenerator.samplesAt
- BNDatabaseGenerator.samplesAt(row, col)
Get the value of the database in (row,col)
- Parameters:
row (
int) – the rowcol (
int) – the column (using the ordered list of variables)
- Returns:
the index of the modality of the variable in this position
- Return type:
int
Example
import pyagrum as gum
bn = gum.fastBN("A->B")
bn.cpt("A").fillWith([0.5, 0.5])
bn.cpt("B")[:] = [[0, 1], [1, 0]] # B is the opposite of A
generator = gum.BNDatabaseGenerator(bn)
ll = generator.drawSamples(5, {"A": 1}) # only samples with A=1
generator.samplesAt(0, 0), generator.samplesAt(0, 1)
# (1, 0)
Class