Maximal Instance Algorithm for Fast Mining of Spatial Co-Location Patterns

: The explosive growth of spatial data and the widespread use of spatial databases emphasize the need for spatial data mining. The subsets of features frequently located together in a geographic space are called spatial co-location patterns. It is difﬁcult to discover co-location patterns because of the huge amount of data brought by the instances of spatial features. A large fraction of the computation time is devoted to generating row instances and candidate co-location patterns. This paper makes three main contributions for mining co-location patterns. First, the deﬁnition of maximal instances is given and a row instance (RI)-tree is constructed to ﬁnd maximal instances from a spatial data set. Second, a fast method for generating all row instances and candidate co-locations is proposed and the feasibility of this method is proved. Third, a maximal instance algorithm with no join operations for mining co-location patterns is proposed. Finally, experimental evaluations using synthetic data sets and a real data set show that maximal instance algorithm is feasible and has better performance.


Introduction
Spatial co-location mining is to mine the positive relationship of different spatial features in spatial data. It is somewhat difficult to find co-location instances since the instances of spatial features are embedded in a continuous space and share neighbor relationships. Association rule mining algorithms cannot be directly applied to co-location pattern mining since there are no pre-defined transactions in spatial data sets [1]. Thus, the following three basic approaches have been proposed for mining co-locations: Huang, et al. first proposed a join-based approach [1,2]. This approach mines co-locations by using the concept of proximity neighborhood and identifies co-location instances by joining table instances, ensuring the correctness and completeness of this approach. Then, the partial-join approach [3] and the join-less approach [4,5] were proposed for fast mining of co-location patterns. The partial-join approach first transactionizes continuous spatial data (builds cliques) to identify the intraX instances of co-location (belonging to a clique) and the interX instances of co-location (belonging between two cliques) and then joins the intraX instances and the interX instances, respectively, to calculate the value of the participation index. This approach mines co-location patterns more efficiently than the joinbased approach since it reduces a large number of join operations. The join-less approach uses the star neighborhood to identify spatial relationships. It is more efficient compared with the join-based approach and the partial-join approach since it generates co-location patterns without join operations.
In recent years, inspired by the transaction-based approach [6] and the transaction-free approach [7] in pattern mining, researchers have proposed many advanced/improved co-location mining approaches. The problem of mining co-location patterns with rare spatial events was first addressed by Huang et al. [8]. The concept of maximal clique has • A maximal instance algorithm for mining co-location patterns is presented. This algorithm can generate row instances and co-locations without join operations, which can make co-location mining more efficient.

•
The concept of maximal instance is introduced and used to generate all row instances of co-locations. • Experiments show that the maximal instance algorithm is feasible and has better performance.

Maximal Instance Algorithm
In Figure 1a, each instance is uniquely identified by T. i, where T is the spatial feature type and i is the unique ID inside each spatial feature type, and the lines between instances represent neighbor relationships. Figure 1b shows the instances of co-location {A, B, C} being generated by instance joins. A maximal instance is a row instance that does not appear as a subset of another row instance. In other words, maximal instances cannot combine with other instances to generate row instances of higher-size co-locations. For example, {A.1, B.2} in Figure 1a is not a maximal instance since it is a subset of the row instance {A.1, B.2, C.1}, which in turn is a maximal instance. A maximal instance must be a maximal clique (a maximal clique is defined as a clique that does not appear as a subset of another clique in the same co-location pattern), but a maximal clique may not be a maximal instance since maximal cliques may not be row instances. Assuming A.i, B.i, and B.j (A.i is an instance of A, and B.i and B.j are instances of B) form a clique, i.e., they are neighbors to each other, {A.i, B.i, B.j} is a maximal clique rather than a maximal instance as it is not a row instance. However, {A.1, B.2, C.1} is a maximal instance and also a maximal clique. rather than a maximal instance as it is not a row instance. However, . 1, . 2, . 1 is a maximal instance and also a maximal clique.

Generation of Row Instances
The generation of row instances is the basic part of co-location mining because only when all row instances are found can the participation index of co-locations be calculated. How to find row instances of co-locations is discussed here.
In the process of generating row instances of all co-locations, there are some differences between our algorithm and previous algorithms. The generation of row instances in the join-based algorithm, based on a join operation, can be represented by formula (1), and the detailed instance join process for the example data set (in Figure 1a) is shown in Figure 1b. The k-size row instances are generated from k-1-size row instances, i.e., high-size row instances are generated by the join operation between low-size row instances. For example, the 2-row instance . 1, . 2 and . 1, . 1 can be joined to generate a 3-row instance . 1, . 2, . 1 . This method for mining co-location is time consuming due to the large number of join operations required as the number of features and their instances increases.
Here, is a set of spatial event types (i.e., ) and is a set of row instances of i-size co-locations. In a join-based algorithm, the set of all row instances is a merge of , , ⋯, and , i.e., ∑ . Every time the size of co-locations is increased, a join operation needs to be performed, resulting in k-1 being the number of times join operations are needed to generate a k-size row instance. The larger the k, the more the number of join operations needed and the more the execution time consumed. Therefore, the method (called the join-based method in this paper) of generating row instances by join operations is inefficient.
By reviewing the generation of row instances in the join-based algorithm, the relationship between a high-size row instance H generated from L and a low-size row instance L is obvious: L is a subset of H since H must contain the instances in L. In addition, if a high-size row instance exists, it must also exist for its corresponding low-size row instances. The corresponding low-size row instances are actually subsets of the high-size row instances. So, Lemma 1 can be obtained. According to Lemma 1, instead of using low-size row instances to generate high-size row instances, as in traditional algorithms, this paper thinks backward: using high-size row instances to generate low-size row instances.

