Research Article

Efficiently and Effectively Mining Time-Constrained Sequential Patterns of Smartphone Application Usage

Algorithm 1

The algorithm proposed to mine time-constrained sequential patterns.
Part 1: The main function
Function: Mining
Input: A session database D, a prefix session S p, the minimum support θ, the time constraint δ
Output: A set of patterns R, which initially is empty
Steps:
() Suffixes = Preparation
() For each pattern P in Suffixes, do:
()    Treat P as a dependent pattern and append it to S p to generate P (d)
()    If sup , then do
()      
()    Treat P as an independent pattern and append it to S p to generate P (i)
()    If sup , then do
()      
()    S = the session transformed from P
()     = Projection (D, S p, S)
(11)       ()
Part 2: The function used to prepare suffixes for growing patterns
Function: Preparation
Input: A session database , a prefix session , the minimum support , the time constraint
Output: A set of patterns , which initially is empty
Steps:
()  = a map used to store independent single-item itemsets
()  = a map used to store dependent single-item itemsets
() For each session in , do
()    For each index from the first independent to last itemset in , do
()      If , then do
()        Escape from the inner loop
()      For each item in
()        Increase the count in for appearance of
()      If is dependent, then do
()        For each item in
()          Increase the count in for appearance of
()   For each index from the first independent to last itemset in , do
()     If in , then do
()        If , then do
()          For each item in but not in , do
()             Increase the count in for appearance of
()          Escape from the inner loop
() For each itemset in , do
()   If the count
()      = transformed into a pattern
()     
() For each itemset in do
()   If the count
()      = transformed into a pattern
()     
Part 3: The function used to project a database
Function: Projection
Input: A session database , a prefix session , a base session
Output: A set of sessions , which is initially empty, used to build a database
Steps:
()  For each session in , do
()    
()     = the session transformed from
()    If is dependent, then do
()       = the session generated by appending to
()    If is dependent, then do
()       = the session generated by appending to
()    If ( is appended but is not)
        or ( and are appended and ), then do
()      If , then do
()          = the sub-session generated by removing
()    = the session generated by using to project
()