Package com.aamend.hadoop.clustering.cluster

Examples of com.aamend.hadoop.clustering.cluster.Canopy


            double dist = measure.distance(canopy.getCenter(), point);
            if (dist < t1) {
                KEY.set(Arrays.toString(canopy.getCenter()));
                Cluster newCluster;
                if (dist < t2) {
                    newCluster = new Canopy(canopy.getId(), point, value.get().getNum());
                    LOGGER.debug("Adding (T2) {} to Cluster {}", Arrays.toString(point),
                            Arrays.toString(canopy.getCenter()));
                } else {
                    newCluster = new Canopy(canopy.getId(), point, 0L);
                    LOGGER.debug("Adding (T1) {} to Cluster {}", Arrays.toString(point),
                            Arrays.toString(canopy.getCenter()));
                }

                context.write(KEY, new CanopyWritable(newCluster));
            }

            stronglyBound = stronglyBound || dist < t2;
        }
        if (!stronglyBound) {
            nextCanopyId++;
            Cluster canopy = new Canopy(nextCanopyId, point, value.get().getNum());
            canopies.add(canopy);
            LOGGER.debug("Creating a new Cluster {}", canopy.asFormattedString());
            KEY.set(Arrays.toString(canopy.getCenter()));
            context.write(KEY, value);
        }

    }
View Full Code Here


            double dist = measure.distance(canopy.getCenter(), point);
            if (dist < t1) {
                KEY.set(Arrays.toString(canopy.getCenter()));
                Cluster newCluster;
                if (dist < t2) {
                    newCluster = new Canopy(canopy.getId(), point, 1L);
                    LOGGER.debug("Adding (T2) {} to Cluster center {}", Arrays.toString((int[]) value.get()),
                            Arrays.toString(canopy.getCenter()));
                } else {
                    newCluster = new Canopy(canopy.getId(), point, 0L);
                    LOGGER.debug("Adding (T1) {} to Cluster center {}", Arrays.toString((int[]) value.get()),
                            Arrays.toString(canopy.getCenter()));
                }
                context.write(KEY, new CanopyWritable(newCluster));
            }
            stronglyBound = stronglyBound || dist < t2;
        }
        if (!stronglyBound) {
            nextCanopyId++;
            Cluster canopy = new Canopy(nextCanopyId, point, 1L);
            LOGGER.debug("Creating a new Cluster {}", canopy.asFormattedString());
            canopies.add(canopy);
            KEY.set(Arrays.toString(canopy.getCenter()));
            context.write(KEY, new CanopyWritable(canopy));
        }

    }
View Full Code Here

        LOGGER.info("Minimizing distance across {} data points in cluster center {}",
                points.size(), Arrays.toString(clusterTemplate.getCenter()));

        clusterTemplate.computeCenter(points, measure);
        nextCanopyId++;
        Cluster newCluster = new Canopy(nextCanopyId, clusterTemplate.getCenter(), clusterTemplate.getNum());
        context.getCounter(COUNTER, COUNTER_CANOPY).increment(1L);
        context.write(KEY, new CanopyWritable(newCluster));

    }
View Full Code Here

TOP

Related Classes of com.aamend.hadoop.clustering.cluster.Canopy

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.