Package org.apache.mahout.common.distance

Examples of org.apache.mahout.common.distance.DistanceMeasure.configure()


    Configuration conf = context.getConfiguration();
    try {
      ClassLoader ccl = Thread.currentThread().getContextClassLoader();
      DistanceMeasure measure = ccl.loadClass(conf.get(KMeansConfigKeys.DISTANCE_MEASURE_KEY))
          .asSubclass(DistanceMeasure.class).newInstance();
      measure.configure(conf);
     
      String clusterPath = conf.get(KMeansConfigKeys.CLUSTER_PATH_KEY);
      if (clusterPath != null && clusterPath.length() > 0) {
        KMeansUtil.configureWithClusterInfo(conf, new Path(clusterPath), clusters);
        if (clusters.isEmpty()) {
View Full Code Here


      Constructor<? extends Vector> v = vcl.getConstructor(int.class);
      modelDistribution.setModelPrototype(new VectorWritable(v.newInstance(prototypeSize)));
     
      if (modelDistribution instanceof DistanceMeasureClusterDistribution) {
        DistanceMeasure measure = ClassUtils.instantiateAs(distanceMeasure, DistanceMeasure.class);
        measure.configure(conf);
        ((DistanceMeasureClusterDistribution) modelDistribution).setMeasure(measure);
      }
    } catch (ClassNotFoundException cnfe) {
      throw new IllegalStateException(cnfe);
    } catch (NoSuchMethodException nsme) {
View Full Code Here

  public static CanopyClusterer configureCanopyClusterer(Configuration configuration) {
    double t1 = Double.parseDouble(configuration.get(T1_KEY));
    double t2 = Double.parseDouble(configuration.get(T2_KEY));

    DistanceMeasure measure = ClassUtils.instantiateAs(configuration.get(DISTANCE_MEASURE_KEY), DistanceMeasure.class);
    measure.configure(configuration);

    CanopyClusterer canopyClusterer = new CanopyClusterer(measure, t1, t2);

    String d = configuration.get(T3_KEY);
    if (d != null) {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.