Package org.apache.hama.ml.math

Examples of org.apache.hama.ml.math.DenseDoubleVector$NonZeroIterator


   * The model meta-data is stored in memory.
   */
  public DoubleVector output(DoubleVector featureVector) {
    List<double[]> outputCache = this.outputInternal(featureVector);
    // the output of the last layer is the output of the MLP
    return new DenseDoubleVector(outputCache.get(outputCache.size() - 1));
  }
View Full Code Here


    double[] trainingFeature = Arrays.copyOfRange(trainingVec, 0,
        this.layerSizeArray[0]);
    double[] trainingLabels = Arrays.copyOfRange(trainingVec,
        this.layerSizeArray[0], trainingVec.length);

    DoubleVector trainingFeatureVec = new DenseDoubleVector(trainingFeature);
    List<double[]> outputCache = this.outputInternal(trainingFeatureVec);

    // calculate the delta of output layer
    double[] delta = new double[this.layerSizeArray[this.layerSizeArray.length - 1]];
    double[] outputLayerOutput = outputCache.get(outputCache.size() - 1);
View Full Code Here

    BufferedReader br = new BufferedReader(
        new InputStreamReader(fs.open(txtIn)));
    String line;
    while ((line = br.readLine()) != null) {
      String[] split = line.split("\t");
      DenseDoubleVector vec = new DenseDoubleVector(split.length);
      for (int j = 0; j < split.length; j++) {
        vec.set(j, Double.parseDouble(split[j]));
      }
      VectorWritable vector = new VectorWritable(vec);
      dataWriter.append(vector, value);
      if (k > i) {
          assert centerWriter != null;
View Full Code Here

      double[] arr = new double[dimension];
      for (int d = 0; d < dimension; d++) {
        arr[d] = r.nextInt(count);
      }
      VectorWritable vector = new VectorWritable(new DenseDoubleVector(arr));
      dataWriter.append(vector, value);
      if (k > i) {
        centerWriter.append(vector, value);
      } else if (k == i) {
        centerWriter.close();
View Full Code Here

TOP

Related Classes of org.apache.hama.ml.math.DenseDoubleVector$NonZeroIterator

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.