Example usage for org.apache.mahout.classifier.sgd PolymorphicWritable read

List of usage examples for org.apache.mahout.classifier.sgd PolymorphicWritable read

Introduction

In this page you can find the example usage for org.apache.mahout.classifier.sgd PolymorphicWritable read.

Prototype

public static <T extends Writable> T read(DataInput dataInput, Class<? extends T> clazz) throws IOException 

Source Link

Usage

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();/*from w  w w. j a  v  a2 s  . co 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);
    }

}