SpatialQuery.spatial_query_multi.find_fp_knn
- spatial_query_multi.find_fp_knn(ct, dataset=None, k=30, min_support=0.5, max_dist=20)[source]
Find frequent patterns within the KNNs of certain cell type in multiple fields of view.
- Parameters:
ct (str) – Cell type name.
dataset (str or List[str], optional) – Datasets for searching for frequent patterns. Use all datasets if dataset=None.
k (int, default=30) – Number of nearest neighbors.
min_support (float, default=0.5) – Threshold of frequency to consider a pattern as a frequent pattern.
max_dist (float, default=20) – The maximum distance at which points are considered neighbors.
- Returns:
- DataFrame with frequent pattern results. Columns include:
support: frequency of the pattern (proportion of transactions with this pattern)
itemsets: list of cell types in the frequent pattern
- Return type:
pd.DataFrame