Computational Intelligence and Neuroscience / 2021 / Article / Alg 1

Research Article

An Efficient Automatic Gait Anomaly Detection Method Based on Semisupervised Clustering

Algorithm 1

The pseudocodes of the COP-K-means algorithm.
Algorithm: COP-K-Means
Input: (1) Dataset .
       (2) Must-link constraints ML and cannot-link constraints CL.
       (3)Number of clusters K.
Output: disjoint K partitioning of the dataset X.
Method:
1. Let C1Ck be the initial cluster center.
2. For each point xi of X, assign it to the closest cluster Cj such that CONSTRAINTS-VIOLATE-CHECK (xi, Cj, ML, CL) is false. If no such cluster exists, return {}.
3. For each cluster Cj, its center is updated by averaging all the data points that have been placed in it.
4. Iterate between step 2 and step 3 until the algorithm convergence.
5. Return disjoint K partitioning of the dataset X.
Algorithm: CONSTRAINTS-VIOLATE-CHECK
Input: (1) Data point xi.
       (2) Cluster Cj.
       (3) Must-link constraints ML and cannot-link constraints CL.
Output: constraints is violated or not.
1. For each (xi, xl) ∈ ML: if xl ∉ Cj, return true.
2. For each (xi, xl) ∈ CL: if xl ∈ Cj, return true.
3. Otherwise, return False.