Examples of map()


Examples of org.apache.mahout.cf.taste.hadoop.ToItemPrefsMapper.map()

    context.write(new VarLongWritable(12L), new EntityPrefWritable(34L, 1.0f));
    context.write(new VarLongWritable(56L), new EntityPrefWritable(78L, 2.0f));
    EasyMock.replay(context);

    ToItemPrefsMapper mapper = new ToItemPrefsMapper();
    mapper.map(new LongWritable(123L), new Text("12,34,1"), context);
    mapper.map(new LongWritable(456L), new Text("56,78,2"), context);

    EasyMock.verify(context);
  }
View Full Code Here

Examples of org.apache.mahout.classifier.bayes.common.BayesFeatureMapper.map()

    DefaultStringifier<Integer> intStringifier = new DefaultStringifier<Integer>(conf, Integer.class);
    conf.set("bayes.gramSize", intStringifier.toString(3));
    mapper.configure(conf);

    DummyOutputCollector<Text, DoubleWritable> output = new DummyOutputCollector<Text, DoubleWritable>();
    mapper.map(new Text("foo"), new Text("big brown shoe"), output, null);
    Map<String, List<DoubleWritable>> outMap = output.getData();
    System.out.println("Map: " + outMap);
    assertNotNull("outMap is null and it shouldn't be", outMap);
    //TODO: How about not such a lame test here?
    for (Map.Entry<String, List<DoubleWritable>> entry : outMap.entrySet()) {
View Full Code Here

Examples of org.apache.mahout.classifier.bayes.mapreduce.common.BayesFeatureMapper.map()

          + "org.apache.hadoop.io.serializer.WritableSerialization");
    conf.set("bayes.parameters", new BayesParameters(3).toString());
    mapper.configure(conf);
   
    DummyOutputCollector<StringTuple,DoubleWritable> output = new DummyOutputCollector<StringTuple,DoubleWritable>();
    mapper.map(new Text("foo"), new Text("big brown shoe"), output,
      Reporter.NULL);
    Map<String,List<DoubleWritable>> outMap = output.getData();
    System.out.println("Map: " + outMap);
    assertNotNull("outMap is null and it shouldn't be", outMap);
    // TODO: How about not such a lame test here?
View Full Code Here

Examples of org.apache.mahout.clustering.spectral.MatrixDiagonalizeJob.MatrixDiagonalizeMapper.map()

   
    // perform the mapping
    for (int i = 0; i < RAW_DIMENSIONS; i++) {
      RandomAccessSparseVector toAdd = new RandomAccessSparseVector(RAW_DIMENSIONS);
      toAdd.assign(RAW[i]);
      mapper.map(new IntWritable(i), new VectorWritable(toAdd), context);
    }
   
    // check the number of the results
    assertEquals("Number of map results", RAW_DIMENSIONS,
        writer.getValue(NullWritable.get()).size());
View Full Code Here

Examples of org.apache.mahout.clustering.spectral.UnitVectorizerJob.UnitVectorizerMapper.map()

   
    // perform the mapping
    for (int i = 0; i < RAW.length; i++) {
      Vector vector = new RandomAccessSparseVector(RAW[i].length);
      vector.assign(RAW[i]);
      mapper.map(new IntWritable(i), new VectorWritable(vector), context);
    }
   
    // check the results
    assertEquals("Number of map results", RAW.length, writer.getData().size());
    for (int i = 0; i < RAW.length; i++) {
View Full Code Here

Examples of org.apache.mahout.clustering.spectral.VectorMatrixMultiplicationJob.VectorMatrixMultiplicationMapper.map()

   
    // run the job
    for (int i = 0; i < MATRIX.length; i++) {
      Vector v = new RandomAccessSparseVector(MATRIX[i].length);
      v.assign(MATRIX[i]);
      mapper.map(new IntWritable(i), new VectorWritable(v), context);
    }
   
    // check the results
    assertEquals("Number of map results", MATRIX.length, writer.getData().size());
    for (int i = 0; i < MATRIX.length; i++) {
View Full Code Here

Examples of org.apache.mahout.clustering.spectral.common.MatrixDiagonalizeJob.MatrixDiagonalizeMapper.map()

   
    // perform the mapping
    for (int i = 0; i < RAW_DIMENSIONS; i++) {
      RandomAccessSparseVector toAdd = new RandomAccessSparseVector(RAW_DIMENSIONS);
      toAdd.assign(RAW[i]);
      mapper.map(new IntWritable(i), new VectorWritable(toAdd), context);
    }
   
    // check the number of the results
    assertEquals("Number of map results", RAW_DIMENSIONS,
        writer.getValue(NullWritable.get()).size());
View Full Code Here

Examples of org.apache.mahout.clustering.spectral.common.UnitVectorizerJob.UnitVectorizerMapper.map()

   
    // perform the mapping
    for (int i = 0; i < RAW.length; i++) {
      Vector vector = new RandomAccessSparseVector(RAW[i].length);
      vector.assign(RAW[i]);
      mapper.map(new IntWritable(i), new VectorWritable(vector), context);
    }
   
    // check the results
    assertEquals("Number of map results", RAW.length, writer.getData().size());
    for (int i = 0; i < RAW.length; i++) {
View Full Code Here

Examples of org.apache.mahout.clustering.spectral.common.VectorMatrixMultiplicationJob.VectorMatrixMultiplicationMapper.map()

   
    // run the job
    for (int i = 0; i < MATRIX.length; i++) {
      Vector v = new RandomAccessSparseVector(MATRIX[i].length);
      v.assign(MATRIX[i]);
      mapper.map(new IntWritable(i), new VectorWritable(v), context);
    }
   
    // check the results
    assertEquals("Number of map results", MATRIX.length, writer.getData().size());
    for (int i = 0; i < MATRIX.length; i++) {
View Full Code Here

Examples of org.apache.mahout.clustering.spectral.eigencuts.EigencutsAffinityCutsJob.EigencutsAffinityCutsMapper.map()

    // perform the maps
    for (int i = 0; i < this.affinity.length; i++) {
      VectorWritable aff = new VectorWritable(new DenseVector(this.affinity[i]));
      VectorWritable sens = new VectorWritable(new DenseVector(this.sensitivity[i]));
      IntWritable key = new IntWritable(i);
      mapper.map(key, aff, context);
      mapper.map(key, sens, context);
    }
   
    // were the vertices constructed correctly? if so, then for two 4x4
    // matrices, there should be 10 unique keys with 56 total entries
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.