Generation of Row Instances
The generation of row instances is the basic part of co-location mining because only when all row instances are found can the participation index of co-locations be calculated. How to find row instances of co-locations is discussed here.
In the process of generating row instances of all co-locations, there are some differences between our algorithm and previous algorithms. The generation of row instances in the join-based algorithm, based on a join operation, can be represented by formula (1), and the detailed instance join process for the example data set (in Figure 1a) is shown in Figure 1b. The k-size row instances are generated from k-1-size row instances, i.e., high-size row instances are generated by the join operation between low-size row instances. For example, the 2-row instance {A.1, B.2} and {A.1, C.1} can be joined to generate a 3-row instance {A.1, B.2, C.1 }. This method for mining co-location is time consuming due to the large number of join operations required as the number of features and their instances increases.
Here, E is a set of spatial event types (i.e., RI 1 ) and RI i is a set of row instances of i-size co-locations. In a join-based algorithm, the set of all row instances RI is a merge of RI 1 , RI 2 , · · · , and RI k , i.e., RI = ∑ k i=1 RI i . Every time the size of co-locations is increased, a join operation needs to be performed, resulting in k-1 being the number of times join operations are needed to generate a k-size row instance. The larger the k, the more the number of join operations needed and the more the execution time consumed. Therefore, the method (called the join-based method in this paper) of generating row instances by join operations is inefficient.
By reviewing the generation of row instances in the join-based algorithm, the relationship between a high-size row instance H generated from L and a low-size row instance L is obvious: L is a subset of H since H must contain the instances in L. In addition, if a high-size row instance exists, it must also exist for its corresponding low-size row instances. The corresponding low-size row instances are actually subsets of the high-size row instances. So, Lemma 1 can be obtained. According to Lemma 1, instead of using low-size row instances to generate high-size row instances, as in traditional algorithms, this paper thinks backward: using high-size row instances to generate low-size row instances. Lemma 1. An arbitrary non-empty subset of a k-size row instance must be a row instance of co-location.
Proof of Lemma 1. This lemma is proved from the definition and generation process of row instances. (1) By definition, a row instance is essentially an R-proximity neighborhood, and the definition of R-proximity neighborhoods is given by Huang as follows: an Rproximity neighborhood is a set I ⊂ S of instances that form a clique under the relation R. Accordingly, a set I is a row instance if any two instances in I satisfy the neighborhood relation. (2) Huang et al. gave a detailed introduction to the generation of row instances [1]. Similar to the generation of candidate co-locations, row instances are generated by a join strategy. An example in Figure 1 4. Thus, any two instances in a row instance satisfy the neighbor relationship. Let I k be a set of instances in a k-size row instance. Because k-size row instances are generated from k-1-size row instances, a conclusion is drawn: I k−1 is a proper subset of I k (shown as the formula I k−1 ⊆ I k ). Therefore, it can be inferred that I 1 ⊆ I 2 ⊆ · · · ⊆ I k . So, any set I n is a proper subset of I k (1 ≤ n < k), i.e., I n ⊆ I k . If row instances are treated as sets, the following conclusion can be drawn: RI n ⊆ RI k . Here, RI k is a set of k-size row instances and 1 ≤ n < k. In summary, an arbitrary non-empty subset of a k-size row instance must be a row instance of co-locations.
Accordingly, (1) a maximal instance is the maximal row instance for a co-location and it cannot join with another instance to generate a high-size row instance and (2) a further conclusion can be drawn from Lemma 1 that non-empty subsets of maximal instances are all row instances of co-locations. Once all maximal instances are found, all row instances can be generated by finding non-empty subsets of them. This method (shown in formula (2), M = {m 1 , m 2 , · · · , m k } is a set of maximal instances) for generating row instances does not require join operations, which can reduce a lot of computing time. The set of all row instances RI is a merge of non-empty subsets of maximal instances. Empty sets are not considered here since it is meaningless.
A simple comparison is made to illustrate that this method is more efficient than the join-based method for generating row instances. The join-based method generates row instances by join operations. First, 2-size row instances are generated by joining spatial instances that have a neighbor relationship. Then high-size row instances are generated size by size until no higher-size row instances are generated. k-1 is the number of join operations required to generate all row instances, which is time consuming. Our method is to first generate the highest-size row instances (maximal instances) and then generate all row instances by finding non-empty subsets of the highest-size row instances, which requires no join operations and finding subsets only once. One obvious difference between the two methods is that the join-based method generates row instances from low sizes to high sizes and our method generates row instances from the highest size to low sizes. A large number of join operations are not needed in our method, which makes our method less time consuming.
Let k be the number of maximal instances, m i represent a maximal instance (1 ≤ i ≤ k), NS(m i ) represent the set of non-empty subsets of m i , B(m i ) be the power set of m i , |m i | be the number of instances in m i , and |RI| be the number of row instances. The two lemmas can be derived: The proofs are as follows. It should be noted that the universal set here is the set of spatial instances I.
Proof of Lemma 3. For an n-set, the total number of subsets is C 0 Table 1 Table 1 are non-empty subsets of maximal instances, and the number of row instances |RI| can be calculated by Lemma 3.

