Package org.apache.mahout.math

Examples of org.apache.mahout.math.VectorWritable.readFields()


  @Override
  public void readFields(DataInput in) throws IOException {
    this.id = in.readInt();
    this.counter = in.readInt();
    VectorWritable temp = new VectorWritable();
    temp.readFields(in);
    this.coefficients = temp.get();
    this.observed = coefficients.like();
  }

  @Override
View Full Code Here


  @Override
  public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    this.converged = in.readBoolean();
    VectorWritable temp = new VectorWritable();
    temp.readFields(in);
    this.setCenter(new RandomAccessSparseVector(temp.get()));
    this.setNumPoints(0);
    this.setPointTotal(getCenter().like());
    this.pointSquaredTotal = getCenter().like();
  }
View Full Code Here

 
  @Override
  public void readFields(DataInput in) throws IOException {
    this.points = in.readInt();
    VectorWritable temp = new VectorWritable();
    temp.readFields(in);
    this.pointTotal = temp.get();
  }
}
View Full Code Here

 
  @Override
  public void readFields(DataInput in) throws IOException {
    super.readFields(in);
    VectorWritable temp = new VectorWritable();
    temp.readFields(in);
    this.setCenter(temp.get());
    int numpoints = in.readInt();
    this.boundPoints = new IntArrayList();
    for (int i = 0; i < numpoints; i++) {
      this.boundPoints.add(in.readInt());
View Full Code Here

  @Override
  public void readFields(DataInput in) throws IOException {
    boolean hasVector = in.readBoolean();
    if (hasVector) {
      VectorWritable writable = new VectorWritable();
      writable.readFields(in);
      set(writable.get());
    } else {
      long theUserID = Varint.readSignedVarLong(in);
      float theValue = in.readFloat();
      set(theUserID, theValue);
View Full Code Here

        if (!fs.exists(meanVectorFile.get())) {
          throw new FileNotFoundException(meanVectorFile.get().toString());
        }
        DataInputStream in = fs.open(meanVectorFile.get());
        try {
          meanVector.readFields(in);
        } finally {
          Closeables.close(in, true);
        }
        this.meanVector = meanVector.get();
        Preconditions.checkArgument(this.meanVector != null, "meanVector not initialized");
View Full Code Here

        if (!fs.exists(weightsFile.get())) {
          throw new FileNotFoundException(weightsFile.get().toString());
        }
        DataInputStream in = fs.open(weightsFile.get());
        try {
          weights.readFields(in);
        } finally {
          Closeables.close(in, true);
        }
        this.weights = weights.get();
      }
View Full Code Here

    matrix.readFields(input);
    Matrix transitionMatrix = matrix.get();

    VectorWritable vector = new VectorWritable();
    vector.readFields(input);
    Vector initialProbabilities = vector.get();

    return new HmmModel(transitionMatrix, emissionMatrix, initialProbabilities);
  }
View Full Code Here

  @Override
  public void readFields(DataInput in) throws IOException {
    prefValue = in.readFloat();
    VectorWritable vw = new VectorWritable();
    vw.readFields(in);
    similarityColumn = vw.get();
  }

  @Override
  public void write(DataOutput out) throws IOException {
View Full Code Here

  }

  @Override
  public void readFields(DataInput in) throws IOException {
    VectorWritable writable = new VectorWritable();
    writable.readFields(in);
    vector = writable.get();
    int size = Varint.readUnsignedVarInt(in);
    userIDs = Lists.newArrayListWithCapacity(size);
    values = Lists.newArrayListWithCapacity(size);
    for (int i = 0; i < size; i++) {
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.