Ejemplo n.º 1
0
 private void getInitialCentroidsFromCassandraDB() {
   String[] serializedCentroids = FuzzyClustersDatabase.getSerializedClusterMap();
   for (int i = 0; i < serializedCentroids.length; i++) {
     try {
       centroids.put(
           i + 1,
           SerializeAndDeserializeJavaObjects.convertStringToDoubleArray(serializedCentroids[i]));
     } catch (Exception ex) {
       ex.printStackTrace();
     }
   }
 }
Ejemplo n.º 2
0
 private void updateCentroids(int clusterIndex, double[] vector) {
   String serializedVectors =
       SerializeAndDeserializeJavaObjects.convertDoubleVectorToString(vector);
   FuzzyClustersDatabase.setSerializedMap(clusterIndex, serializedVectors);
 }