RI-Tree Construction
As described in Section 2.1, maximal instances are used to generate the row instances of co-locations. The RI-tree for finding maximal instances is introduced in this section.
A maximal instance m should satisfy the following two conditions: (1) m is a row instance of a co-location and (2) m cannot join with other instances to generate a high-size row instance.
An RI-tree is a kind of rooted tree. The root of the RI-tree is labeled as F (F is a set of all spatial instances). A branch of the RI-tree is constructed as a corresponding connective sub-graph in the graph G. The node in the RI-tree represents the row instance of co-location patterns. The node u is the parent of the node v, and when v is a row instance of size k co-locations, u is one of the row instances of size k-1 co-locations. An RI-tree is constructed to generate maximal instances, which is the key of co-location mining. As shown in Figure 2, a set of spatial instances with their spatial relationships (i.e., Euclidean distance) is input, and an algorithm implemented in Python outputs all maximal instances. In this process, neighbor relationships between instances of the same spatial feature type are not taken into consideration since our goal is to find the positive relationship between different spatial feature types.

section.
A maximal instance m should satisfy the following two conditions: (1) m is a row instance of a co-location and (2) m cannot join with other instances to generate a high-size row instance.
An RI-tree is a kind of rooted tree. The root of the RI-tree is labeled as F (F is a set of all spatial instances). A branch of the RI-tree is constructed as a corresponding connective sub-graph in the graph G. The node in the RI-tree represents the row instance of co-location patterns. The node u is the parent of the node v, and when v is a row instance of size k co-locations, u is one of the row instances of size k-1 co-locations. An RI-tree is constructed to generate maximal instances, which is the key of co-location mining. As shown in Figure 2, a set of spatial instances with their spatial relationships (i.e., Euclidean distance) is input, and an algorithm implemented in Python outputs all maximal instances. In this process, neighbor relationships between instances of the same spatial feature type are not taken into consideration since our goal is to find the positive relationship between different spatial feature types. Based on the definitions of RI-tree and maximal instance, there is the process of constructing an RI-tree.

Process of constructing an RI-tree:
(1) Create the root of the RI-tree and label it as F. Based on the definitions of RI-tree and maximal instance, there is the process of constructing an RI-tree.
Process of constructing an RI-tree: (1) Create the root of the RI-tree and label it as F.
(2) Push all spatial instances into a set F in alphabetic and numerical descending order.
(3) Pop an instance from RI 1 and delete it in RI 1 . Then create a child node of the root F for this instance. (4) Find out the instances that are neighbors of this instance, have different spatial features from this instance, and are bigger than this instance. a.
If so, push them into a set T in alphabetic descending order and create a child node for them.
(5) Find out the instances that are neighbors of the last instance in T and delete them in RI 1 . If so and if they also have a neighborhood relationship with the rest of the instances in T, put them at the end of T and create a child node for them. Return to (5). c.
If so but if they are not all neighbors with other instances in T, push T in M, create another child node of the root for the last instance in T, and generate a new T by combining it with the last instance in T. Return to (5).
(6) Repeat the operation above till RI 1 is empty. Figure 3 shows the process of constructing an RI-tree for the example data set in Figure 1a. (4) Find out the instances that are neighbors of this instance, have different spatial features from this instance, and are bigger than this instance. a. If not, return to (3). b. If so, push them into a set T in alphabetic descending order and create a child node for them. (5) Find out the instances that are neighbors of the last instance in T and delete them in . a. If not, push T in M; return to (3). b. If so and if they also have a neighborhood relationship with the rest of the instances in T, put them at the end of T and create a child node for them. Return to (5). c. If so but if they are not all neighbors with other instances in T, push T in M, create another child node of the root for the last instance in T, and generate a new T by combining it with the last instance in T. Return to (5). (6) Repeat the operation above till is empty. Figure 3 shows the process of constructing an RI-tree for the example data set in Figure 1a. The leaf nodes of this RI-tree, such as . 1, .  Before building an RI-tree, all spatial instances are put into the set F. The instance will be deleted from F if a child node of the root is created for it or if it has a neighbor relationship with the child node of the root. For example, a child node of the root is created for . 5, so . 5 will be deleted from F; . 2 and . 1 are deleted from F since they have neighbor relationships with . 5 ( . 5 is a child node of the root).
2. Each node is a row instance of the co-location, and note that not all row instances are listed in the RI-tree but all neighbor relationships are contained in the RI-tree. The Before building an RI-tree, all spatial instances are put into the set F. The instance will be deleted from F if a child node of the root is created for it or if it has a neighbor relationship with the child node of the root. For example, a child node of the root is created for A.5, so A.5 will be deleted from F; B.2 and C.1 are deleted from F since they have neighbor relationships with A.5 (A.5 is a child node of the root).

