Examples of DenseVector


Examples of org.apache.mahout.math.DenseVector

      points.add(new VectorWritable(sd));
    }

    DirichletClusterer dc = new DirichletClusterer(points,
        new GaussianClusterDistribution(new VectorWritable(
            new DenseVector(2))), 1.0, 10, 2, 2);
    List<Cluster[]> result = dc.cluster(20);
    for (Cluster cluster : result.get(result.size() - 1)) {
      System.out.println("Cluster id: " + cluster.getId() + " center: "
          + cluster.getCenter().asFormatString());
    }
View Full Code Here

Examples of org.apache.mahout.matrix.DenseVector

   * @param x an Observation
   * @return the Vector of probabilities
   */
  private Vector normalizedProbabilities(DirichletState<Observation> state,
      Observation x) {
    Vector pi = new DenseVector(numClusters);
    double max = 0;
    for (int k = 0; k < numClusters; k++) {
      double p = state.adjustedProbability(x, k);
      pi.set(k, p);
      if (max < p)
        max = p;
    }
    // normalize the probabilities by largest observed value
    pi.assign(new TimesFunction(), 1.0 / max);
    return pi;
  }
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.