Examples of dotProduct()


Examples of cc.mallet.types.AugmentableFeatureVector.dotProduct()

  public void testDotProductBinaryToSV ()
  {
    SparseVector v = makeSparseVectorToN (5);
    AugmentableFeatureVector afv = makeAfv (new int[] { 1, 3 }, true);
    double dp = afv.dotProduct (v);
    assertEquals (4.0, dp, 1e-5);
    new AugmentableFeatureVector (new Alphabet(), true);
  }

  public void testDotProductSparseASVToSV ()
View Full Code Here

Examples of cc.mallet.types.AugmentableFeatureVector.dotProduct()

  public void testDotProductSparseASVToSV ()
  {
    SparseVector v = makeSparseVectorToN (7);
    AugmentableFeatureVector afv = makeAfv (new int[] { 1, 3 }, false);
    double dp = afv.dotProduct (v);
    assertEquals (4.0, dp, 1e-5);

    afv = makeAfv (new int[] { 2, 5 }, false);
    dp = afv.dotProduct (v);
    assertEquals (7.0, dp, 1e-5);
View Full Code Here

Examples of cc.mallet.types.AugmentableFeatureVector.dotProduct()

    AugmentableFeatureVector afv = makeAfv (new int[] { 1, 3 }, false);
    double dp = afv.dotProduct (v);
    assertEquals (4.0, dp, 1e-5);

    afv = makeAfv (new int[] { 2, 5 }, false);
    dp = afv.dotProduct (v);
    assertEquals (7.0, dp, 1e-5);
  }

  private AugmentableFeatureVector makeAfv (int[] ints, boolean binary)
  {
View Full Code Here

Examples of cc.mallet.types.FeatureVector.dotProduct()

            // which is the number of counts for the document if we use that as input
            double Ncounts = MatrixOps.sum(fv);

            // CPAL - get the additional term for the value of our - log probability
            //      - this computation amounts to the dot product of the feature vector and the probability vector
            cachedValue -= (instanceWeight * fv.dotProduct(lprobs[li]));

            // CPAL - get the model expectation over features for the given class
            for (int fi = 0; fi < numFeatures; fi++) {

              //if(parameters[numFeatures*li + fi] != 0) {
View Full Code Here

Examples of cc.mallet.types.HashedSparseVector.dotProduct()

    checkAnswer (s, new double[] { 3, 5, 7, 6, 7 });
  }

  public void testDotProduct () {
    HashedSparseVector t1 = new HashedSparseVector (new int[] { 7 }, new double[] { 0.2 });
    assertEquals (0.6, t1.dotProduct (s1), 0.00001);
    assertEquals (0.6, s1.dotProduct (t1), 0.00001);
   
    assertEquals (19.0, s1.dotProduct (s2), 0.00001);
    assertEquals (19.0, s2.dotProduct (s1), 0.00001);
View Full Code Here

Examples of cc.mallet.types.HashedSparseVector.dotProduct()

                                             false, false, false);
    HashedSparseVector binary2 = new HashedSparseVector (idx2, null, idx2.length, idx2.length,
                                            false, false, false);

    assertEquals (3, binary1.dotProduct (binary2), 0.0001);
    assertEquals (3, binary2.dotProduct (binary1), 0.0001);

    assertEquals (15.0, binary1.dotProduct (s1), 0.0001);
    assertEquals (15.0, s1.dotProduct (binary1), 0.0001);

    assertEquals (9.0, binary2.dotProduct (s1), 0.0001);
View Full Code Here

Examples of cc.mallet.types.HashedSparseVector.dotProduct()

    assertEquals (3, binary2.dotProduct (binary1), 0.0001);

    assertEquals (15.0, binary1.dotProduct (s1), 0.0001);
    assertEquals (15.0, s1.dotProduct (binary1), 0.0001);

    assertEquals (9.0, binary2.dotProduct (s1), 0.0001);
    assertEquals (9.0, s1.dotProduct (binary2), 0.0001);

    HashedSparseVector dblVec = (HashedSparseVector) s1.cloneMatrix ();
    dblVec.plusEqualsSparse (binary1);
    checkAnswer (dblVec, new double[] { 2, 3, 4, 5, 6 });
View Full Code Here

Examples of cc.mallet.types.IndexedSparseVector.dotProduct()

    }
  }

  public void testDotProduct () {
    IndexedSparseVector t1 = new IndexedSparseVector (new int[] { 7 }, new double[] { 0.2 });
    assertEquals (0.6, t1.dotProduct (s1), 0.00001);
    assertEquals (0.6, s1.dotProduct (t1), 0.00001);

    assertEquals (19.0, s1.dotProduct (s2), 0.00001);
    assertEquals (19.0, s2.dotProduct (s1), 0.00001);
View Full Code Here

Examples of cc.mallet.types.IndexedSparseVector.dotProduct()

                                             false, false, false);
    IndexedSparseVector binary2 = new IndexedSparseVector (idx2, null, idx2.length, idx2.length,
                                            false, false, false);

    assertEquals (3, binary1.dotProduct (binary2), 0.0001);
    assertEquals (3, binary2.dotProduct (binary1), 0.0001);

    assertEquals (15.0, binary1.dotProduct (s1), 0.0001);
    assertEquals (15.0, s1.dotProduct (binary1), 0.0001);

    assertEquals (9.0, binary2.dotProduct (s1), 0.0001);
View Full Code Here

Examples of cc.mallet.types.IndexedSparseVector.dotProduct()

    assertEquals (3, binary2.dotProduct (binary1), 0.0001);

    assertEquals (15.0, binary1.dotProduct (s1), 0.0001);
    assertEquals (15.0, s1.dotProduct (binary1), 0.0001);

    assertEquals (9.0, binary2.dotProduct (s1), 0.0001);
    assertEquals (9.0, s1.dotProduct (binary2), 0.0001);

    IndexedSparseVector dblVec = (IndexedSparseVector) s1.cloneMatrix ();
    dblVec.plusEqualsSparse (binary1);
    checkAnswer (dblVec, new double[] { 2, 3, 4, 5, 6 });
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.