CollapseLoops#

Data processor#

class retentioneering.data_processors_lib.collapse_loops.CollapseLoops(params)[source]#

Find loops and create new synthetic events in the paths of all users having such sequences.

A loop - is a sequence of repetitive events. For example “event1 -> event1”

Parameters:
suffix{“loop”, “count”}, optional
  • If None, event_name will be event_name without any changes.

For example “event1 - event1 - event1” –> event1.

  • If loop, event_name will be event_name_loop.

For example “event1 - event1 - event1” –> event1_loop.

  • If count, event_name will be event_name_loop_{number of events}.

For example “event1 - event1 - event1” –> event1_loop_3.

time_agg{“max”, “min”, “mean”}, default “min”

Aggregation method to calculate timestamp values for new groups.

Returns:
Eventstream

Eventstream with:

  • raw events: the returned events will be marked _deleted=True and soft-deleted from input eventstream.

  • new synthetic events: the returned events will be added to the input eventstream with columns below.

event_name

event_type

timestamp

event_name_loop

group_alias

min/max/mean(group of repetitive events))

event_name_loop_{count}

group_alias

(min/max/mean(group of repetitive events))

event_name

group_alias

(min/max/mean(group of repetitive events))

See also

StepMatrix

This class provides methods for step matrix calculation and visualization.

RawDataSchema

Define schema for raw_data columns names.

Notes

If an eventstream contains custom columns they will be aggregated in the following way:

  • for numeric columns the mean value will be calculated for each collapsed group. None values are ignored. Supported numeric types are: bool, int, float.

  • for string columns, if all the values to be aggregated in the collapsing group are equal, this single value will be returned, otherwise - None. None values in the input data will be ignored.

See Data processors user guide and Eventstream custom columns’ explanation for the details.

class retentioneering.data_processors_lib.collapse_loops.CollapseLoopsParams(*, suffix=None, time_agg='min')[source]#

A class with parameters for CollapseLoops class.

Eventstream#

CollapseLoopsHelperMixin.collapse_loops(suffix=None, time_agg='min')[source]#

A method of Eventstream class that finds loops and creates new synthetic events in paths of all users having such sequences.

A loop - is a sequence of repetitive events. For example “event1 -> event1”

Parameters:
suffix{“loop”, “count”}, optional
  • If None, event_name will be event_name without any changes.

For example “event1 - event1 - event1” –> event1.

  • If loop, event_name will be event_name_loop.

For example “event1 - event1 - event1” –> event1_loop.

  • If count, event_name will be event_name_loop_{number of events}.

For example “event1 - event1 - event1” –> event1_loop_3.

time_agg{“max”, “min”, “mean”}, default “min”

Aggregation method to calculate timestamp values for new groups.

Returns:
Eventstream

Input eventstream with loops replaced by new synthetic events.