user2: A, B, C, C, C

user3: C, D, C, D, C, D

This eventstream consists of 3 unique users and 4 unique events. The event colors denote sessions (there are 6 sessions). We ignore the timestamps since the edge weights calculation does not take them into account. Note that throughout this example we will suppress ``edge_`` prefix for the ``edges_norm_type`` and ``edges_weight_col``. |edge_weights_col_none| describes how the edge weights are calculated in case of ``weight_col='event_id'``. .. |edge_weights_col_none| replace:: Table 1 .. figure:: /_static/user_guides/transition_graph/weight_col_none.png Table 1. The calculation of the edge weights for weight_col='event_id' and different normalization types. So we have 8 unique edges in total. At first, we calculate for each edge the total number of such transitions occurred in the eventstream. As a result, we get the values in ``norm_type=None`` column. Next, we estimate the total number of the transitions in the eventstream: 14. To get the weights in ``norm_type='full'`` column, we divide the weights in ``norm_type=None`` column by 14. Finally, we estimate that we have 4, 2, 6, 1 transitions starting from event ``A``, ``B``, ``C``, and ``D`` correspondingly. Those are the denominators for ``norm_type='node'`` column. To calculate the weights for this option, we divide the values in ``norm_type=None`` by these denominators. The calculation of the edge weights for ``weight_col='user_id'`` is described in |edge_weights_col_user_id|. .. |edge_weights_col_user_id| replace:: Table 2 .. figure:: /_static/user_guides/transition_graph/weight_col_user_id.png Table 2. The calculation of the edge weights for weight_col='user_id' and different normalization types. Now, for ``norm_type=None`` option we calculate the number of unique users who had a specific transition. For ``norm_type='full'`` the denominator is 3 as the total number of users in the eventstream. As for ``norm_type='node'`` option, we have 2, 2, 3, 1 unique users who experienced ``A → *``, ``B → *``, ``C → *``, ``D → *`` transitions. These values comprise the denominators. Again, to get the weights in ``norm_type='column'``, we divide the values from ``norm_type=None`` column by these corresponding denominators. Finally, in |edge_weights_col_session_id| we demonstrate the calculations for ``weight_col='session_id'`` . .. |edge_weights_col_session_id| replace:: Table 3 .. figure:: /_static/user_guides/transition_graph/weight_col_session_id.png Table 3. The calculation of the edge weights for weight_col='session_id' and different normalization types. In comparison with the case for ``user_id`` weight column, there are some important differences. Transitions ``B → A``, ``C → A``, ``B → C`` are excluded since they are terminated by the session endings (their weights are zeros). As for the other transitions, we calculate the number of unique sessions they belong to. This is how we get ``norm_type=None`` column. The total number of the sessions in the eventstream is 6. This is the denominator for ``norm_type='full'`` column. The denominators for ``norm_type='node'`` column are calculated as the number of the unique sessions with ``A → *``, ``B → *``, ``C → *``, and ``D → *`` transitions. They are 4, 0, 2, and 1 correspondingly. Note that for ``B → A`` and ``B → C`` edges we have indeterminate form 0/0, since we have excluded all the transitions starting from ``B``. We define the corresponding weights as 0. Also, the denominator for ``C → *`` edges is 2, not 3 since we have excluded one ``C → A`` transition. Node weights ^^^^^^^^^^^^ Besides edge weights, a transition graph also have node weights that control the diameters of the nodes. Unfortunately, so far only one option is supported: ``norm_type=None`` along with weighting columns. By default, ``weight_col='user_id'``. If you want to know how the node weights for ``norm_type='full'`` are calculated, expand the following text snippet: .. toggle:: Obviously, node weights do not support ``norm_type='node'`` since it involves edges by design. However, ``node_norm_type=None`` and ``norm_type='full'`` options might be calculated. They leverage the same calculation logic as we used for the edge weights calculation. We explain this logic using the same :ref:`example eventstream

event_id | event_type | event_index | event | timestamp | user_id | |
---|---|---|---|---|---|---|

0 | c209a540-5bdf-45ef-84da-917b0751fb3f | raw | 0 | catalog | 2019-11-01 17:59:13.273932 | 219483890 |

1 | ab361d87-ed46-45d1-950b-9e58c57a017c | raw | 1 | product1_group | 2019-11-01 17:59:28.459271 | 219483890 |

2 | fa45b90d-5c03-4d09-b977-5c8a3d2fc32f | raw | 2 | cart | 2019-11-01 17:59:29.502214 | 219483890 |

3 | 1b423d0c-a611-48d1-a20f-a264dd51b4b2 | raw | 3 | catalog | 2019-11-01 17:59:32.557029 | 219483890 |

4 | c0fcfaf6-2899-4f07-93e8-776a5147f8d4 | raw | 4 | catalog | 2019-11-01 21:38:19.283663 | 964964743 |

5 | bde282ab-5153-492e-83c1-8903ccf78a6b | raw | 5 | cart | 2019-11-01 21:38:36.761221 | 964964743 |

6 | 82c5197e-9a5e-4c16-b6be-92c3aa0c2c08 | raw | 6 | delivery_choice_group | 2019-11-01 21:38:37.564693 | 964964743 |

.. _transition_graph_transition_matrix: Transition matrix ----------------- :py:meth:`Transition matrix

cart | catalog | ... | payment_done | payment_cash | |
---|---|---|---|---|---|

cart | 0.000594 | 0.283848 | ... | 0.000000 | 0.0 |

catalog | 0.418458 | 0.633375 | ... | 0.000000 | 0.0 |

... | ... | ... | ... | ... | ... |

payment_done | 0.000000 | 0.000000 | ... | 0.000000 | 0.0 |

payment_cash | 0.000000 | 0.000000 | ... | 0.708333 | 0.0 |