Case study: the UWV unemployment-benefit application#

The clickstream of the paper, read as a story. Where do applicants start, which service sequences are typical, where do they hesitate, and which steps are predictable?

import matplotlib.pyplot as plt

import spmviz as sv
from spmviz.viz import plot_prediction, plot_prefix_tree, plot_sankey, plot_transition_graph

db = sv.datasets.load_clickstream()
ps = sv.mine(db, 0.01, algorithm="cmspam", max_gap=1, max_length=10)

The paths of the first steps#

plot_sankey(db, max_steps=5, top=6)
Sankey diagram of 343 sequences
<Axes: title={'left': 'Sankey diagram of 343 sequences'}>

The transition graph of the services#

plot_transition_graph(db, top_edges=26, labels=None)
transition (directly-follows) graph
<Axes: title={'left': 'transition (directly-follows) graph'}>

Predictability of the next service#

plot_prefix_tree(db, max_depth=4, min_count=12, color_by="entropy")
plot 02 clickstream story
<Axes: >

What comes next after “Your last employer → The dismissal”?#

obs = [0, 1]  # Your last employer, The dismissal
print(sv.predict_next(ps, obs))
plot_prediction(ps, obs)
plt.show()
what comes next? (confidence of the extensions of the longest matching frequent sequence)
            next  probability  support                             context
0  The dismissal     0.448276       26  Your last employer → The dismissal
1   Hours worked     0.344828       20  Your last employer → The dismissal

Total running time of the script: (0 minutes 0.444 seconds)

Gallery generated by Sphinx-Gallery