Examples of VarLongWritable


Examples of org.apache.mahout.math.VarLongWritable

                     Context context) throws IOException, InterruptedException {
    String line = value.toString();
    Matcher m = NUMBERS.matcher(line);
    m.find();
    VarIntWritable index = new VarIntWritable();
    VarLongWritable itemID = new VarLongWritable();
    while (m.find()) {
      long item = Long.parseLong(m.group());
      itemID.set(item);
      index.set(idToIndex(item));
      context.write(index, itemID);
    }
  }
View Full Code Here

Examples of org.apache.mahout.math.VarLongWritable

  protected void map(LongWritable key, Text value, Context context)
      throws IOException, InterruptedException {
    String line = value.toString();
    Matcher m = NUMBERS.matcher(line);
    m.find();
    VarLongWritable userID = new VarLongWritable(Long.parseLong(m.group()));
    VarLongWritable itemID = new VarLongWritable();
    while (m.find()) {
      itemID.set(Long.parseLong(m.group()));
      context.write(userID, itemID);
    }
  }
View Full Code Here

Examples of org.apache.mahout.math.VarLongWritable

   
    for (int i = 0; i < userIDs.size(); i++) {
      long userID = userIDs.get(i);
      float prefValue = prefValues.get(i);
      Vector partialProduct = cooccurrenceColumn.times(prefValue);
      context.write(new VarLongWritable(userID),
          new VectorWritable(partialProduct));
    }
  }
View Full Code Here

Examples of org.apache.mahout.math.VarLongWritable

      Path unqualifiedItemIDIndexPath = new Path(itemIDIndexPathStr);
      FileSystem fs = FileSystem.get(unqualifiedItemIDIndexPath.toUri(), conf);
      Path itemIDIndexPath = new Path(itemIDIndexPathStr).makeQualified(fs);

      VarIntWritable index = new VarIntWritable();
      VarLongWritable id = new VarLongWritable();
      for (FileStatus status : fs.listStatus(itemIDIndexPath, PARTS_FILTER)) {
        String path = status.getPath().toString();
        SequenceFile.Reader reader = new SequenceFile.Reader(fs, new Path(path).makeQualified(fs), conf);
        while (reader.next(index, id)) {
          indexItemIDMap.put(index.get(), id.get());
        }
        reader.close();
      }
    } catch (IOException ioe) {
      throw new IllegalStateException(ioe);
View Full Code Here

Examples of org.apache.mahout.math.VarLongWritable

      long temp = userID;
      userID = itemID;
      itemID = temp;
    }
    if (booleanData) {
      context.write(new VarLongWritable(userID), new VarLongWritable(itemID));
    } else {
      float prefValue = tokens.length > 2 ? Float.parseFloat(tokens[2]) : 1.0f;
      context.write(new VarLongWritable(userID), new EntityPrefWritable(itemID, prefValue));
    }
  }
View Full Code Here

Examples of org.apache.mahout.math.VarLongWritable

    ctx.write(EasyMock.eq(new IntWritable(5)), MathHelper.matrixEntryMatches(5, 789, 1));
    ctx.write(EasyMock.eq(new IntWritable(9)), MathHelper.matrixEntryMatches(9, 789, 1));

    EasyMock.replay(ctx);

    mapper.map(new VarLongWritable(123L), new VectorWritable(v1), ctx);
    mapper.map(new VarLongWritable(456L), new VectorWritable(v2), ctx);
    mapper.map(new VarLongWritable(789L), new VectorWritable(v3), ctx);

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

Examples of org.apache.mahout.math.VarLongWritable

                     Context context) throws IOException, InterruptedException {

    String[] tokens = TasteHadoopUtils.splitPrefTokens(value.toString());
    long userID = Long.parseLong(tokens[0]);

    context.write(new CountUsersKeyWritable(userID), new VarLongWritable(userID));
  }
View Full Code Here

Examples of org.apache.mahout.math.VarLongWritable

  @Override
  protected void map(LongWritable key, Text line, Context ctx) throws IOException, InterruptedException {
    String[] tokens = SEPARATOR.split(line.toString());
    long userID = Long.parseLong(tokens[0]);
    long itemID = Long.parseLong(tokens[1]);
    ctx.write(new VarLongWritable(itemID), new VarLongWritable(userID));
  }
View Full Code Here

Examples of org.apache.mahout.math.VarLongWritable

      if (itemID < minimumItemID) {
        minimumItemID = itemID;
      }
    }
    if (minimumItemID != Long.MAX_VALUE) {
      context.write(index, new VarLongWritable(minimumItemID));
    }
  }
View Full Code Here

Examples of org.apache.mahout.math.VarLongWritable

   */
  @Test
  public void testCountUsersMapper() throws Exception {
    Mapper<LongWritable,Text,CountUsersKeyWritable,VarLongWritable>.Context context =
        EasyMock.createMock(Mapper.Context.class);
    context.write(keyForUserID(12L), EasyMock.eq(new VarLongWritable(12L)));
    context.write(keyForUserID(35L), EasyMock.eq(new VarLongWritable(35L)));
    EasyMock.replay(context);

    CountUsersMapper mapper = new CountUsersMapper();
    mapper.map(null, new Text("12,100,1.3"), context);
    mapper.map(null, new Text("35,100,3.0"), context);
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.