HOVA-FPPM: Flexible Periodic Pattern Mining in Time Series Databases Using Hashed Occurrence Vectors and Apriori Approach

Finding flexible periodic patterns in a time series database is nontrivial due to irregular occurrence of unimportant events, which makes it intractable or computationally intensive for large datasets.,ere exist various solutions based on Apriori, projection, tree, and other techniques to mine these patterns. However, the existence of constant size tree structure, i.e., suffix tree, with extra information in memory throughout the mining process, redundant and invalid pattern generation, limited types of mined flexible periodic patterns, and repeated traversal over tree data structure for pattern discovery, results in unacceptable space and time complexity. In order to overcome these issues, we introduce an efficient approach called HOVA-FPPM based on Apriori approach with hashed occurrence vectors to find all types of flexible periodic patterns. We do not rely on complex tree structure rather manage necessary information in a hash table for efficient lookup during the mining process. We measured the performance of our proposed approach and compared the results with the baseline approach, i.e., FPPM. ,e results show that our approach requires lesser time and space, regardless of the data size or period value.


Introduction
Data mining allows us to discover useful information from the data that would otherwise be very hard to uncover. e process of data mining involves various tasks including classification, clustering, pattern mining, and several others [1]. Pattern mining is a subfield of data mining that focuses on discovering useful patterns within a given dataset [2]. It finds either a single item or a set of items that appear more than a certain threshold set by the user. A classic example would be the patterns of frequently bought items together. It is common for companies to store the transactions, containing the type and name of the items, in their databases. e data of these transactions are used to mine the patterns of frequently bought items together [3]. Traditionally, these patterns help the stores in deciding which set of items is required to place together for customers.
Time series datasets are common these days, having some of the application areas such as economics, social sciences, epidemiology, medicine, and physical sciences, for instance, measuring a person's heart rate after every minute, readings of air temperature or wind after every hour, stock rates at mid and end of every day, and so on. Mining the patterns from time series data is usually referred to as periodic pattern mining [4][5][6][7]. e periodic patterns in the mining process are usually categorized as symbol, sequence (partial), and full-cycle (segment) periodic patterns [8][9][10][11]. Symbol periodicity happens when there is a single event that reappears in the time series after a specific time period. Sequence periodicity is the reoccurrence of multiple symbols after a specific time period. Full-cycle periodicity is the repetition of the whole data in a given period. Recently, research focus has been shifted towards the flexible periodic pattern mining [9,[12][13][14][15]. e idea behind flexible pattern mining is to discover a set of events that do not necessarily appear together, but those events are accompanied by random events in between them periodically, i.e., {event imp , event unimp , event imp , event imp }. e term flexibility refers to the existence of irregular occurrence of unimportant events between frequently occurring events at different time periods. Let us consider the example of bank transactions [12] denoted as {a, b, c, d} for amounts in millions for 0-5, 5-10, 10-15, and ≥15, respectively. Given a set of transactions {abd, accd, ad, abbccd} and a manager is interested to analyze the patterns of transactions having lower a and higher d amounts. We observe that there is no exact number of transaction types between a and d. Such a scenario can be formally represented as a { * }d, where 0 * 0 shows flexibility in the number of options (transaction types) to consider during mining and we consider it as a flexible pattern mining problem. e use of suffix tree (prefix trie or trie) data structure is prevalent among state-of-the-art approaches towards flexible periodic pattern mining. Rasheed et al. [9] constructed suffix tree from time series data to mine flexible periodic patterns. Similarly, Chanda et al. [12] introduced an improved approach based on suffix tree data structure. ere exists inmemory linear time algorithm to construct the suffix tree [16] and pruning strategy suggested in [12]; however, repeated traversal over such a tree structure makes the overall mining process computation intensive. We observe various redundant (unnecessary) patterns kept for a significant amount of time, and tree size remains constant throughout the mining process. In our understanding, a better strategy is required to be space and time efficient while keeping necessary information and producing the same patterns.
In this paper, we introduce an efficient strategy based on hashed occurrence vectors and Apriori approach, which does not rely on suffix tree data structure [9,12] rather on hash table for efficient lookup, to mine periodic patterns from time series data without compromising on the results. Our approach comprises of discretization of time series data, periodicity detection, and pattern mining modules. We maintain uniquely variable length periodic patterns along with their occurrence vectors as key-value pairs in a hash table, where key represents pattern and occurrence vector is stored as corresponding value. We use arithmetic on occurrence vectors of discretized events to compute periodicity of the underlying patterns. e proposed periodicity detection algorithm is different from existing algorithms in terms of removing the redundant occurrence vector values and computing periodicity of all patterns at same level in one pass. We tailor the incremental pattern mining process to use occurrence vectors of existing patterns in hash table to  explore new patterns and update the hash table once patterns  found at each level. e contributions of our work are as follows. (i) We propose HOVA-FPPM to simplify flexible periodic pattern mining process through an efficient key-value pair data structure. (ii) We maintain necessary information (patterns and their occurrence vectors) and compute efficiently (through basic arithmetic on occurrence vectors, reducing redundant and invalid patterns) to significantly improve time and space complexity of our approach. (iii) Our approach requires single pass to discover symbol, partial, and full-cycle periodic patterns at any periodic level. (iv) Comprehensive performance analysis on real-world datasets with the baseline algorithm shows the run time effectiveness and space efficiency of our approach while maintaining the same accuracy. e rest of the paper is organized as follows. We discuss related works followed by preliminaries section. e proposed methodology with detailed explanation of the algorithm is discussed afterwards. Subsequently, we outline the experimental analysis of the proposed methodology in comparison to the baseline approach on real-world datasets. We also provide a detailed discussion at the end. Lastly, we conclude the paper along with its future directions.

