  The superior spectral efficiency (SE) and user fairness feature of
non-orthogonal multiple access (NOMA) systems are achieved by exploiting user
clustering (UC) more efficiently. However, a random UC certainly results in a
suboptimal solution while an exhaustive search method comes at the cost of high
complexity, especially for systems of medium-to-large size. To address this
problem, we develop two efficient unsupervised machine learning (ML) based UC
algorithms, namely k-means++ and improved k-means++, to effectively cluster
users into disjoint clusters in cell-free massive multiple-input
multiple-output (CFmMIMO) system. Using full-pilot zero-forcing at access
points, we derive the sum SE in closed-form expression taking into account the
impact of intra-cluster pilot contamination, inter-cluster interference, and
imperfect successive interference cancellation. To comprehensively assess the
system performance, we formulate the sum SE optimization problem, and then
develop a simple yet efficient iterative algorithm for its solution. In
addition, the performance of collocated massive MIMO-NOMA (COmMIMO-NOMA) system
is also characterized. Numerical results are provided to show the superior
performance of the proposed UC algorithms compared to other baseline schemes.
The effectiveness of applying NOMA in CFmMIMO and COmMIMO systems is also
validated.
