Package de.jungblut.writable

Examples of de.jungblut.writable.MatrixWritable


   * Deserializes a new MultinomialNaiveBayesClassifier from the given input
   * stream. Note that "in" will not be closed by this method.
   */
  public static MultinomialNaiveBayes deserialize(DataInput in)
      throws IOException {
    MatrixWritable matrixWritable = new MatrixWritable();
    matrixWritable.readFields(in);
    DoubleVector classProbability = VectorWritable.readVector(in);

    return new MultinomialNaiveBayes(matrixWritable.getMatrix(),
        classProbability);
  }
View Full Code Here


        classProbability);
  }

  public static void serialize(MultinomialNaiveBayes model, DataOutput out)
      throws IOException {
    new MatrixWritable(model.probabilityMatrix).write(out);
    VectorWritable.writeVector(model.classPriorProbability, out);
  }
View Full Code Here

    for (int layer : model.layerSizes) {
      out.writeInt(layer);
    }

    for (DoubleMatrix mat : model.weights) {
      new MatrixWritable(mat).write(out);
    }

    out.writeUTF(model.activationFunction.getClass().getName());

  }
View Full Code Here

      sizes[i] = in.readInt();
    }

    DoubleMatrix[] array = new DoubleMatrix[layers];
    for (int i = 0; i < layers; i++) {
      MatrixWritable mv = new MatrixWritable();
      mv.readFields(in);
      array[i] = mv.getMatrix();
    }
    ActivationFunction func = null;
    try {
      func = (ActivationFunction) Class.forName(in.readUTF()).newInstance();
    } catch (InstantiationException | IllegalAccessException
View Full Code Here

      layers[i] = in.readInt();
    }

    WeightMatrix[] weights = new WeightMatrix[numLayers - 1];
    for (int i = 0; i < weights.length; i++) {
      MatrixWritable wm = new MatrixWritable();
      wm.readFields(in);
      weights[i] = new WeightMatrix(wm.getMatrix());
    }

    ActivationFunction[] funcs = new ActivationFunction[numLayers];
    for (int i = 0; i < numLayers; i++) {
      try {
View Full Code Here

      out.writeInt(l);
    }
    // write the weight matrices
    for (WeightMatrix mat : model.weights) {
      DoubleMatrix weights = mat.getWeights();
      new MatrixWritable(weights).write(out);
    }
    // then write the activation classes
    for (ActivationFunction func : model.activations) {
      out.writeUTF(func.getClass().getName());
    }
View Full Code Here

TOP

Related Classes of de.jungblut.writable.MatrixWritable

Copyright © 2018 www.massapicom. 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.