Literature Review
In this section, we briefly discuss various approaches in the context of periodicity mining, which is subfield of pattern mining. Pattern mining has other subfields depending on the type of mined patterns such as frequent item sets [3], sequential patterns [8,11,17,18], high utility patterns [19][20][21][22], periodic patterns [23][24][25], as well as flexible periodic patterns [9,12,26]. Chanda et al. [12] put forth an algorithm recently that finds flexible periodic patterns in a time series by using suffix tree data structure. In their approach, they first made a suffix tree from the time series and then used that suffix tree to mine patterns of various lengths.
After an extensive literature review of the periodic pattern mining algorithms, we noticed that all of these algorithms can be categorized based on the approaches they used in their algorithmic solutions (refer to the taxonomy of frequent pattern mining in Figure 1). For instance, some algorithms use the Apriori approach to find patterns in an increasing length, whereas others use a tree-like structure to avoid the memory requirement and mine the patterns from it. Each approach has its own benefits and drawbacks. erefore, instead of categorizing algorithms based on the types of patterns they were mining, we group them based on their underlying approaches.
e key approaches were Apriori, tree based, projection based, and others. e other category contains algorithms that follow a uncommon approach.

Apriori-Based Approaches.
e earlier works based on Apriori approaches were not able to mine all types of patterns at once. However, some important properties, monotone and anti-monotone, were introduced later that helped in improving the performance of mining algorithms [17,18]. e most recent algorithm that could detect flexible periodic patterns of all types was presented by Nishi et al. [19]. e algorithm used Apriori-based approach to mine all the valid patterns by using the occurrence vectors.

Scientific Programming
Algorithm started by mining one-length patterns and then moved to the two length patterns and so on. e found patterns are made flexible by inserting " * " as special character. As per the authors' claim, their algorithm is capable of finding some interesting patterns which was not possible with previous algorithms. ey also claim that it finds all types of periodic patterns; however, the mining strategy is computationally expensive because of generating a lot of excessive patterns.

Tree-Based Methods.
Many researchers were utilizing an important notion called "closed patterns" in the context of periodic pattern mining that has reduced search space towards mining redundant patterns [20,21,23]. Majority of these algorithms involved the usage of tree structures for pattern mining and ended up reducing the time and space complexity of the decreased number of patterns with reduced tree size. e research trend shifted towards mining a different type of patterns known as the high utility patterns [24][25][26]. Rasheed et al. [9] put forth an algorithm that finds flexible periodic patterns in time series databases using suffix tree. In this approach, suffix tree is created from the time series data and then used to mine patterns of various lengths. Although the authors used a technique of generating patterns incrementally from one-length patterns to two length patterns and so on, unlike other algorithms, they did not follow Apriori approach completely of making excessive and all possible combinations. e suffix tree allowed them to make the combinations with the events that appeared in the suffix tree. Another distinguishing aspect of their approach was that the patterns were not made flexible at the end of the process, rather, it kept attaching the unimportant event symbols with every mined pattern hoping to become a pattern at successive depth of the tree. Recently, Chanda et al. [12] introduced another efficient approach in the same direction for flexible pattern mining using pruned suffix tree.

