lifecycles.algorithms.analyze_flow

analyze_flow(lc: LifeCycle, target: str, direction: str, min_branch_size=1, attr: str | None = None) dict

Analyze the flow of a set with respect to a given temporal direction. Specifically, compute the entropy of the flow, the contribution factor, the difference factor and the set size. If one of more attributes are specified via the attr parameter, also compute the entropy of the attribute values, the entropy change, the purity and the most common attribute value. In case min_branch_size is specified, all branches of the flow that include less than min_branch_size elements are discarded. :param lc: a LifeCycle object :param target: the name of the set to analyze :param direction: the temporal direction in which the set is to be analyzed :param min_branch_size: the minimum number of elements that a branch must contain to be considered :param attr: the name or list of names of the attribute(s) to analyze. If None, no attribute is analyzed :return: a dictionary containing the analysis results

Example:

>>> import lifecycles as lcs
>>> # ... create a lc object here ...
>>> analysis = lcs.analyze_flow(lc, "1_0", "+")