Underground WLAN location fingerprinting personnel positioning system mainly realizes overall division of location fingerprinting samples through clustering algorithm, but existing clustering algorithm only carries out the clustering division according to the statistical distribution characteristics of received signal strength (RSS), and does not fully consider singularity problem. For the above problem, a class relationship K-Means (CRK-Means) algorithm was proposed. CRK-Means algorithm takes the ratio of intra class dispersion and inter class dispersion as the objective function, and the optimal clustering without singularity problem can be achieved by aggregation and separation process of clustering with the minimum ratio, so as to complete reasonable division of positioning area. Genetic Algorithm-Random Forets (GA-RF) algorithm was proposed to solve the problem of misjudgment in rough localization of clustering area by using Random Forest(RF) algorithm. The optimization process of selection, crossover and mutation in GA ensures the optimal value of the total number of selection trees and the feature number of location fingerprints reference points in RF algorithm. The experimental results show that the CRK-Means algorithm solves the singularity problem effectively, and improves the positioning accuracy of the positioning system. The accuracy of sub-region rough positioning by CRK-Means algorithm and GA-RF algorithm is 4% and higher than RF algorithm, it is 98%. The minimum positioning error with a confidence probability greater than 90% is 3 m, which is better than the traditional clustering algorithms.