2.
Each node is a row instance of the co-location, and note that not all row instances are listed in the RI-tree but all neighbor relationships are contained in the RI-tree. The number of row instances is very large if there are a lot of instances in the spatial data. The aim of an RI-tree is to generate the maximal instance; there is no need to list all row instances in an RI-tree. A node in an RI-tree contains neighbor relationships between all instances in the node. 3.
The nodes of the n-th layer of an RI-tree are n-1-size row instances. The spatial instances in F are selected as the child node of the root, i.e., nodes in the second layer of the RI-tree. From layer 3 to layer n, there are size 2 row instances, size 3 row instances, · · · , and n-1-size row instances. The highest size of the row instance of the example data in Figure 1 is 3 since the RI-tree constructed for this example data has only four layers.

4.
After creating a child node of the root, scan its neighbor relationships. The neighbor relationships are identified by the Euclidean distance metric. Two instances have a neighbor relationship if their Euclidean distance is less than the user-defined minimum distance threshold [1]. If this node has a neighbor relationship with another instance, a child node of this node will be created under this branch for these two instances; if there is no common neighbor of instances in this node, another instance will be popped from F and a child node of the root will be created for it. For example, instance B.2 is a child node of the root and the node "B.2, A.5" is created under this branch since B.2 has a neighbor relationship with A.5. There is no common neighbor of B.2 and A.5, but A.5 still has relationship with B.6, so a new child node of the root is created for A.5, and the node A.5 has "A.5, B.6" as a child node. 5.
The RI-tree is built from left to right. When a leaf node appears in one branch of the RI-tree, another branch can be established. A node is a leaf node if there is no common neighbor of instances in this node, which means the end of the branch where this node is located. 6.
The leaf nodes of an RI-tree are maximal instances because a leaf node is a row instance in which all instances are neighbors and no other instance can join with it to generate a high-size row instance. It is obvious that the leaf node meets the conditions of maximal instance. The number of maximal instances equals the number of branches of the RI-tree.

Completeness of the RI-Tree
None of the neighbor relationships is omitted in the process of finding maximal instances. All the spatial instances are scanned, and all neighbor relationships between instances of different spatial types are considered in the process of constructing an RI-tree. Although not all neighbor relationships are shown in the RI-tree, they are considered when creating nodes. For example, the node "A.1, B. The neighbor relationships are also not duplicated. Once all neighbor relationships of an instance are identified, this instance will be deleted in F.

Generation of Co-Locations
Candidate co-location generation: The basic algorithms rely on a combinatorial approach and use apriori_gen [25] to generate size k+1 candidate co-locations from size-kprevalent co-locations. However, this paper generates candidate co-locations from maximal instances, which does not require any join operations. C = {e 1 , e 2 , · · · , e k } is a candidate co-location if m = {i 1 , i 2 , · · · , i k } is a maximal instance, i n is an instance of spatial event types e n , and 1 ≤ n ≤ k. For example, {A.1, B.2, C.1} is a maximal instance, so T = {A, B, C} is a candidate co-location. Candidate co-locations are also generated from candidate co-locations that are not prevalent. Candidate co-locations generated from maximal instances are not all prevalent. Candidate co-locations that fail to be a prevalent pattern are selected, and their subsets are corresponding low-size candidate co-locations. That is because of the anti-monotonicity of the participation index. If pi(C) < min_prev (C is a candidate co-location, and pi(C) is the participation index of C), there must exist pi(c) ≥ pi(C) (c is a subset of C) and c may be a prevalent co-location, so c is a candidate co-location. Taking Pruning: To make our algorithm more efficient, this step introduces the pruning strategies that can greatly reduce the unnecessary calculation time. Prevalence-based pruning [1] is also used in our algorithm. The refinement filtering of co-locations is done by the participation index values calculated from their co-location instances. Prevalent co-locations satisfying a given threshold are selected. Actually, there is no need to calculate the participation index of each candidate co-location. Because the participation ratio and the participation index are antimonotone (monotonically nonincreasing) as the size of the co-location increases [1]), if a high-size candidate co-location is prevalent, subsets of this candidate co-location are all prevalent. Therefore, participation indexes of high-size candidate co-locations (generated by maximal instances) are prioritized. If the participation index values are above a given threshold, there is no need to calculate the participation indexes of subsets of a high-size candidate co-location; if the participation index values are below a given threshold, the participation indexes of the subsets of high-size candidate co-locations need to be calculated.
The second pruning strategy can be explained by Lemma 4.

