Package org.apache.mahout.math

Examples of org.apache.mahout.math.VectorWritable


                                          OutputCollector<Text,VectorWritable> collector,
                                          Reporter reporter) throws IOException {
    double minDist = Double.MAX_VALUE;
    Canopy closest = null;
    boolean isCovered = false;
    VectorWritable vw = new VectorWritable();
    for (Canopy canopy : canopies) {
      double dist = measure.distance(canopy.getCenter().getLengthSquared(), canopy.getCenter(), point);
      if (dist < t1) {
        isCovered = true;
        vw.set(point);
        collector.collect(new Text(canopy.getIdentifier()), vw);
        reporter.setStatus("Emit Canopy ID:" + canopy.getIdentifier());
      } else if (dist < minDist) {
        minDist = dist;
        closest = canopy;
      }
    }
    // if the point is not contained in any canopies (due to canopy centroid
    // clustering), emit the point to the closest covering canopy.
    vw.set(point);
    if (!isCovered) {
      collector.collect(new Text(closest.getIdentifier()), vw);
      reporter.setStatus("Emit Closest Canopy ID:" + closest.getIdentifier());
    }
  }
View Full Code Here


  }
 
  @Override
  public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    VectorWritable temp = new VectorWritable();
    temp.readFields(in);
    this.setCenter(new RandomAccessSparseVector(temp.get()));
    this.setPointTotal(getCenter().clone());
    this.setNumPoints(1);
  }
View Full Code Here

   *             if there is an error
   */
  public static List<VectorWritable> readFile(String fileName) throws IOException {
    List<VectorWritable> results = new ArrayList<VectorWritable>();
    for (String line : new FileLineIterable(new File(fileName))) {
      results.add(new VectorWritable(AbstractVector.decodeVector(line)));
    }
    return results;
  }
View Full Code Here

    getResults();
    new DisplayASNOutputState();
  }
 
  static void generateResults() {
    DisplayDirichlet.generateResults(new NormalModelDistribution(new VectorWritable(new DenseVector(2))));
  }
View Full Code Here

    generateResults();
    new DisplayASNDirichlet();
  }
 
  static void generateResults() {
    DisplayDirichlet.generateResults(new AsymmetricSampledNormalDistribution(new VectorWritable(new DenseVector(2))));
  }
View Full Code Here

    private final MapFilesMap<IntWritable,VectorWritable> map;
    private VectorWritable columnVector;
   
    private CooccurrenceCache(MapFilesMap<IntWritable,VectorWritable> map) {
      this.map = map;
      columnVector = new VectorWritable();
      columnVector.set(new RandomAccessSparseVector(Integer.MAX_VALUE, 1000));
    }
View Full Code Here

    }
  }
 
  @Override
  public void configure(JobConf job) {
    vectorWritable = new VectorWritable();
    String vectorImplClassName = job.get("vector.implementation.class.name");
    try {
      Class<? extends Vector> outputClass = (Class<? extends Vector>) job.getClassByName(vectorImplClassName);
      constructor = outputClass.getConstructor(int.class);
    } catch (NoSuchMethodException e) {
View Full Code Here

        throw new TasteException(ioe);
      }
      if (value == null) {
        return null;
      }
      columnVector = new VectorWritable();
      columnVector.set(new RandomAccessSparseVector(Integer.MAX_VALUE, 1000));
      return value;
    }
View Full Code Here

   *             if there is an error
   */
  public static List<VectorWritable> readFile(String fileName) throws IOException {
    List<VectorWritable> results = new ArrayList<VectorWritable>();
    for (String line : new FileLineIterable(new File(fileName))) {
      results.add(new VectorWritable(AbstractVector.decodeVector(line)));
    }
    return results;
  }
View Full Code Here

    getResults();
    new DisplayOutputState();
  }
 
  static void generateResults() {
    DisplayDirichlet.generateResults(new NormalModelDistribution(new VectorWritable(new DenseVector(2))));
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.VectorWritable

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.