Examples of indexAtLocation()


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

    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.indexAtLocation()

      boolean hasNaN = false;

      for (int i = 0; i < features.numLocations(); i++) {
        if (Double.isNaN(features.valueAtLocation(i))) {
          logger.info("NaN for feature " + alphabet.lookupObject(features.indexAtLocation(i)).toString());
          hasNaN = true;
        }
      }

      if (hasNaN) {
View Full Code Here

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

      double digammaDifferenceForSums =
        Dirichlet.digamma(sumScores + totalLength) -
        Dirichlet.digamma(sumScores);
     
      for (int loc = 0; loc < features.numLocations(); loc++) {
        int index = features.indexAtLocation(loc);
        double value = features.valueAtLocation(loc);
                   
        if (value == 0.0) { continue; }

        // In a FeatureVector, there's no easy way to say "do you know
View Full Code Here

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

    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.indexAtLocation()

      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

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

              for (int ii = 0; ii < valsi.numLocations(); ii++) {
                String si = (String) valueAlph
                    .lookupObject(valsi.indexAtLocation(ii));
                for (int jj = 0; jj < valsj.numLocations(); jj++) {
                  String sj = (String) valueAlph
                      .lookupObject(valsj
                          .indexAtLocation(jj));
                  if (Strings.levenshteinDistance(si, sj) < approxMatchThreshold) {
                    matches++;
                    break;
                  }
View Full Code Here

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

                String si = (String) valueAlph
                .lookupObject(valsi.indexAtLocation(ii));
                if (si.length() < 2) break;
                for (int jj = 0; jj < valsj.numLocations(); jj++) {
                  String sj = (String) valueAlph
                      .lookupObject(valsj
                          .indexAtLocation(jj));
                  if (sj.length() > 2 && (si.contains(si) || sj.contains(si))) {
                    matches++;
                    break;
                  }
View Full Code Here

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

        Arrays.fill(results, 0);

        // compute dot(x, wi) for each class i
        for(int lpos = 0; lpos < numLabels; lpos++) {
          for(int fvi = 0; fvi < fvisize; fvi++) {
            int fi = fv.indexAtLocation(fvi);
            double vi = fv.valueAtLocation(fvi);
            results[lpos] += vi * m_weights[lpos][fi];
          }

          // This extra value comes from the extra
View Full Code Here

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

        // Adjust weights if this example is mispredicted
        // or just barely correct
        if (predictedIndex != correctIndex) {
          for (int fvi = 0; fvi < fvisize; fvi++) {
            int fi = fv.indexAtLocation(fvi);
            m_weights[predictedIndex][fi] *= (1 - epsilon);
            m_weights[correctIndex][fi] *= (1 + epsilon);
          }
          m_weights[predictedIndex][numFeats] *= (1 - epsilon);
          m_weights[correctIndex][numFeats] *= (1 + epsilon);
View Full Code Here

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

          m_weights[predictedIndex][numFeats] *= (1 - epsilon);
          m_weights[correctIndex][numFeats] *= (1 + epsilon);
        }
        else if (max/secondMax - 1 < m_delta) {
          for (int fvi = 0; fvi < fvisize; fvi++) {
            int fi = fv.indexAtLocation(fvi);
            m_weights[secondHighestIndex][fi] *= (1 - epsilon);
            m_weights[correctIndex][fi] *= (1 + epsilon);
          }
          m_weights[secondHighestIndex][numFeats] *= (1 - epsilon);
          m_weights[correctIndex][numFeats] *= (1 + epsilon);
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.