clustering#

clustering(array, threshold, num)[source]#

Detect and form 1D-cluster on an array. A new cluster is formed once the next vector value is farther than a threshold value.

Parameters:
  • array (ndarray) – The vector used to create the clustering (1D)

  • threshold (float) – Threshold value distance used to define a new cluster.

  • num (int) – The minimum number of elements to consider a cluster

Return type:

Union[List[ndarray], ndarray]

Returns:

The matrix containing the left index, right index and the length of the 1D cluster