Examples of viewRow()


Examples of org.apache.mahout.math.DenseMatrix.viewRow()

      }
    };

    SSVDPrototype mapperSimulation = new SSVDPrototype(seed, kp, 3000);
    for (int i = 0; i < m; i++) {
      mapperSimulation.firstPass(mx.viewRow(i));
    }

    mapperSimulation.finishFirstPass();

    for (int i = 0; i < m; i++) {
View Full Code Here

Examples of org.apache.mahout.math.DenseMatrix.viewRow()

    }

    mapperSimulation.finishFirstPass();

    for (int i = 0; i < m; i++) {
      mapperSimulation.secondPass(mx.viewRow(i), btEmitter);
    }

    // LocalSSVDTest.assertOrthonormality(mapperSimulation.m_qt.transpose(),
    // false,1e-10);
View Full Code Here

Examples of org.apache.mahout.math.DenseMatrix.viewRow()

   *         last category.
   */
  public Matrix classifyFull(Matrix data) {
    Matrix r = new DenseMatrix(data.numRows(), numCategories());
    for (int row = 0; row < data.numRows(); row++) {
      classifyFull(r.viewRow(row), data.getRow(row));
    }
    return r;
  }

  /**
 
View Full Code Here

Examples of org.apache.mahout.math.DenseMatrix.viewRow()

    /* Y' (Cu -I) Y by outer products */
    for (Element e : userRatings.nonZeroes()) {
      for (Vector.Element feature : Y.get(e.index()).all()) {
        Vector partial = CuMinusIY.get(e.index()).times(feature.get());
        YtransponseCuMinusIY.viewRow(feature.index()).assign(partial, Functions.PLUS);
      }
    }

    /* Y' (Cu - I) Y + λ I  add lambda on the diagonal */
    for (int feature = 0; feature < numFeatures; feature++) {
View Full Code Here

Examples of org.apache.mahout.math.DenseMatrix.viewRow()

    Matrix topicTermCounts = new DenseMatrix(numTopics, numTerms);
    Vector topicSums = new DenseVector(numTopics);
    if (random != null) {
      for (int x = 0; x < numTopics; x++) {
        for (int term = 0; term < numTerms; term++) {
          topicTermCounts.viewRow(x).set(term, random.nextDouble());
        }
      }
    }
    for (int x = 0; x < numTopics; x++) {
      topicSums.set(x, random == null ? 1.0 : topicTermCounts.viewRow(x).norm(1));
View Full Code Here

Examples of org.apache.mahout.math.DenseMatrix.viewRow()

          topicTermCounts.viewRow(x).set(term, random.nextDouble());
        }
      }
    }
    for (int x = 0; x < numTopics; x++) {
      topicSums.set(x, random == null ? 1.0 : topicTermCounts.viewRow(x).norm(1));
    }
    return Pair.of(topicTermCounts, topicSums);
  }

  public static Pair<Matrix, Vector> loadModel(Configuration conf, Path... modelPaths)
View Full Code Here

Examples of org.apache.mahout.math.DenseMatrix.viewRow()

    }
    numTopics++;
    Matrix model = new DenseMatrix(numTopics, numTerms);
    Vector topicSums = new DenseVector(numTopics);
    for (Pair<Integer, Vector> pair : rows) {
      model.viewRow(pair.getFirst()).assign(pair.getSecond());
      topicSums.set(pair.getFirst(), pair.getSecond().norm(1));
    }
    return Pair.of(model, topicSums);
  }
View Full Code Here

Examples of org.apache.mahout.math.DenseMatrix.viewRow()

    // Put the centroids into a matrix.
    Matrix x = new DenseMatrix(6, 5);
    int row = 0;
    for (Centroid c : r) {
      x.viewRow(row).assign(c.viewPart(0, 5));
      row++;
    }

    // Verify that each column looks right. Should contain zeros except for a single 6.
    final Vector columnNorms = x.aggregateColumns(new VectorFunction() {
View Full Code Here

Examples of org.apache.mahout.math.DenseMatrix.viewRow()

   * @return A matrix of scores, one row per row of the input matrix, one column for each but the last category.
   */
  public Matrix classifyFull(Matrix data) {
    Matrix r = new DenseMatrix(data.numRows(), numCategories());
    for (int row = 0; row < data.numRows(); row++) {
      classifyFull(r.viewRow(row), data.viewRow(row));
    }
    return r;
  }

  /**
 
View Full Code Here

Examples of org.apache.mahout.math.Matrix.viewRow()

    Matrix topicTermCounts = new DenseMatrix(numTopics, numTerms);
    Vector topicSums = new DenseVector(numTopics);
    if(random != null) {
      for(int x = 0; x < numTopics; x++) {
        for(int term = 0; term < numTerms; term++) {
          topicTermCounts.viewRow(x).set(term, random.nextDouble());
        }
      }
    }
    for(int x = 0; x < numTopics; x++) {
      topicSums.set(x, random == null ? 1.0 : topicTermCounts.viewRow(x).norm(1));
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.