List of usage examples for org.apache.mahout.math Varint readSignedVarLong
public static long readSignedVarLong(DataInput in) throws IOException
From source file:org.gpfvic.mahout.cf.taste.hadoop.EntityEntityWritable.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { aID = Varint.readSignedVarLong(in); bID = Varint.readSignedVarLong(in); }
From source file:org.gpfvic.mahout.cf.taste.hadoop.item.VectorAndPrefsWritable.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { VectorWritable writable = new VectorWritable(); writable.readFields(in);//from www . j a va 2s . co m vector = writable.get(); int size = Varint.readUnsignedVarInt(in); userIDs = new ArrayList<>(size); values = new ArrayList<>(size); for (int i = 0; i < size; i++) { userIDs.add(Varint.readSignedVarLong(in)); values.add(in.readFloat()); } }
From source file:org.gpfvic.mahout.cf.taste.hadoop.item.VectorOrPrefWritable.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { boolean hasVector = in.readBoolean(); if (hasVector) { VectorWritable writable = new VectorWritable(); writable.readFields(in);// w ww . j a va2s. c o m set(writable.get()); } else { long theUserID = Varint.readSignedVarLong(in); float theValue = in.readFloat(); set(theUserID, theValue); } }
From source file:org.gpfvic.mahout.cf.taste.hadoop.RecommendedItemsWritable.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { int size = in.readInt(); recommended = new ArrayList<>(size); for (int i = 0; i < size; i++) { long itemID = Varint.readSignedVarLong(in); float value = in.readFloat(); RecommendedItem recommendedItem = new GenericRecommendedItem(itemID, value); recommended.add(recommendedItem); }// w w w. j a v a 2s . c o m }