Projection-Based Techniques.
In this category, unlike other approaches, researchers used the projection database to mine the patterns with multiple pruning techniques. ey introduced the concepts of flexible periodic pattern mining in the domain of closed pattern mining [14,27]. For instance, Akther et al. [14] presented an algorithm to mining closed flexible patterns, which was an improvement over the previously presented paper on flexible closed patterns [27].
ere were some other works on discovering closed patterns using projection database and tree structures [28][29][30].

Other Approaches.
ere are other approaches in literature for pattern mining that includes dynamic time warping [31], information gain [32], and manipulation of bitmap representation of data [33,34]. e dynamic time warping algorithm [31] used a matrix to warp the time dimension of data for insertion or deletion of noise. e WARP algorithm is not capable of detecting all types of periodic patterns; however, handling noise in the data makes it prominent among other approaches. In another work, the authors proposed an extended version of information gain measure [32] to detect periodicity. It is focused on flexible pattern mining with gap penalties, but it only worked for symbol and partial periodic patterns. Another study [35] detected partial periodic patterns with the aim of eliminating the need to know the period lengths before mining. Ayres et al. and Lucchese et al. [33,34] worked on long sequential pattern mining. e data are represented in bitmaps where depth-first search strategy is used to mine the long sequential patterns.
It is evident from the above discussion that the existing approaches either employ complex data structure for pattern mining process or generate excessive redundant or invalid patterns. For instance, in Apriori-based approaches, excessive generation of redundant or invalid patterns reduces time and space efficiency. e effect of excessive pattern generation on tree-and projection-based approaches results in complex tree structure, which further increases the memory usage as well as traversal times. e approach with an effective pattern generation strategy and efficient repeated traversal over data has the potential to overcome the aforementioned limitations of existing studies.

Preliminaries.
In this section, we explain existing terminologies to understand the problem and its solutions.   reoccurs within a specified period of time is known as the periodicity of that event.
For example, in time series T � {abdbc abdba abdac acdca} based on daily activities schedule of a working individual in office, as shown in Figure 2, event "a" is periodic for period value 5. is means if T is divided into pieces of length 5, "a" will always appear at the same place within those pieces. In other words, there will always be four events in between two occurrences of "a." However, if we look at the period value 3 and divide T in pieces of length 3, "a" would not be considered as periodic because "a" does not appear after every two events.
Definition 2. (perfect periodicity). In a time series T, T � {a 0 , a 1 , a 2 , a 3 , . . ., a n }, with n events, an event reoccurring within a specified period of time for the entirety of the time series is known as perfect periodicity.
Perfect periodicity is denoted by PP and defined as follows: For example, in time series T � {abdbc abdba abdac acdca}, PP (5, 0, 19, "abd") � (19 − 0 + 1)/5 results in 4 that means "abd" would have to appear 4 times in the time series in order to have perfect periodicity. However, it has an actual periodicity of 3 in the data.
Definition 3. (periodic pattern). When a pattern repeatedly occurs for a specific period of time and satisfies the support threshold, we call it periodic pattern.
For example, in time series T � {abdbc abdba abdac acdca}, pattern "abd" is periodic with a support of 3 for period value 5 when the threshold support value is 3. In short, event or a sequence of events will be considered a periodic pattern if they satisfy the minimum support threshold for the given period value.
is should not be confused by the support measure. For example, consider the events "ca" in the time series T. If we look at the events in T, we notice that "ca" appears a total of 3 times, which means it satisfies the support threshold considering the whole time series. However, "ca" only appears once if we look at T with a period value of 5 if we start at the index 0 of T. Definition 4. (flexible periodic pattern (FPP)). Any periodic pattern that contains "do not care" events is called flexible periodic pattern.
For example, in time series T � {abdbc abdba abdac acdca}, the pattern "a * d" is a periodic pattern with support 4 and period value 5. It means that event "a" and event "d" occur after every 4 values with a random event in between them. Flexible periodic patterns are difficult to mine through regular pattern mining approaches due to the occurrences of unimportant events.

