Package org.apache.mahout.math

Examples of org.apache.mahout.math.SequentialAccessSparseVector$AllElement


    eigenvalues = VectorCache.load(
        new IntWritable(EigencutsKeys.EIGENVALUES_CACHE_INDEX), config);
    diagonal = VectorCache.load(
        new IntWritable(EigencutsKeys.DIAGONAL_CACHE_INDEX), config);
    if (!(eigenvalues instanceof SequentialAccessSparseVector || eigenvalues instanceof DenseVector)) {
      eigenvalues = new SequentialAccessSparseVector(eigenvalues);
    }
    if (!(diagonal instanceof SequentialAccessSparseVector || diagonal instanceof DenseVector)) {
      diagonal = new SequentialAccessSparseVector(diagonal);
    }
  }
View Full Code Here


      if (log.isDebugEnabled()) {
        log.debug("(DEBUG - REDUCE) Row[{}], Column[{}], Value[{}]",
                  new Object[] {row.get(), element.getCol(), element.getVal()});
      }
    }
    SequentialAccessSparseVector output = new SequentialAccessSparseVector(out);
    context.write(row, new VectorWritable(output));
  }
View Full Code Here

  private Path output;

  public static List<VectorWritable> getPointsWritable(double[][] raw) {
    List<VectorWritable> points = new ArrayList<VectorWritable>();
    for (double[] fr : raw) {
      Vector vec = new SequentialAccessSparseVector(fr.length);
      vec.assign(fr);
      points.add(new VectorWritable(vec));
    }
    return points;
  }
View Full Code Here

      RandomAccessSparseVector tmp = new RandomAccessSparseVector(newNumCols, 100);
      while (it.hasNext()) {
        DistributedRowMatrix.MatrixEntryWritable e = it.next();
        tmp.setQuick(e.getCol(), e.getVal());
      }
      SequentialAccessSparseVector outVector = new SequentialAccessSparseVector(tmp);
      out.collect(outRow, new VectorWritable(outVector));
    }
View Full Code Here

      Vector accumulator = new RandomAccessSparseVector(it.next().get());
      while (it.hasNext()) {
        Vector row = it.next().get();
        row.addTo(accumulator);
      }
      out.collect(rowNum, new VectorWritable(new SequentialAccessSparseVector(accumulator)));
    }
View Full Code Here

        NullWritable nw = NullWritable.get();
        reader.next(nw, val);
        reader.close();
        inputVector = val.get();
        if (!(inputVector instanceof SequentialAccessSparseVector || inputVector instanceof DenseVector)) {
          inputVector = new SequentialAccessSparseVector(inputVector);
        }
        int outDim = conf.getInt(OUTPUT_VECTOR_DIMENSION, Integer.MAX_VALUE);
        outputVector = conf.getBoolean(IS_SPARSE_OUTPUT, false)
                     ? new RandomAccessSparseVector(outDim, 10)
                     : new DenseVector(outDim);
View Full Code Here

  }

  @Test
  public void testCanopyAsFormatStringSparse() {
    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Cluster cluster = new Canopy(m, 123, measure);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "C-123{n=0 c=[0:1.100, 2:3.300] r=[]}", formatString);
  }
View Full Code Here

  }

  @Test
  public void testCanopyAsFormatStringSparseWithBindings() {
    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Cluster cluster = new Canopy(m, 123, measure);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "C-123{n=0 c=[0:1.100, 2:3.300] r=[]}", formatString);
  }
View Full Code Here

  }

  @Test
  public void testClusterAsFormatStringSparse() {
    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Cluster cluster = new org.apache.mahout.clustering.kmeans.Cluster(m, 123, measure);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "CL-123{n=0 c=[0:1.100, 2:3.300] r=[]}", formatString);
  }
View Full Code Here

  }

  @Test
  public void testClusterAsFormatStringSparseWithBindings() {
    double[] d = { 1.1, 0.0, 3.3 };
    Vector m = new SequentialAccessSparseVector(3);
    m.assign(d);
    Cluster cluster = new org.apache.mahout.clustering.kmeans.Cluster(m, 123, measure);
    String formatString = cluster.asFormatString(null);
    System.out.println(formatString);
    assertEquals("format", "CL-123{n=0 c=[0:1.100, 2:3.300] r=[]}", formatString);
  }
View Full Code Here

TOP

Related Classes of org.apache.mahout.math.SequentialAccessSparseVector$AllElement

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.