Package org.apache.mahout.matrix

Examples of org.apache.mahout.matrix.Vector.plus()


        assertEquals("too many values", 1, values.size());
        String value = values.get(0).toString();

        String[] pointInfo = value.split("\t");
        count += Integer.parseInt(pointInfo[0]);
        total = total.plus(AbstractVector.decodeVector(pointInfo[1]));
      }
      assertEquals("total points", 9, count);
      assertEquals("point total[0]", 27, (int) total.get(0));
      assertEquals("point total[1]", 27, (int) total.get(1));
    }
View Full Code Here


        assertEquals("too many values", 1, values.size());
        //String value = values.get(0).toString();
        KMeansInfo info = values.get(0);

        count += info.getPoints();
        total = total.plus(info.getPointTotal());
      }
      assertEquals("total points", 9, count);
      assertEquals("point total[0]", 27, (int) total.get(0));
      assertEquals("point total[1]", 27, (int) total.get(1));
    }
View Full Code Here

    // digamma is expensive, precompute
    Vector digammaGamma = digamma(gamma);
    // and log normalize:
    double digammaSumGamma = digamma(gamma.zSum());
    digammaGamma = digammaGamma.plus(-digammaSumGamma);

    Map<Integer, Integer> columnMap = new HashMap<Integer, Integer>();

    int iteration = 0;
    final int MAX_ITER = 20;
View Full Code Here

      assert !Double.isNaN(phiTotal);
      assert !Double.isNaN(state.logProbWordGivenTopic(word, k));
      assert !Double.isInfinite(state.logProbWordGivenTopic(word, k));
      assert !Double.isNaN(digammaGamma.get(k));
    }
    return phi.plus(-phiTotal); // log normalize
  }


  private static Vector digamma(Vector v) {
    Vector digammaGamma = new DenseVector(v.size());
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.