Lemma 4.
Subsets of a candidate co-location are prevalent if it is a prevalent co-location.
Proof of Lemma 4. This lemma is proved by the antimonotone property of the participation index. C is a candidate co-location; C is a subset of C; and k and n (k > n) are the number of instances in C and the number of instances in C , respectively. From the above formula, it can be concluded that the participation index of a candidate co-location is less than or equal to that of its subset. If pi(C) < min_prev, then pi(C ) < min_prev must be established, so the following conclusion can be drawn: subsets of a candidate co-location are prevalent if it is a prevalent co-location.
Quite a lot of maximal instances are generated in the process of mining co-locations from the real data set introduced in

Discussions for Maximal Instance Algorithm
The idea of the presented algorithm is different from the existing algorithms. The differences are as follows:

•
The existing methods identify high-size row instances from low-size row instances, but the presented algorithm first identifies the highest-size row instances (maximal instances) based on the relationship of spatial instances and then generates all low-size row instances from highest-size row instances. • The existing methods generate candidate patterns by joining row instances, but the presented algorithm generates candidate patterns from maximal instances without join operations.

Comparison Analysis of Row Instance Generation
The reason why our method for generating all row instances is more efficient than the join-based algorithm is demonstrated in detail here. Let T gen_row instance and T gen_row instance be the computation cost of generating all row instances by the join-based algorithm and our method. The following equations show the computation cost functions: T gen_row instance = T gen_m + T gen_instance (4) T join represents the computation cost of a join operation, T gen_m represents the computation cost of generating all maximal instances, and T gen_instance represents the computation cost of finding the subsets of maximal instances. T gen_m ≈ T scan(neighobr relationship) because generating maximal instances is also a scanning process of neighbor relationship and T gen_instance (k − 1) × T join . Therefore, Apparently, T gen_row instance > T gen_row instance . So the conclusion can be drawn that our method of generating all row instances is more efficient than the join-based algorithm.

Comparison Analysis of Maximal Instance Algorithm
The computational cost of our algorithm with three basic algorithms is compared here. Each algorithm has an initial step of materializing neighborhoods. The join-based algorithm first gathers the neighbor pairs per candidate co-location, the partial-join algorithm first generates the disjoint clique neighborhoods using a simple grid partitioning, the join-less algorithm first generates the star neighborhoods, and our algorithm first generates maximal instances. S represents a spatial data set; T neighbor_pairs (S), T clique_neighborhoods&cut_relations (S), T star_neighborhoods (S), and T gen_m (S) represent the computational costs of the initial steps in each algorithm; and T jb (2), T pj (2), and T jl (2) represent the cost of generating size 2 colocations in the join-less algorithm, the partial-join algorithm, and the join-based algorithm, respectively. Let T, T jl , T pj , and T jb be the total computation cost of our algorithm, the join-less algorithm, the partial-join algorithm, and the join-based algorithm, respectively. The following equations show the total cost functions: Here, k is greater than 2. Yoo and Shekhar [5] proposed the following comparative relationships: (2) because (1) the join-less algorithm involves an additional cost to generate the star neighborhoods from the neighbor pairs compared with join-based algorithm and (2) an additional cost is incurred when finding all size 2 inter-instances with cut relationships in the partialjoin algorithm, the overall cost is expected to be a little greater than the cost to generate the star neighborhood set.

Lemma 5. T star_neighborhoods (S) > T gen_m (S).
Proof of Lemma 5. The star neighborhood partition model in the join-less algorithm takes each spatial object as a central object and finds out the remaining objects in its neighborhood. Thus, this process is performed n times, where n is the number of spatial objects. The process of generating all maximal instances needs to be executed |C m | times, where |C m | is the number of maximal instances. Apparently, n > |C m |, so the star neighborhood partition model in the join-less method is more time consuming than the process of generating the maximal instance in our method.