Definition 5. (occurrence vector
). An occurrence vector is a list that represents the index positions of a unique element (event) in the data. Every unique element (event) has one occurrence vector.
For example, in time series T � {abdbc abdba abdac acdca}, the occurrence vector of the element "a" is [0, 5,9,10,13,15,19], which represents the index positions of the occurrences of event "a" in T. Definition 6. (difference vector). Given a pair of occurrence vectors, the difference vector generates a pattern along with its frequency count. e objective of a difference vector is to obtain a pattern along with its frequency. It is computed by comparing each value of the first occurrence vector with every value of the second occurrence vector. For a given transaction in Figure  3, the pattern ab occurs three times. To generate this pattern, we need to compute the difference a − b, which provides us three occurrences of value −1 in Figure 4 in a table titled "Differences." Similarly, the pattern a * * * * b appears two times; hence, we find the value −5 two times. e difference vector can be positive or negative. A negative value denotes that an element appears before the other element, i.e., a appears before b while computing the difference a − b. A positive value for the said difference denotes that a appears after b. Definition 7. (confidence). Confidence of a pattern is the ratio of actual periodicity and perfect periodicity, as shown in the following equation: conf(p, strt, pattrn) AP(p, strt, end, pattrn) PP(p, strt, end, pattrn) .

HOVA-FPPM: Hashed Occurrence Vectors and Apriori Approach for Flexible Periodic
Pattern Mining e goal of HOVA-FPPM is to overcome the limitations of existing approaches, by eliminating the need of complex data structure such as suffix tree, through Apriori-like approach over occurrence vectors maintained in a hash table to mine flexible periodic patterns. It helps us not only to reduce the space requirements but also to avoid temporary patterns with limited calls to periodicity detection module, which eventually reduces the overall time requirements of the mining process. In the following passages, we discuss the components of our strategy and the proposed algorithm for pattern mining.

Components of HOVA-FPPM Strategy.
e key components involved in our proposed approach are discretization, event lookup table construction, periodicity detection, and pattern mining as depicted in Figure 5.

Discretization.
e discretization process converts each unique element from the data series to a simplified unique element. e sole purpose of the discretization process is to make the process of pattern mining easier, since it is easier to work with a series of data with unique characters than to work with a series of alphanumeric product IDs. For instance, if we have a data series t � {asyt2345, kgjhu6789, enhy4521, enhy4521} containing product IDs, then the discretizing makes our input as t � {a, b, c, c}. Once we perform the discretization over actual time series data, then it produces simplified representation of the same data.

Pattern
Mining. e pattern mining module of our proposed strategy reduces the time required to discover flexible periodic patterns compared with its counterpart. e mining process is based on Apriori approach and involves basic arithmetic operations among occurrence vectors, i.e., difference vector. e occurrence vectors along with the events are managed effectively using key-value pairs with inherent hashing strategy to provide quick lookups for time efficiency. e pattern enumeration step is guided through unique events and polarity of the difference vector values, while frequencies help in deciding whether the pattern is frequent or not given the threshold.

