Examples of VarIntWritable


Examples of org.apache.mahout.math.VarIntWritable

  @Test
  public void testRowWeightMapper() throws Exception {
    Mapper<IntWritable,VectorWritable,VarIntWritable,WeightedOccurrence>.Context context =
      EasyMock.createMock(Mapper.Context.class);

    context.write(new VarIntWritable(456), new WeightedOccurrence(123, 0.5, 2.0));
    context.write(new VarIntWritable(789), new WeightedOccurrence(123, 0.1, 2.0));

    EasyMock.replay(context);

    Vector vector = new RandomAccessSparseVector(Integer.MAX_VALUE);
    vector.set(456, 0.5);
View Full Code Here

Examples of org.apache.mahout.math.VarIntWritable

        new WeightedOccurrence(78, 3.0, 9.0));

    Reducer<VarIntWritable,WeightedOccurrence,VarIntWritable,WeightedOccurrenceArray>.Context context =
      EasyMock.createMock(Reducer.Context.class);

    context.write(EasyMock.eq(new VarIntWritable(123)), weightedOccurrenceArrayMatches(weightedOccurrences));

    EasyMock.replay(context);

    new RowSimilarityJob.WeightedOccurrencesPerColumnReducer().reduce(new VarIntWritable(123), weightedOccurrences,
        context);

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

Examples of org.apache.mahout.math.VarIntWritable

    EasyMock.replay(context);

    WeightedOccurrenceArray weightedOccurrences = new WeightedOccurrenceArray(new WeightedOccurrence[] {
        new WeightedOccurrence(34, 0.5, 1.0), new WeightedOccurrence(56, 1.0, 3.0) });

    new RowSimilarityJob.CooccurrencesMapper().map(new VarIntWritable(12), weightedOccurrences, context);

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

Examples of org.apache.mahout.math.VarIntWritable

    throws IOException, InterruptedException {
    int sum = 0;
    for (VarIntWritable value : values) {
      sum += value.get();
    }
    context.write(new Text(key), new VarIntWritable(sum));
  }
View Full Code Here

Examples of org.apache.mahout.math.VarIntWritable

      full = EmailUtility.cleanUpEmailAddress(full);

      if (EmailUtility.WHITESPACE.matcher(full).matches()) {
        context.getCounter(EmailUtility.Counters.NO_FROM_ADDRESS).increment(1);
      } else {
        context.write(new Text(full), new VarIntWritable(1));
      }
    }

  }
View Full Code Here

Examples of org.apache.mahout.math.VarIntWritable

      idx = keyStr.lastIndexOf('/', idx);
      String msgId = keyStr.substring(idx + 1);
      if (EmailUtility.WHITESPACE.matcher(msgId).matches()) {
        context.getCounter(EmailUtility.Counters.NO_MESSAGE_ID).increment(1);
      } else {
        context.write(new Text(msgId), new VarIntWritable(1));
      }
    }
  }
View Full Code Here

Examples of org.apache.mahout.math.VarIntWritable

  @Test
  public void testSimilarityMatrixRowWrapperMapper() throws Exception {
    Mapper<IntWritable,VectorWritable,VarIntWritable,VectorOrPrefWritable>.Context context =
      EasyMock.createMock(Mapper.Context.class);

    context.write(EasyMock.eq(new VarIntWritable(12)), vectorOfVectorOrPrefWritableMatches(MathHelper.elem(34, 0.5),
        MathHelper.elem(56, 0.7)));

    EasyMock.replay(context);

    RandomAccessSparseVector vector = new RandomAccessSparseVector(Integer.MAX_VALUE, 100);
View Full Code Here

Examples of org.apache.mahout.math.VarIntWritable

  @Test
  public void testUserVectorSplitterMapper() throws Exception {
    Mapper<VarLongWritable,VectorWritable, VarIntWritable,VectorOrPrefWritable>.Context context =
        EasyMock.createMock(Mapper.Context.class);

    context.write(EasyMock.eq(new VarIntWritable(34)), prefOfVectorOrPrefWritableMatches(123L, 0.5f));
    context.write(EasyMock.eq(new VarIntWritable(56)), prefOfVectorOrPrefWritableMatches(123L, 0.7f));

    EasyMock.replay(context);

    UserVectorSplitterMapper mapper = new UserVectorSplitterMapper();
    setField(mapper, "maxPrefsPerUserConsidered", 10);
View Full Code Here

Examples of org.apache.mahout.math.VarIntWritable

  @Test
  public void testUserVectorSplitterMapperUserExclusion() throws Exception {
    Mapper<VarLongWritable,VectorWritable, VarIntWritable,VectorOrPrefWritable>.Context context =
        EasyMock.createMock(Mapper.Context.class);

    context.write(EasyMock.eq(new VarIntWritable(34)), prefOfVectorOrPrefWritableMatches(123L, 0.5f));
    context.write(EasyMock.eq(new VarIntWritable(56)), prefOfVectorOrPrefWritableMatches(123L, 0.7f));

    EasyMock.replay(context);

    FastIDSet usersToRecommendFor = new FastIDSet();
    usersToRecommendFor.add(123L);
View Full Code Here

Examples of org.apache.mahout.math.VarIntWritable

  @Test
  public void testUserVectorSplitterMapperOnlySomePrefsConsidered() throws Exception {
    Mapper<VarLongWritable,VectorWritable, VarIntWritable,VectorOrPrefWritable>.Context context =
        EasyMock.createMock(Mapper.Context.class);

    context.write(EasyMock.eq(new VarIntWritable(34)), prefOfVectorOrPrefWritableMatchesNaN(123L));
    context.write(EasyMock.eq(new VarIntWritable(56)), prefOfVectorOrPrefWritableMatches(123L, 0.7f));

    EasyMock.replay(context);

    UserVectorSplitterMapper mapper = new UserVectorSplitterMapper();
    setField(mapper, "maxPrefsPerUserConsidered", 1);
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.