Lemma 6. T gen_m (S) > T neighbor_pairs (S) + T jb (2).
Proof of Lemma 6. Gathering the neighbor pairs per candidate co-location is the most basic operation in co-location mining. The neighbor pairs are used to generate maximal instances, and it involves additional cost compared with gathering the neighbor pairs per candidate co-location and calculating their prevalence measures.
According to Lemma 5 and Lemma 6, the following equation can be reached: The advantage of the maximal instance algorithm lies in the latter part. Three basic algorithms generate bigger-size co-locations size by size after generating size 2 co-locations. This operation needs to be repeated k-2 times to generate all co-locations. No operation can be omitted, and a cross-size operation is not allowed (size k co-locations cannot be directly generated from size k-2 co-locations; size k co-locations are generated from size k-1 co-locations after generating size k-1 co-locations from size k-2 co-locations). Therefore, the execution time of each join operation should be added to the total computational costs of the three basic algorithms.
However, once the maximal instance algorithm generates maximal instances, row instances of all size co-locations can be generated from the subsets of maximal instances. There is no need for a join operation. A large amount of time consumption is avoided in this part; the bigger the size of the co-locations, the more obvious the effect, and thus the following equations: T gen_instance On the basis of Equations (5)-(8), we can say that our algorithm has a lower computational cost than the three basic algorithms.

Overview of the Maximal Instance Algorithm
This section introduces the steps in the maximal instance algorithm. As shown in Figure 4, this algorithm has four steps in the flow chart. The participation index is still used as the prevalence measure to determine whether a co-location pattern is prevalent. As shown in Figure 5, the maximal instance algorithm takes a set E of spatial event types, a set I of instances, a distance threshold min_d, and a minimal prevalent threshold min_prev. The algorithm outputs a correct set of co-location patterns with participation index > min_prev. The set C 1 of candidate size 1 co-locations and the set P 1 of prevalent size 1 co-locations are initialized to E, since the value of the participate index is 1 for all size 1 co-locations. The set RI 1 of row instances of size 1 co-locations is initialized to I. Remote Sens. 2021, 13, x FOR PEER REVIEW 13 of 21 Step 3 (candidate co-location generation): , , ⋯ , is a candidate co-location if , , ⋯ , is a maximal instance, is an instance of spatial event types , and 1 . For example, . 1, . 2, . 1 is a maximal instance, so , , is a candidate co-location, and a candidate co-location is also generated from candidate co-locations that are not prevalent.
Step 4 (pruning): There are two pruning strategies in the maximal instance algorithm: (1) prevalence-based pruning is also used in our algorithm, and (2) participation indexes of high-size candidate co-locations (generated by maximal instances) are prioritized. If the participation index values are above a given threshold, there is no need to calculate the participation indexes of subsets of the high-size candidate co-location; if the participation index values are below a given threshold, the participation indexes of subsets of high-size candidate co-locations need to be calculated.

Experiments
In this section, experiments are carried with synthetic data sets and a real data set to evaluate our algorithm.

Synthetic Data Set
The synthetic data sets are generated in Python, as shown in Figure 6. There are 60 different spatial event types in a synthetic data set. The number of instances of each spatial feature stored in the set Value is a random number between 5 and 10. E is a set of all spatial event types, and I is a set of instances. Each instance is a point distributed in a spatial framework (150 100), and these point data have their own unique coordinates. The neighbor relationships of the synthetic data sets are generated by calculating the Euclidean distance of those points and stored in the set R. Figure 6. Generation process of a synthetic data set. Step 1 (maximal instance generation): Our algorithm aims to find the maximal instances first, which is the key to co-location mining. A set of spatial instances with their spatial relationships (i.e., Euclidean distance) is input, each instance is a vector instance − id, location, spatial feature type , and an algorithm implemented in Python outputs all maximal instances. In this process, the neighbor relationships between instances of the same spatial feature type are not taken into consideration since our goal is to find the positive relationship between different spatial feature types.
Step 2 (row instance generation): Row instances of co-locations are generated by finding subsets of maximal instances instead of join operations between row instances.
Step 3 (candidate co-location generation): C = {e 1 , e 2 , · · · , e k } is a candidate colocation if m = {i 1 , i 2 , · · · , i k } is a maximal instance, i n is an instance of spatial event types e n , and 1 ≤ n ≤ k. For example, {A.1, B.2, C.1} is a maximal instance, so T = {A, B, C} is a candidate co-location, and a candidate co-location is also generated from candidate co-locations that are not prevalent.
Step 4 (pruning): There are two pruning strategies in the maximal instance algorithm: (1) prevalence-based pruning is also used in our algorithm, and (2) participation indexes of high-size candidate co-locations (generated by maximal instances) are prioritized. If the participation index values are above a given threshold, there is no need to calculate the participation indexes of subsets of the high-size candidate co-location; if the participation index values are below a given threshold, the participation indexes of subsets of high-size candidate co-locations need to be calculated.

Experiments
In this section, experiments are carried with synthetic data sets and a real data set to evaluate our algorithm.

Synthetic Data Set
The synthetic data sets are generated in Python, as shown in Figure 6. There are 60 different spatial event types in a synthetic data set. The number of instances of each spatial feature stored in the set Value is a random number between 5 and 10. E is a set of all spatial event types, and I is a set of instances. Each instance is a point distributed in a spatial framework D 1 × D 2 (150 × 100), and these point data have their own unique coordinates. The neighbor relationships of the synthetic data sets are generated by calculating the Euclidean distance of those points and stored in the set R.

