Skip to main content
Version: Next

ts_shape.eventlog.lambda_rules.backtest

Minimal hit-count backtest for lambda rules.

The first-slice MVP supports "run rule, count hits" only — no label-matching, no precision/recall. The returned :class:BacktestResult still carries the full :class:EventLog so the caller can inspect any individual hit and run their own downstream analysis (e.g. to_event_log_xes for pm4py, filter_by_pack for domain-specific drill-down).

Functions
NameDescription
run_backtestRun detector over dataframe and summarize hit counts.

run_backtest​

functionsource
run_backtest(
detector: LambdaDetector,
dataframe: pd.DataFrame,
*,
objects: Mapping[str, object] | None = None,
qualifiers: Mapping[str, str] | None = None
) -> BacktestResult

Run detector over dataframe and summarize hit counts.

Parameters
NameTypeDescriptionDefault
detectorLambdaDetectorThe registered lambda rule.required
dataframeDataFrameInput frame the rule is evaluated on.required
objectsMapping[str, object] | NoneObject bindings passed to the event-log adapter.None
qualifiersMapping[str, str] | NoneRelation qualifier per object type.None
Returns
NameTypeDescription
ABacktestResultclass:BacktestResult with the hit count, hits per severity and
BacktestResultper asset, and the full event log.