List of usage examples for org.apache.mahout.math MatrixWritable readMatrix
public static Matrix readMatrix(DataInput in) throws IOException
From source file:com.cloudera.knittingboar.messages.GradientUpdateMessage.java
License:Apache License
public void Deserialize(DataInput in) throws IOException { this.src_host = in.readUTF(); this.SrcWorkerPassCount = in.readInt(); this.gradient.setMatrix(MatrixWritable.readMatrix(in)); }
From source file:com.cloudera.knittingboar.messages.iterativereduce.ParameterVector.java
License:Apache License
public void Deserialize(byte[] bytes) throws IOException { // DataInput in) throws IOException { ByteArrayInputStream b = new ByteArrayInputStream(bytes); DataInput in = new DataInputStream(b); // this.src_host = in.readUTF(); this.SrcWorkerPassCount = in.readInt(); this.GlobalPassCount = in.readInt(); this.IterationComplete = in.readInt(); this.CurrentIteration = in.readInt(); this.TrainedRecords = in.readInt(); // d.writeInt(this.TrainedRecords); this.AvgLogLikelihood = in.readFloat(); // d.writeFloat(this.AvgLogLikelihood); this.PercentCorrect = in.readFloat(); // d.writeFloat(this.PercentCorrect); this.parameter_vector = MatrixWritable.readMatrix(in); }
From source file:com.cloudera.knittingboar.sgd.ParallelOnlineLogisticRegression.java
License:Apache License
@Override public void readFields(DataInput in) throws IOException { int version = in.readInt(); if (version == WRITABLE_VERSION) { learningRate = in.readDouble();/*w ww .ja v a 2s. c o m*/ decayFactor = in.readDouble(); stepOffset = in.readInt(); step = in.readInt(); forgettingExponent = in.readDouble(); perTermAnnealingOffset = in.readInt(); numCategories = in.readInt(); beta = MatrixWritable.readMatrix(in); prior = PolymorphicWritable.read(in, PriorFunction.class); updateCounts = VectorWritable.readVector(in); updateSteps = VectorWritable.readVector(in); } else { throw new IOException("Incorrect object version, wanted " + WRITABLE_VERSION + " got " + version); } }