Experiments
In this section, experiments are carried with synthetic data sets and a real data set to evaluate our algorithm.

Synthetic Data Set
The synthetic data sets are generated in Python, as shown in Figure 6. There are 60 different spatial event types in a synthetic data set. The number of instances of each spatial feature stored in the set Value is a random number between 5 and 10. E is a set of all spatial event types, and I is a set of instances. Each instance is a point distributed in a spatial framework (150 100), and these point data have their own unique coordinates. The neighbor relationships of the synthetic data sets are generated by calculating the Euclidean distance of those points and stored in the set R. Figure 6. Generation process of a synthetic data set. Figure 6. Generation process of a synthetic data set.

Real Data Set
The real data set is about college and university locations, hospital locations, library locations, nursing home locations from Maine E911 address data from MainePUC, and point locations of the mineral collecting sites in Maine [26]. Each event in this data set with a different spatial feature types has a unique event ID. Contained in each event is county, town, latitude, longitude, and other information. Location information with only latitude and longitude is considered in this experiment. The event numbers of spatial feature types are shown in Table 2.

Experiment Results
A summary of our experiment result is presented here. A real data set of college and university locations, hospital locations, library locations, nursing home locations from Maine E911 address data from MainePUC, and point locations of the mineral collecting sites in Maine is studied in this paper. The longitude and latitude of each facility are used as coordinates to calculate the Euclidean distance. The effects of min_d on the number of neighbor relationships, participation ratio, and participation index are evaluated. Table 2 shows the number of events for each spatial feature type in the real data set. Table 3 shows the participation indexes of co-location patterns. When min_d is set to 0.4 and min_prev is set to 0. Medical Center and Northern Light Mercy Hospital. The co-location {U, L} means libraries are frequently located together in a geographic space with colleges and universities. This is mainly because some libraries are located inside universities and colleges. For example, the largest library in Maine, the Fogler Library, is located in the University of Maine.

The result quality comparison
Firstly, the quality of the generated maximal instance is tested in terms of the total number of maximal instances, the number of maximal instances per size, and the number of maximal instances with errors and repetitions. The quality result of the maximal instances is shown in the Table 4. There are 1342 maximal instances in total. After removing the repetition, the number of size 2, size 3, size 4, and size 5 maximal instances is 1268, 17, 5, and 3, respectively. These 1342 maximal instances are not all correct. Among them, seven maximal instances with a size greater than 5 are errors. The maximum size of maximal instances is 5 since there are only five feature types in the real data set. Moreover, there are 42 repeated maximal instances in the size 2 maximal instances, but this phenomenon does not appear in the other higher-size maximal instances. It can be seen that the quality of the generated maximal instances is relatively good. These maximal instances of errors and repetitions have little effect on the experimental results.  Figure 7 shows a comparison of row instances generated by the join-based algorithm a and the maximal instance algorithm. Row instance is the basis of co-location participation index. Only when the number of row instances is clear can the participation index of co-locations be calculated and whether co-locations are frequent be judged. Therefore, this paper used the join-based algorithm and the maximal instance algorithm to generate all the row instances, recorded the number of row instances in each size, and made a comparison. The results show that the number of size 3, size 4, and size 5 row instances generated by the two algorithms is the same and only the number of size 2 row instances is slightly different. The maximal instance algorithm generates 42 more size 2 row instances than the join-based algorithm, which is because the maximal instance algorithm generates 42 repeated maximal instances in the size 2 maximal instances. The impact of these 42 row instances on participation is very small. all the row instances, recorded the number of row instances in each size, and made a comparison. The results show that the number of size 3, size 4, and size 5 row instances generated by the two algorithms is the same and only the number of size 2 row instances is slightly different. The maximal instance algorithm generates 42 more size 2 row instances than the join-based algorithm, which is because the maximal instance algorithm generates 42 repeated maximal instances in the size 2 maximal instances. The impact of these 42 row instances on participation is very small.  On comparing the results, it is clear that the maximal instance algorithm only has a slight difference in the size 2 instance, which will not have a great impact on the quality of the generated co-locations.

Effect of min_d on the number of neighbor relationships
The effects of min_d on the number of neighbor relationships are evaluated. The value of min_d is changed while the other experimental parameters remain unchanged. The number of neighbor relationships between any two spatial feature types is checked successively. The result is shown in Figure 8. In general, the number of neighbor relationships between any two types increases with an increase in the value of min_d. With the increase in min_d, the numbers of neighbor relationships of {U, H} and {U, L} are far more than that of other patterns. Because of the large number of events of type U, H, and L, the numbers of neighbor relationships of {U, H} and {U, L} increase sharply to more than 7000 when min_d increases to 0.9. On comparing the results, it is clear that the maximal instance algorithm only has a slight difference in the size 2 instance, which will not have a great impact on the quality of the generated co-locations.

