Module

pycaret.logging.events

Structured event types emitted by PyCaret 4.0 operations.

Events are the single source of truth for "what happened during this run":

  • Every Experiment method emits at least one event.
  • Events are immutable dataclasses that can be serialized to JSON.
  • A React UI subscribes to the stream (via BaseLogger.subscribe(...)) and renders progress; an LLM agent reads the same stream as trace data.

EventKind is a string-enum so events can round-trip through JSON without custom encoders.

Classes 2

EventKind

extends StrEnum

Canonical event kinds. String-valued for JSON round-tripping.

Attributes
  • EXPERIMENT_STARTED
  • EXPERIMENT_FITTED
  • EXPERIMENT_FINISHED
  • PREPROCESSOR_STARTED
  • PREPROCESSOR_FITTED
  • DATA_SPLIT
  • MODEL_CREATE_STARTED
  • MODEL_CREATED
  • MODEL_COMPARE_STARTED
  • MODEL_COMPARED
  • MODEL_COMPARE_FINISHED
  • MODEL_TUNE_STARTED
  • MODEL_TUNED
  • MODEL_ENSEMBLE_STARTED
  • MODEL_ENSEMBLED
  • MODEL_BLEND_STARTED
  • MODEL_BLENDED
  • MODEL_STACK_STARTED
  • MODEL_STACKED
  • MODEL_CALIBRATE_STARTED
  • MODEL_CALIBRATED
  • MODEL_FINALIZED
  • MODEL_PREDICTED
  • MODEL_SAVED
  • MODEL_LOADED
  • WARNING
  • ERROR

Event

An immutable record of something that happened during an experiment.

Attributes#

kind : EventKind

Canonical kind string.

timestamp : float

Unix seconds since the epoch, captured via `time.time()`.

duration_ms : float, optional

Wall-clock duration for "finished" events. `None` for point events.

message : str

Short human-readable summary.

payload : dict

Structured fields specific to this event kind (e.g. `{"model_id": "lr",
"score": 0.83}`). JSON-serializable by convention.

experiment_id : str, optional

Stable id of the emitting experiment (defaults to the experiment's
`session_id` stringified).
Attributes
  • kind: EventKind
  • message: str
  • payload: dict[str, Any]
  • duration_ms: float | None
  • timestamp: float
  • experiment_id: str | None
Methods
to_dict(self) -> dict[str, Any]

Return a JSON-serializable dict representation.