Illustration of HOVA-FPPM with an Example.
We illustrate the process of our pattern mining algorithm with the help of a toy example. For this illustration, we assume the data T � {abccabdcacdcabdc} with a confidence threshold of 50% and maximum allowable unimportant events as 3. e mining process behaves similarly for all sizes of the datasets. e illustration of the process in Figures 3, 4, and 6 does not reflect complete patterns and combinations due to space limitation. After the discretization process, our data should be in the form as given above.
Since we have already passed through the data once, to discretize it, we have the occurrence vectors of all the unique elements in the data. e unique elements are a, b, c, and d.
e occurrence vectors of all these unique elements are available, as shown in Figure 4. Our mining process goes through each unique element and their occurrence vectors to mine the patterns. First, we consider the element a and take its occurrence vector to check the periodicity. It turns out to be periodic for periods of length 4 and 8; therefore, we consider it as one length mined pattern.
For two length patterns, we compare the occurrence vector of one length mined pattern with the occurrence vectors of all other unique elements in our events table. It may generate all the patterns involving elements ab, ac, ad, ba, ca, and da. e way our algorithm works allows us to mine patterns starting from all the elements involved in one iteration, which almost halves the computation of the iteration. We perform difference operation between the occurrence vectors of both elements, one is mined pattern a and second is b, as shown in Figure 5. We compare first value of the occurrence vector of a element with all the values of the occurrence vector of b. We repeat this process for all the values of occurrence vector of a. As a result, we maintain lists of difference values for each position.
e difference operation reveals important information related to frequency, position, and occurrence of patterns. In each difference vector, we have positive and negative values. Since we are performing "a − b" operation, the negative numbers give us the difference between the positions of the a and b, whereas a positive difference value indicates the distance between b and a. For instance, if we have 4 values from the a occurrence vector and we take the difference with 1 value of the b occurrence vector, then it gives us the difference of 3. e difference value is positive, so we know  6 Scientific Programming that this is the distance between b and a. In this particular instance, b has occurred prior to a. If we find 1 positive value 4 times in the difference vectors obtained through the difference operation, then we can conclude that b occurred 4 times before a with a distance of 1. e frequency value 4 of 1 tells us the confidence of that pattern, distance of 1 reveals event distance between b and a, and the positive sign shows that b occurred before a instance. erefore, the mined pattern from this operation is ba with a frequency of 4. If we assume the distance value is 2, then it means a occurred with distance value of 2 after b, which results in generated pattern b * a. e above process is repeated for all successive patterns to be mined from data without redundant and unnecessary computations (see Figure 6 for three length patterns). We get separate difference vectors after the difference operation, where we count the frequencies of all the unique numbers to check whether the pattern is frequent or not. e orientation of the pattern is determined through polarity of the numbers, i.e., ab or ba pattern. e difference tells us how many other events are between a pair of events. Since the maximum allowable unimportant event limit is 3, any number greater than 3 is not considered for the pattern generation.
We are able to generate next level patterns based on these difference vectors. In the current scenario, the patterns ab and b * * a with occurrence vectors [0, 4, 12] and [1,5], respectively, are the only mined patterns. It is important to notice that we did not perform any explicit iteration to get the patterns involving b and a because we already mined these patterns. erefore, when we mine patterns starting from the b element, we do not compare its occurrence vectors with the a element rather with c element. e process is same and generates patterns involving ac and ca. Similarly, in successive iterations, we do not mine patterns ca when considering the c and a elements. In this way, we are able to reduce computations especially when we have a huge amount of unique elements. We have a hash table similar to the original one but includes variable length patterns along with their occurrence vectors. For next level patterns, we take the ab and b * * a patterns and their occurrence vectors to compute the difference vectors. e remaining process is the same as that of one length elements (Algorithm 1).