Effect of _ on the number of neighbor relationships
The effects of _ on the number of neighbor relationships are evaluated. The value of _ is changed while the other experimental parameters remain unchanged.
The number of neighbor relationships between any two spatial feature types is checked successively. The result is shown in Figure 8. In general, the number of neighbor relationships between any two types increases with an increase in the value of _ . With the increase in _ , the numbers of neighbor relationships of , and , are far more than that of other patterns. Because of the large number of events of type U, H, and L, the numbers of neighbor relationships of , and , increase sharply to more than 7000 when _ increases to 0.9.

Effect of _ on participation ratio and participation index
The effects of _ on participation ratio and participation index are evaluated. The value of the parameter _ is changed to observe the values of the participation ratio and the participation index of co-locations. Figure 9 shows the change in the participation ratio of co-locations , , , , , , , , , , , , , , , and , , . It is obvious that the values of the participation ratio increase with an increase in _ . The changes in the participation indexes of different co-locations are shown in Figure 10a,b. The following observations can be made: (1) , , (the value of the participation index of , , ) is always smaller than

Effect of min_d on participation ratio and participation index
The effects of min_d on participation ratio and participation index are evaluated. The value of the parameter min_d is changed to observe the values of the participation ratio and the participation index of co-locations. Figure 9 shows the change in the participa-  (e) (f)  This is because the participation ratio and the participation index are antimonotone (monotonically nonincreasing) as the size of the co-location increases [1] and it shows that our results are correct. (2) The combination of the minimum values of the three curves in Figure 9a is the curve of pi({U, H, L}) in Figure 10a, since the pi(C) of a co-location C = {e 1 , · · · , e k } is defined as min k i=1 {pr(C, e i )}.

Experimental Evaluation
The synthetic data sets are used to check whether our algorithm has better performance. Two comparative experiments on running time were done to evaluate the performance of the maximal instance algorithm. As shown in Figure 11, the running time of generating row instances is compared when min_d changes. The time to generate maximal instances is used to indicate the time to generate row instances of the maximal instance algorithm, because once maximal instances are found, row instances are found. The result shows that the running time increases with an increase in min_d and the maximal instance algorithm consumes less time. Figure 12 shows the effect of the number of spatial instances on the running time, and no matter how the number of spatial instances changes, the maximal instance algorithm still consumes less time. Obviously, the maximal instance algorithm has better performance in the process of generating prevalent co-locations since there is no need for join operations in the maximal instance algorithm. Therefore, it can be concluded that the maximal instance algorithm is more efficient than the three basic algorithms.

Experimental Evaluation
The synthetic data sets are used to check whether our algorithm has better performance. Two comparative experiments on running time were done to evaluate the performance of the maximal instance algorithm. As shown in Figure 11, the running time of generating row instances is compared when _ changes. The time to generate maximal instances is used to indicate the time to generate row instances of the maximal instance algorithm, because once maximal instances are found, row instances are found. The result shows that the running time increases with an increase in _ and the maximal instance algorithm consumes less time. Figure 12 shows the effect of the number of spatial instances on the running time, and no matter how the number of spatial instances changes, the maximal instance algorithm still consumes less time. Obviously, the maximal instance algorithm has better performance in the process of generating prevalent co-locations since there is no need for join operations in the maximal instance algorithm. Therefore, it can be concluded that the maximal instance algorithm is more efficient than the three basic algorithms. Figure 11. The effect of _ on the running time. Figure 11. The effect of min_d on the running time.

Conclusions and Future Work
This paper proposes a new concept of maximal instances that is fundamental to our work and proves that generating row instances by maximal instances can make sense. A comparison with generating row instances by join operations proves that generating row instances by maximal instances is more efficient. An RI-tree is constructed to find maximal instances from a spatial data set. The proposed algorithm, the maximal instance algorithm, is based on maximal instances to mine co-location patterns. Since join operations are needed in this algorithm, it can reduce a lot of computing time. A detailed comparison with the three basic algorithms (join-based algorithm, partial-join algorithm, join-less algorithm) shows the advantage of our algorithm in terms of time consumption.
Synthetic data sets and a real data set are used to examine the effect of our algorithm. The real data set is about college and university locations, hospital locations, library locations, nursing home locations from Maine E911 address data from MainePUC, and point locations of the mineral collecting sites in Maine. This data set has five spatial feature types: college and university, hospital, library, nursing home, and mineral collecting site Many application domains include spatio-temporal features. Scientists in these domains are interested in understanding the evolution of the co-location patterns among stationary features as well as co-location patterns over moving feature types. In future work, it will be interesting to explore methods to answer temporal questions such as how a co-location changes over time as well as methods to identify moving object co-location patterns.