private void write(VectorWritable vw, Context context, int clusterIndex, double weight)
throws IOException, InterruptedException {
Cluster cluster = clusterModels.get(clusterIndex);
clusterId.set(cluster.getId());
DistanceMeasureCluster distanceMeasureCluster = (DistanceMeasureCluster) cluster;
DistanceMeasure distanceMeasure = distanceMeasureCluster.getMeasure();
double distance = distanceMeasure.distance(cluster.getCenter(), vw.get());
Map<Text, Text> props = Maps.newHashMap();
props.put(new Text("distance"), new Text(Double.toString(distance)));
context.write(clusterId, new WeightedPropertyVectorWritable(weight, vw.get(), props));