User lifetime hist#

Class#

class retentioneering.tooling.user_lifetime_hist.user_lifetime_hist.UserLifetimeHist(eventstream)[source]#

Plot the distribution of user lifetimes. A users lifetime is the timedelta between the first and the last events of the user.

Parameters:
eventstreamEventstreamType

See also

EventTimestampHist

Plot the distribution of events over time.

TimedeltaHist

Plot the distribution of the time deltas between two events.

Eventstream.describe

Show general eventstream statistics.

Eventstream.describe_events

Show general eventstream events statistics.

DropPaths

Filter user paths based on the path length, removing the paths that are shorter than the specified number of events or cut_off.

Notes

See Eventstream user guide for the details.

fit(timedelta_unit='s', log_scale=None, lower_cutoff_quantile=None, upper_cutoff_quantile=None, bins=20)[source]#

Calculate values for the histplot.

Parameters:
timedelta_unitDATETIME_UNITS, default ‘s’

Specify units of time differences the histogram should use. Use “s” for seconds, “m” for minutes, “h” for hours and “D” for days.

log_scalebool or tuple of bool, optional
  • If True - apply log scaling to the x axis.

  • If tuple of bool - apply log scaling to the (x,``y``) axes correspondingly.

lower_cutoff_quantilefloat, optional

Specify time distance quantile as the lower boundary. The values below the boundary are truncated.

upper_cutoff_quantilefloat, optional

Specify time distance quantile as the upper boundary. The values above the boundary are truncated.

binsint or str, default 20

Generic bin parameter that can be the name of a reference rule or the number of bins. Passed to numpy.histogram_bin_edges.

Returns:
None
plot(width=6.0, height=4.5)[source]#

Create a sns.histplot based on the calculated values.

Parameters:
widthfloat, default 6.0

Width in inches.

heightfloat, default 4.5

Height in inches.

Returns:
matplotlib.axes.Axes

The matplotlib axes containing the plot.

property values#
Returns:
tuple(np.ndarray, np.ndarray)
  1. The first array contains the values for histogram.

  2. The first array contains the bin edges.

Eventstream#

Eventstream.user_lifetime_hist(timedelta_unit='s', log_scale=None, lower_cutoff_quantile=None, upper_cutoff_quantile=None, bins=20, width=6.0, height=4.5, show_plot=True)[source]#

Plot the distribution of user lifetimes. A users lifetime is the timedelta between the first and the last events of the user.

Parameters:
show_plotbool, default True

If True, histogram is shown.

See other parameters’ description

UserLifetimeHist

Returns:
UserLifetimeHist

A UserLifetimeHist class instance with given parameters.