ForwardSampling.makeSample

ForwardSampling.makeSample(N, seed=None)

Make N samples using forward sampling.

Parameters:
  • N (int) – Amount of samples.

  • seed (int) – Seed for the random number generator (deprecated).

Returns:

the object itself.

Return type:

ForwardSampling

Warning

The argument seed is deprecated after 3.3.2: the samples are drawn with the random generator of aGrUM, use pyagrum.initRandom (or pyagrum.RandomGeneratorGuard) to make them reproducible.

Example

import pyagrum as gum
import pyagrum.clg as gclg

gum.initRandom(42)  # the draws of pyagrum.clg come from the random generator of aGrUM
clg = gclg.SEM.toclg("""
A = 2[1]
B = 1 + 0.5A[2]
C = 3 + B[1]
""")
fs = gclg.ForwardSampling(clg)
fs.makeSample(100)  # returns the sampler itself
fs.toarray().shape
# (100, 3)

Class

ForwardSampling