Proposed Algorithm.
In this section, we discuss the details of our proposed algorithm (see Algorithm 1) for  Scientific Programming mining the flexible periodic patterns. e prerequisite for this algorithm is the discretization of the data, and it is executed initially for each unique element of the dataset. It takes a unique element along with its occurrence vector, the hash table containing all the unique elements, maximum pattern length, and previous keys as input. e previous keys refer to a list that holds already mined events. It is critical to maintain such information because, as we discussed earlier, once we mine the patterns starting from a, we expect to have inverse patterns. e previous keys list prevents us from remining the patterns. e rest of the input is self-explanatory. e output of the algorithm is a list of mined patterns.
e key operations involved in our proposed algorithm are as follows.
(i) Discretize the events while passing through the time series data and count the total occurrences, occurrence vectors, and maximum pattern length for the entire time series. We also make pairs and hash their values in the same pass.   8 Scientific Programming (vi) e frequent events with highest difference count values are considered in the successive levels.
(vii) Add the unimportant symbol for each pattern based on the difference of occurrences.
(viii) Repeat for the next level of patterns.
In the subsequent paragraphs, we explain the steps our proposed algorithm. In line 1, we initialize an empty list to save the mined patterns, and line 2 generates a list of events that we have to mine. Line 2 calls the slice_events function that takes the hash table and previous keys as an input and slices the previous key hashes along with their occurrence vectors. It helps us in reducing mining time. e repetition construct at lines 4-6 scans entire hash-table and its occurrence vectors to compare the events' occurrences. Line 7 computes the difference of elements, and lines 8 and 9 perform a check on the difference value and maximum pattern length. At this stage, we eliminate any difference that is greater than the maximum allowable skippable unimportant event.
Since we expect different patterns depending the polarity of the difference value, we need separate pattern name making sections for it. We perform the operation a − b meaning that the second element in the difference operation is bigger if the result of the difference is positive; therefore, we perform checks on lines 10 and 23. ese sections enable us to make patterns depending on the polarity of the difference value. Line 11 is a check on the difference and the key size. It is important because all our mined patterns are represented by the index of the first element of the pattern. It means that if we have a pattern abc, then this pattern will have the same starting position as the a element. If we have to mine a 4 length pattern from this, then we need to consider elements with a starting position of current key size away. In this case, the pattern abc has a key size 3. Any element that is not 3 steps ahead of the starting position of the current pattern would make it an invalid pattern, which is enforced at line 11. Line 12 calculates the difference from the current key to the next key under consideration and gives us the star count that we would have to add if we mine this pattern. Lines 13 and 14 are a simple check on the maximum skippable event and continue action, respectively. Line 15 calls a function that returns a string containing the number of stars we have from line 12. Line 16 makes a new pattern, and line 17 inserts the occurrence vector value in it. Line 18 saves the newly generated pattern in the pattern list. Lines 20−22 perform the same operation but for single-length events. Lines 23−35 are similar to the ones mentioned above but this section mines the reverse patterns. Lines 36−38 send the newly mined pattern along with the full hash table to next level generation function, which works on more than 2 length patterns. We did not check for periodicity of the newly generated patterns in this function yet. It is because we send these to the next level function, which automatically checks the periodicity itself. Once the patterns are mined and returned, the return list will have all the mined patterns related to the specific event that was passed on to our algorithm function. is whole process will be repeated for every individual unique element.

Complexity Analysis.
We discuss the algorithmic complexity of both approaches based on their key steps. e baseline approach involves three steps that includes suffix tree construction, periodicity check, and pattern generation towards mining. e authors of FPPM algorithm claim that the pruned suffix tree construction has same time complexity as the suffix tree contraction, i.e., O (n), where n is the size of the time series. e periodicity detection relies on the occurrence vector and length of the periodic pattern, i.e., O (k * n^2), where k is the maximum length of periodic pattern and n is size of the time series. e pattern generation involves the levelwise traversal of the pruned suffix tree rooted at corresponding events. e average depth of the traversal is determined by the ladder factor computed prior to the mining step for each node. e overall complexity of the pattern generation step is logarithmic to the number of nodes in a subtree rooted at a particular event, i.e., O (m * log(n)2), where n is the number of nodes of a subtree and m is the number of rooted subtrees.
On the other hand, the proposed approach consists of events table construction, periodicity detection, and pattern mining. e event table construction scans the input data and generates events with corresponding occurrence vectors, linear in time complexity O (n). e periodicity detection algorithm remains the same as the baseline approach so does the complexity of this module. However, our approach deviates in determining periodicity of the patterns early from successive iterations and avoiding it later. e overall complexity remains the same as that of the baseline approach while minimizing the total number of computations. e proposed approach has superiority in pattern mining stage, where we explicitly avoid the traversal of the suffix tree by hashing keyvalue pairs for quick lookup for pattern generation, i.e., from log-scale to constant time. We process the available set of frequent patterns and their occurrence vectors to generate patterns at next level; therefore, complexity depends on total number of patterns p and associated occurrence vectors, i.e., O (k * h(p)2), where k is the length of the pattern and h (p) represents hashed patterns. We did not introduce a new strategy for discretization, which is similar for both approaches, so we neglected it in our complexity analysis.

Experiments.
In this section, we perform experiments to evaluate the efficiency of our proposed approach against baseline approach, i.e., FPPM. In the experimental analysis, we focus on time and space efficiency of both algorithms (the proposed HOVA-FPPM and baseline) by varying period value and data size. Since we use the same settings/parameters (i.e., confidence 60% and support 50% inspired from baseline approach) during our experiments, obtained results are justified as per our claim in this article to prove the superiority of the proposed approach. However, we understand that different values of these parameters will affect the mining results. For instance, increasing the support threshold will reduce the number of mined patterns. We assume that both algorithms produce the same results (no difference in result accuracy), rather, have different requirements for time and space during execution.
We briefly discuss the datasets used in our experiments and describe the results followed by discussion.

