knn_label_count#
- knn_label_count(domain, label_name=None, objects_as_nodes=None, source_objects=None, include_boundaries=None, exclude_boundaries=None, boundary_exclude_distance=0, neighbourhood_size_KNN=10, max_distance=inf, min_distance=0, include_source_point=True)#
Counts the number of each label within proximity of a source object using KNN networks. To be merged into a more general neighbourhood label count function.
- Parameters:
- domainmuspan domain
The domain containing the objects and labels.
- label_namestr, optional
The name of the label to count, by default None.
- source_objectsarray-like, optional
Indices of the source objects, by default None.
- network_namestr, optional
The name of the network to use, by default None.
- neighbourhood_size_KNNint, optional
The number of nearest neighbors to consider, by default 10.
- max_distancefloat, optional
The maximum distance to consider for neighbors, by default np.inf.
- min_distancefloat, optional
The minimum distance to consider for neighbors, by default 0.
- include_source_pointbool, optional
Whether to include the source point in the count, by default True.
- Returns:
- ordered_labelslist
The ordered list of label categories.
- count_dictdict
A dictionary where keys are object IDs and values are dictionaries with counts and neighbor objects.
Notes
To be merged into a more general neighbourhood label count function in V1.1.