This function finds noise from the clustering results and label it with
-1
.
Arguments
- global_membership
Integer. A vector of membership labels.
- timeID
Integer. A vector of time indexes.
- minPts
Numeric (>0). Minimum number of hot spots in a cluster.
- minTime
Numeric (>=0). Minimum length of time of a cluster. Unit is time index.
Details
For more details about the clustering algorithm and the arguments
minPts
and minTime
, please check the documentation
of hotspot_cluster()
.
This function performs the step 4 of the clustering algorithm. It uses a
given threshold (minimum number of points and minimum length of time) to
find noise and label it with -1
.
Examples
# Define membership labels and timeID for 10 observations
global_membership <- c(1,1,1,2,2,2,2,2,2,3,3,3,3,3,3)
timeID <- c(1,2,3,2,3,3,4,5,6,3,3,3,3,3,3)
# Handle noise with different values of minPts and minTime
handle_noise(global_membership, timeID, 4, 0)
#>
#> ── minPts = 4 hot spots | minTime = 0 time indexes
#> ✔ Handle noise
#> ℹ 2 clusters left
#> ℹ noise proportion : 20 %
#> [1] -1 -1 -1 1 1 1 1 1 1 2 2 2 2 2 2
handle_noise(global_membership, timeID, 4, 1)
#>
#> ── minPts = 4 hot spots | minTime = 1 time index
#> ✔ Handle noise
#> ℹ 1 cluster left
#> ℹ noise proportion : 60 %
#> [1] -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1
handle_noise(global_membership, timeID, 3, 3)
#>
#> ── minPts = 3 hot spots | minTime = 3 time indexes
#> ✔ Handle noise
#> ℹ 1 cluster left
#> ℹ noise proportion : 60 %
#> [1] -1 -1 -1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1