Examples of numCols()


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

    Matrix similarityMatrix =
      MathHelper.readEntries(fs, conf, new Path(outputDir.getAbsolutePath(), "part-r-00000"), 3, 3);
   
    assertNotNull(similarityMatrix);
    assertEquals(3, similarityMatrix.numCols());
    assertEquals(3, similarityMatrix.numRows());

    assertEquals(1.0, similarityMatrix.get(0, 0), EPSILON);
    assertEquals(1.0, similarityMatrix.get(1, 1), EPSILON);
    assertEquals(1.0, similarityMatrix.get(2, 2), EPSILON);
View Full Code Here

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

    Matrix similarityMatrix =
        MathHelper.readEntries(fs, conf, new Path(outputDir.getAbsolutePath(), "part-r-00000"), 3, 3);
   
    assertNotNull(similarityMatrix);
    assertEquals(3, similarityMatrix.numCols());
    assertEquals(3, similarityMatrix.numRows());

    assertEquals(0.0, similarityMatrix.get(0, 0), EPSILON);
    assertEquals(0.5, similarityMatrix.get(0, 1), EPSILON);
    assertEquals(0.0, similarityMatrix.get(0, 2), EPSILON);
View Full Code Here

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

    SequenceFileValueIterator<MatrixWritable> it =
        new SequenceFileValueIterator<MatrixWritable>(inputPath, true, new Configuration());
    Matrix m = it.next().get();
    it.close();
    PrintStream ps = getPrintStream(outputFile);
    String[] columnLabels = getLabels(m.numCols(), m.getColumnLabelBindings(), "col");
    String[] rowLabels = getLabels(m.numRows(), m.getRowLabelBindings(), "row");
    if (doLabels) {
      ps.print("rowid,");
      ps.print(columnLabels[0]);
      for (int c = 1; c < m.numCols(); c++) {
View Full Code Here

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

    String[] columnLabels = getLabels(m.numCols(), m.getColumnLabelBindings(), "col");
    String[] rowLabels = getLabels(m.numRows(), m.getRowLabelBindings(), "row");
    if (doLabels) {
      ps.print("rowid,");
      ps.print(columnLabels[0]);
      for (int c = 1; c < m.numCols(); c++) {
        ps.print(',' + columnLabels[c]);
      }
      ps.println();
    }
    for (int r = 0; r < m.numRows(); r++) {
View Full Code Here

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

    for (int r = 0; r < m.numRows(); r++) {
      if (doLabels) {
        ps.print(rowLabels[0] + ',');
      }
      ps.print(Double.toString(m.getQuick(r,0)));
      for (int c = 1; c < m.numCols(); c++) {
        ps.print(",");
        ps.print(Double.toString(m.getQuick(r,c)));
      }
      ps.println();
    }
View Full Code Here

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

        "--tempDir", tmpDir.getAbsolutePath() });

    Matrix similarityMatrix = MathHelper.readMatrix(conf, new Path(outputDir.getAbsolutePath(), "part-r-00000"), 3, 3);

    assertNotNull(similarityMatrix);
    assertEquals(3, similarityMatrix.numCols());
    assertEquals(3, similarityMatrix.numRows());

    assertEquals(1.0, similarityMatrix.get(0, 0), EPSILON);
    assertEquals(1.0, similarityMatrix.get(1, 1), EPSILON);
    assertEquals(1.0, similarityMatrix.get(2, 2), EPSILON);
View Full Code Here

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

        "--tempDir", tmpDir.getAbsolutePath() });

    Matrix similarityMatrix = MathHelper.readMatrix(conf, new Path(outputDir.getAbsolutePath(), "part-r-00000"), 3, 3);

    assertNotNull(similarityMatrix);
    assertEquals(3, similarityMatrix.numCols());
    assertEquals(3, similarityMatrix.numRows());

    assertEquals(0.0, similarityMatrix.get(0, 0), EPSILON);
    assertEquals(0.5, similarityMatrix.get(0, 1), EPSILON);
    assertEquals(0.0, similarityMatrix.get(0, 2), EPSILON);
View Full Code Here

Examples of org.apache.mahout.math.SparseRowMatrix.numCols()

        "--numFeatures", String.valueOf(numFeatures), "--numIterations", String.valueOf(numIterations) });

    Matrix u = MathHelper.readMatrix(conf, new Path(outputDir.getAbsolutePath(), "U/part-m-00000"),
        preferences.numRows(), numFeatures);
    Matrix m = MathHelper.readMatrix(conf, new Path(outputDir.getAbsolutePath(), "M/part-m-00000"),
        preferences.numCols(), numFeatures);

    StringBuilder info = new StringBuilder();
    info.append("\nA - users x items\n\n");
    info.append(MathHelper.nice(preferences));
    info.append("\nU - users x features\n\n");
View Full Code Here

Examples of org.apache.mahout.math.hadoop.DistributedRowMatrix.numCols()

    DistributedRowMatrix corpus = TestDistributedRowMatrix.randomDistributedMatrix(500,
        450, 400, 10, 10.0, symmetric, "testdata");
    corpus.configure(new JobConf());
    DistributedLanczosSolver solver = new DistributedLanczosSolver();
    int desiredRank = 30;
    Matrix eigenVectors = new DenseMatrix(desiredRank, corpus.numCols());
    List<Double> eigenValues = new ArrayList<Double>();
    solver.solve(corpus, desiredRank, eigenVectors, eigenValues, symmetric);
    assertOrthonormal(eigenVectors);
    assertEigen(eigenVectors, corpus, eigenVectors.numRows() / 2, 0.01, symmetric);
  }
View Full Code Here

Examples of org.apache.mahout.math.hadoop.DistributedRowMatrix.numCols()

    Path lanczosSeqFiles = new Path(outputCalc, "eigenvectors-" + (System.nanoTime() & 0xFF));
    solver.runJob(conf,
                  L.getRowPath(),
                  new Path(outputTmp, "lanczos-" + (System.nanoTime() & 0xFF)),
                  L.numRows(),
                  L.numCols(),
                  true,
                  overshoot,
                  eigenVectors,
                  eigenValues,
                  lanczosSeqFiles.toString());
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.