Learner.learnCTBN

Learner.learnCTBN(template=None)

Learns a CTBN, using the CTPC (continuous-time PC) algorithm.

Parameters:

template (CTBN) – CTBN used to find variables. If not given, variables are searched inside the trajectories. (if the trajectory is very short, some variables can be missed).

Returns:

The learned ctbn.

Return type:

CTBN

Example

import pyagrum.ctbn as ct

data = {
  0: [
    (0.0, "A", "a0"),
    (0.0, "B", "b0"),
    (1.0, "A", "a0"),
    (2.0, "B", "b0"),
    (3.0, "A", "a1"),
    (4.0, "A", "a0"),
    (4.0, "B", "b1"),
  ]
}
learner = ct.Learner(data)  # or the name of a csv file of trajectories
learned = learner.learnCTBN()
sorted(learned.names())
# ['A', 'B']
learned.labels("B")
# ('b0', 'b1')

Class

Learner