Datasets and System.
In our experiments, we use two datasets namely diabetes and bike sharing datasets. Both datasets are publicly available on the UCL Machine Learning Repository with the same names. e diabetes dataset contains a total of roughly 8000 records. It contains records of diabetic patients and their health related results. A total of 20 unique codes are used throughout the dataset to calculate the health of the patients. All of these 20 codes represent measurement for the patient. Each of these codes will have a value for each patient along with a date column to represent time of the patient history record. On the other hand, the bike sharing dataset had a total record of 17000 (roughly) for the hours that the bikes were shared and 730 records for the same bikes but on a day level. e specification of the system used for the experiments is an i5-3320M 2.6 GHz processor with 8 GB RAM and Windows 10 operating system. e algorithms were implemented in Python.

Performance Based on Time and Space.
We analyze the performance of the proposed algorithm with the baseline approach, i.e., FPPM, by measuring execution time and memory space usage.

Performance Based on Varying Data
Size. We try to understand the performance aspect of the proposed algorithm with the baseline approach by varying the size of the data. If we look at the performance of our proposed algorithm (Figure 7), it is evident that our algorithm outperforms the FPPM in both time and space requirements. It is worth noting that the time difference between algorithms is quite significant as compared to the space difference. is is because of the fact that the number of patterns increases significantly with more data. e output (mined patterns) of both of the algorithms is the same. Since our proposed algorithm does not rely on the suffix tree-like data structure, we do not need to allocate the memory and store the data in a tree. In our algorithm, the memory requirement increases with the number of patterns. e dataset under consideration is not big; therefore, space requirements did not grow much for the proposed algorithm. In contrast, the FPPM algorithm's memory requirement increases almost linear to the data growth.

Performance Based on Varying Period
Value. Now we look at the data from varying period value perspective (see Figure 8). is analysis helps us to uncover the effects of changing the period value while keeping the data size fixed for both algorithms. e patterns mined from the data are from all starting positions. As we can see, the time performance of our propose algorithm is significantly better than the FPPM. However, the space requirements start to favor the FPPM in varying period values. is is because of the fact that the space requirement of our algorithm grows with the periods unlike the FPPM, whose space requirement remains fixed.

Performance Analysis on Bike Sharing Dataset.
We also performed experiments on the second dataset, i.e., bike sharing dataset, which is comparatively bigger than the first one. It contains 17000 rows of data containing hourly updates of bike sharing information. We performed experiments on this dataset to understand the scalability aspect of both algorithms. Figure 9 depicts the time performance of both algorithms on a maximum of 6000 rows of data. e proposed algorithm outperformed the FPPM by cutting the time into almost half of what is required for FPPM approach. We performed these experiments with the same settings as before, i.e., confidence 60% and period value was ≤6, and we only varied the data size.
e results of space allocated to both algorithms are quite interesting in the case of varying dataset, as shown in Figure 9. e settings of the experiment were the same on bike sharing dataset. It is evident that the space requirements of FPPM are quite stable and increase slowly with respect to the input dataset size. However, our proposed approach has a very variable space allocation. It is also worth noting that the space used by the FPPM does not change, at least significantly, during the mining process, and the space used by the FPPM is allocated at the start of the algorithm when the suffix tree is generated. On the other hand, the data shown in Figure 9 contain the maximum amount of space allocated to our proposed algorithm during the mining process. is is because our algorithm dynamically changes the space during the mining process, which usually depends on the number of patterns per iteration. is explains the unstable space used during the mining process of our proposed approach. Based on our observations, the number of new patterns generated is not directly proportional to the new rows of data added to the input dataset.

Discussion
Our discussion revolves around selected related questions. In those questions, we aim to analyze the effects of Apriori approach over flexible periodic pattern generation with varying starting position to identify the factors affecting the generation of invalid or redundant patterns and to understand the relationship between varying dataset length and result's accuracy.

