List of usage examples for org.apache.mahout.math VectorWritable readFields
@Override
public void readFields(DataInput in) throws IOException
From source file:com.scaleunlimited.classify.vectors.WritableComparableVector.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { VectorWritable v = new VectorWritable(); // VectorWritable relies on having a valid conf - not sure how // that normally gets set up w/Mahout, but this seems to work. v.setConf(CONF);/* w ww .j a va 2s . co m*/ v.readFields(in); _vector = v.get(); }
From source file:org.gpfvic.mahout.cf.taste.hadoop.item.PrefAndSimilarityColumnWritable.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { prefValue = in.readFloat();// ww w . ja v a 2s. co m VectorWritable vw = new VectorWritable(); vw.readFields(in); similarityColumn = vw.get(); }
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); vector = writable.get();/*from w ww.java 2 s. c om*/ 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); set(writable.get());//from w w w . j av a 2s. com } else { long theUserID = Varint.readSignedVarLong(in); float theValue = in.readFloat(); set(theUserID, theValue); } }