modify kmeans algorithm script generator