K-means clustering analysis model and related code implementation