Examples of numLocations()


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

        // For the default feature, whose weight is 1.0
        assert(!Double.isNaN(instanceWeight)) : "instanceWeight is NaN";
        //assert(!Double.isNaN(li)) : "bestIndex is NaN";
        boolean hasNaN = false;
        for(int i = 0; i < fv.numLocations(); i++) {
          if(Double.isNaN(fv.valueAtLocation(i))) {
            logger.info("NaN for feature " + fdict.lookupObject(fv.indexAtLocation(i)).toString());
            hasNaN = true;
          }
        }
View Full Code Here

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

      FeatureVector featureVector = (FeatureVector)instance.getData();
     
      // this handles distributions over labels
      for (int li = 0; li < numLabels; li++) {
        double py = instance.getLabeling().value(li);
        for (int loc = 0; loc < featureVector.numLocations(); loc++) {
          int fi = featureVector.indexAtLocation(loc);
          double val;
          if (useValues) {
            val = featureVector.valueAtLocation(loc);
          }
View Full Code Here

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

      }

      assert(!Double.isNaN(instanceWeight)) : "instanceWeight is NaN";

      boolean hasNaN = false;
      for (int i = 0; i < fv.numLocations(); i++) {
        if (Double.isNaN(fv.valueAtLocation(i))) {
          logger.info("NaN for feature " + fdict.lookupObject(fv.indexAtLocation(i)).toString());
          hasNaN = true;
        }
      }
View Full Code Here

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

        // Make sure the feature vector's feature dictionary matches
        // what we are expecting from our data pipe (and thus our notion
        // of feature probabilities.
        assert (instancePipe == null || fv.getAlphabet () == this.instancePipe.getDataAlphabet ());
        int fvisize = fv.numLocations();

        // Take dot products
        double sum = 0;
        for (int ci = 0; ci < numClasses; ci++) {
      for (int fvi = 0; fvi < fvisize; fvi++) {
View Full Code Here

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

        MatrixOps.rowPlusEquals (constraints, numFeatures, li, fv, 2*instanceWeight);
        // For the default feature, whose weight is 1.0
        assert(!Double.isNaN(instanceWeight)) : "instanceWeight is NaN";
        assert(!Double.isNaN(li)) : "bestIndex is NaN";
        boolean hasNaN = false;
        for(int i = 0; i < fv.numLocations(); i++) {
          if(Double.isNaN(fv.valueAtLocation(i))) {
            logger.info("NaN for feature " + fdict.lookupObject(fv.indexAtLocation(i)).toString());
            hasNaN = true;
          }
        }
View Full Code Here

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

   
    for(int ti = 0; ti < numTopics; ti++){
      pw.println("Topic\t" + ti);
      FeatureCounter counter = wordCountsPerTopic[ti];
      FeatureVector fv = counter.toFeatureVector();
      for(int pos = 0; pos < fv.numLocations(); pos++){
        int fi = fv.indexAtLocation(pos);
        String word = (String) alphabet.lookupObject(fi);
        int count = (int) fv.valueAtLocation(pos);
        double prob;
        prob = (double) (count+beta)/(tokensPerTopic[ti] + betaSum);
View Full Code Here

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

      xis = lattice.getXis();
      for (int ip = 1; ip < fvs.size(); ++ip) {
        cache.resetQuick();
        FeatureVector fv = fvs.getFeatureVector(ip);
        int fi;
        for (int loc = 0; loc < fv.numLocations(); loc++) {
          fi = fv.indexAtLocation(loc);
          // binary constraint features
          if (constraintsMap.containsKey(fi)) {
            cache.add(constraintsMap.get(fi));
          }
View Full Code Here

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

    BitSet bitSet = new BitSet(data.size());
    for (Instance instance : data) {
      FeatureVectorSequence fvs = (FeatureVectorSequence)instance.getData();
      for (int ip = 0; ip < fvs.size(); ip++) {
        fv = fvs.get(ip);
        for (int loc = 0; loc < fv.numLocations(); loc++) {
          fi = fv.indexAtLocation(loc);
          if (constraints.containsKey(fi)) {
            constraints.get(fi).count += 1;
            bitSet.set(ii);
          }
View Full Code Here

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

    BitSet bitSet = new BitSet(data.size());
    for (Instance instance : data) {
      FeatureVectorSequence fvs = (FeatureVectorSequence)instance.getData();
      for (int ip = 0; ip < fvs.size(); ip++) {
        fv = fvs.get(ip);
        for (int loc = 0; loc < fv.numLocations(); loc++) {
          fi = fv.indexAtLocation(loc);
          if (constraints.containsKey(fi)) {
            constraints.get(fi).count += 1;
            bitSet.set(ii);
          }
View Full Code Here

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

      gammas = lattice.getGammas();
      for (int ip = 0; ip < fvs.size(); ++ip) {
        cache.resetQuick();
        FeatureVector fv = fvs.getFeatureVector(ip);
        int fi;
        for (int loc = 0; loc < fv.numLocations(); loc++) {
          fi = fv.indexAtLocation(loc);
          // binary constraint features
          if (constraints.containsKey(fi)) {
            cache.add(fi);
          }
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.