Effects of Apriori Approach over Flexible Periodic Pattern
Generation with Varying Starting Positions. In order to analyze the effects of Apriori approach, we performed experiments on two datasets with varying properties and compared the results with the FPPM performance, which is a tree-based approach for flexible periodic pattern mining. As per our knowledge, no other algorithm is designed to mine flexible periodic patterns with variable starting position while using an Apriori-based approach. We already discussed that it is possible to mine patterns just from the occurrence vectors of the events without using a tree structure to simplify the process. As per the experiments and analysis of the results, we concluded that Apriori approach is better when (i) the available space for mining patterns is not an issue and (2) there are no strict restrictions on the space usage. An Apriori-based approach keeps the occurrence vectors and patterns in the memory, which can fluctuate depending on the data and unique elements in the data.
ere is prominent positive effect of Apriori approach on the time required to mine patterns because it lacks tree traversal process. e existing Apriori-based algorithms, being capable of mining the flexible periodic patterns, were costly in space and time requirements. We overcome the excessive time requirements of Apriori-based approaches by introducing an efficient algorithm to mine the patterns. We achieve this by tweaking our algorithm to take advantage of  Scientific Programming the pattern generation process, which can generate patterns from multiple passes. erefore, our proposed algorithm is able to mine both ab and its inverse patterns in a single pass. e pattern generation process also relies on the occurrence vectors to generate necessary patterns, which reduces the redundant and invalid patterns.

Factors Affecting the Generation of Invalid or Redundant
Patterns. In order to identify the factors affecting the generation of invalid or redundant patterns, we first analyzed the suffix tree behavior of the FPPM and its effect on pattern generation. We achieve this by running the FPPM on varying data size and varying unique values. e reason for focusing on the suffix tree was the way the FPPM mining process works. FPPM mines patterns level by level by visiting each immediate descendent nodes from root node. We used dataset of varying size and number of unique values to change the size of the suffix tree for analyzing its effect on the performance of the algorithm and redundant pattern generation. Varying the data size increases the depth of the suffix tree, whereas large total number of unique elements increases the breadth of the suffix tree. e breadth of the suffix tree has no significant effect on the redundant pattern generation; however, more redundant patterns were generated with the increased length of the data with more depth of the tree. Since FPPM holds the redundant patterns for each branch, the cost of redundant patterns is a lot higher with more depth of the suffix trees. On the other hand, more unique values did not affect the performance of redundant pattern generation because FPPM keeps patterns in memory for short period of time. One of the possible reasons is that the shallow tree allows FPPM to switch to a newer branch and discard the previous nonfrequent patterns.

Varying Dataset Length and Results
Accuracy. It is evident from our experiments that there is a relationship between varying data size and the accuracy of results. e results obtained have accuracy of 33-50% reaching the lower limit on bigger dataset. It proves that the algorithms generate large patterns based on the initially generated patterns. Any mismatched pattern at the beginning leads to an increased reduction of accuracy. After careful observation, it was revealed that the unmatched patterns were produced by both algorithms. Any unmatched pattern at initial phase results in lowering the accuracy at successive phases. However, in very few cases, the patterns generated in the later phases did match. It reveals that in order to improve the accuracy of the proposed algorithm, the patterns generated in the initial phase require more attention. If the initial patterns of both algorithms are similar, then it would increase the accuracy of the mined patterns significantly because both algorithms use the initial patterns to generate the next phase patterns.

Conclusion and Future Directions
We presented an efficient strategy, i.e., HOVA-FPPM, to mine flexible periodic patterns from time series database without using complex data structures. We identified the limitations of tree-based approaches and discovered various factors that cause the redundant or invalid pattern generation during the mining process. We surpassed those issues with the help of hashing-based data structure while minimizing the number of redundant and invalid patterns through manipulation of occurrence vectors. e proposed solution outperformed the baseline algorithm in terms of time needed to mine the same patterns. We empirically justified that Apriori-based approaches are effective for the mining process without excessive pattern generation. For small dataset, our algorithm is space efficient compared with the FPPM. On a larger dataset, the space requirement of our strategy fluctuates due to incremental growth of accumulated data in hash table in contrast to baseline approach. We aim to improve the space complexity of our proposed algorithm on vary large datasets as an extension to this work. e analysis of combining hashing strategy with tree-like structure is another aspect to discover in future.
Data Availability e datasets used in this research could be downloaded freely at UCL Machine Learning Repository (diabetes: https://archive. ics.uci.edu/ml/datasets/diabetes; bike sharing: https://archive. ics.uci.edu/ml/datasets/bike+sharing+dataset). However, the authors are willing to share the used dataset on request.