Skip to content

Model

EventModel

build classmethod

build(
    preproc: EventPreproc,
    size: str | Size | TabularModelSize,
    block: str | BlockType = ATTN,
    dropout: float | None = 0.12,
) -> EventModel

Event model to generate synthetic event data.

Parameters:

Name Type Description Default
preproc EventPreproc

An EventPreproc object.

required
size str | Size | TabularModelSize

The size configuration of the model. Could be either a TabularModelSize object, a Size object, or a string representation of the latter.

required
block str | BlockType

The block type. The possible values depend on whether the data is single table or multi table. For a single table, either 'free' (default), 'causal', or 'lstm'. For multi table data, either 'free' (default) or 'lstm'.

ATTN
dropout float | None

The dropout probability.

0.12

Returns:

Type Description
EventModel

An EventModel instance.

generate

generate(
    n_samples: int | None = None,
    ctx: dict[str, DataFrame] | None = None,
    max_n_events: int = 0,
    forbidden_events: Iterable[str] = (),
    force_final: bool = False,
    force_event: bool = False,
    batch_size: int = 0,
    temp: float = 1.0,
) -> RelationalData

Generate synthetic event data.

Parameters:

Name Type Description Default
n_samples int | None

Desired number of samples in the root table. Must be given if and only if ctx is not provided.

None
ctx dict[str, DataFrame] | None

The context from where to start a conditional generation. If provided, n_samples should not be given. If some context columns were provided to the EventPreproc, at least these columns must be provided as context and the model will generate the remaining columns of the root table and the events. The context can take two forms: 1. Only some columns of the root table (provided to the EventPreproc). The model will generate the remaining columns of the root tabel and the events. 2. All columns of the root table, and some events. In this case the model will generate the following events.

None
max_n_events int

Maximum number of events for each row of the root table. If 0, no limit is enforced.

0
forbidden_events Iterable[str]

The tables containing events that should not be generated. May contain both final and non-final events.

()
force_final bool

Whether to force the generation to end with a final table.

False
force_event bool

Whether to force the generation of non-final events, until the max number of events is reached. If True, the parameter max_n_events must be provided.

False
batch_size int

Batch size used during generation. If 0, all data is generated in a single batch.

0
temp float

Temperature parameter for sampling.

1.0

Returns:

Type Description
RelationalData

A RelationalData object with the generated synthetic tabular data.

save

save(path: Path | str) -> None

Save the EventModel to a checkpoint at the given path.

Parameters:

Name Type Description Default
path Path | str

The path where to sve the checkpoint.

required

load classmethod

load(path: Path | str) -> EventModel

Load the EventModel from the checkpoint at the given path.

Parameters:

Name Type Description Default
path Path | str

The path to the loaded checkpoint.

required

Returns:

Type Description
EventModel

The loaded EventModel.