class KMeansUtil implements Serializable {

    public static KMeansTrainModelData transformPredictDataToTrainData(KMeansPredictModelData predictModelData) {
        KMeansTrainModelData modelData = new KMeansTrainModelData();
        modelData.params = predictModelData.params;
        modelData.centroids = new ArrayList<>();
        for (int i = 0; i < predictModelData.params.k; i++) {
            KMeansTrainModelData.ClusterSummary clusterSummary = new KMeansTrainModelData.ClusterSummary(
                predictModelData.getClusterVector(i),
                predictModelData.getClusterId(i),
                predictModelData.getClusterWeight(i));
            modelData.centroids.add(clusterSummary);
        }
        return modelData;
    }

}