Package gnu.trove.iterator

Examples of gnu.trove.iterator.TObjectDoubleIterator


        TObjectDoubleMap that = ( TObjectDoubleMap ) other;
        if ( that.size() != this.size() ) {
            return false;
        }
        try {
            TObjectDoubleIterator iter = this.iterator();
            while ( iter.hasNext() ) {
                iter.advance();
                Object key = iter.key();
                double value = iter.value();
                if ( value == no_entry_value ) {
                    if ( !( that.get( key ) == that.getNoEntryValue() &&
                      that.containsKey( key ) ) ) {

                        return false;
View Full Code Here


        TObjectDoubleMap that = ( TObjectDoubleMap ) other;
        if ( that.size() != this.size() ) {
            return false;
        }
        try {
            TObjectDoubleIterator iter = this.iterator();
            while ( iter.hasNext() ) {
                iter.advance();
                Object key = iter.key();
                double value = iter.value();
                if ( value == no_entry_value ) {
                    if ( !( that.get( key ) == that.getNoEntryValue() &&
                      that.containsKey( key ) ) ) {

                        return false;
View Full Code Here

        TObjectDoubleMap that = ( TObjectDoubleMap ) other;
        if ( that.size() != this.size() ) {
            return false;
        }
        try {
            TObjectDoubleIterator iter = this.iterator();
            while ( iter.hasNext() ) {
                iter.advance();
                Object key = iter.key();
                double value = iter.value();
                if ( value == no_entry_value ) {
                    if ( !( that.get( key ) == that.getNoEntryValue() &&
                      that.containsKey( key ) ) ) {

                        return false;
View Full Code Here

        TObjectDoubleMap that = ( TObjectDoubleMap ) other;
        if ( that.size() != this.size() ) {
            return false;
        }
        try {
            TObjectDoubleIterator iter = this.iterator();
            while ( iter.hasNext() ) {
                iter.advance();
                Object key = iter.key();
                double value = iter.value();
                if ( value == no_entry_value ) {
                    if ( !( that.get( key ) == that.getNoEntryValue() &&
                      that.containsKey( key ) ) ) {

                        return false;
View Full Code Here

       //
       // message to self
       output.collect(new Text(fields[0]), new Text(line));

       // message to neighbors
       TObjectDoubleIterator neighIterator = neighbors.iterator();
       while (neighIterator.hasNext()) {
         neighIterator.advance();
        
         // message (neighbor_node, current_node + DELIM + curr_node_label_scores
         output.collect(new Text((String) neighIterator.key()),
                   new Text(fields[0] + _kDelim + fields[3]));
       }
     }
View Full Code Here

      if (vi < totalTrainInstances) {
        v.setIsSeedNode(true);
       
        // we expect that the gold labels for the node has already been
        // set, we only need to copy them as injected labels
        TObjectDoubleIterator goldLabIter = v.goldLabels().iterator();
        while (goldLabIter.hasNext()) {
          goldLabIter.advance();
          v.SetInjectedLabelScore((String) goldLabIter.key(), goldLabIter.value());
        }
      } else {
        v.setIsTestNode(true);
      }
    }
View Full Code Here

       //
       // message to self
       output.collect(new Text(fields[0]), new Text(line));

       // message to neighbors
       TObjectDoubleIterator neighIterator = neighbors.iterator();
       while (neighIterator.hasNext()) {
         neighIterator.advance();
        
         // message (neighbor_node, current_node + DELIM + curr_node_label_scores
         output.collect(new Text((String) neighIterator.key()),
                   new Text(fields[0] + _kDelim + fields[3]));
       }
     }
View Full Code Here

  public static void AddScores(TObjectDoubleHashMap result, double mult,
                               TObjectDoubleHashMap addDist) {
    assert (result != null);
    assert (addDist != null);

    TObjectDoubleIterator iter = addDist.iterator();
    while (iter.hasNext()) {
      iter.advance();
      double adjVal = mult * iter.value();
     
      //      System.out.println(">> adjVal: " + mult + " " + iter.key() + " " + iter.value() + " " + adjVal);
      result.adjustOrPutValue(iter.key(), adjVal, adjVal);
    }
  }
View Full Code Here

  public static void DivScores(TObjectDoubleHashMap result, double divisor) {
    assert (result != null);
    assert (divisor > 0);

    TObjectDoubleIterator li = result.iterator();
    while (li.hasNext()) {
      li.advance();
      // System.out.println("Before: " + " " + li.key() + " " + li.value() + " " + divisor);
      double newVal = (1.0 * li.value()) / divisor;
      result.put(li.key(), newVal);
      // System.out.println("After: " + " " + li.key() + " " + result.get(li.key()) + " " + divisor);
    }
  }
View Full Code Here

    // default value, then keep the top scoring k labels as requested
    if (keepTopK != Integer.MAX_VALUE) {
      KeepTopScoringKeys(m, keepTopK);
    }

    TObjectDoubleIterator mi = m.iterator();
    double denom = 0;
    while (mi.hasNext()) {
      mi.advance();
      denom += mi.value();
    }
    // assert (denom > 0);

    if (denom > 0) {
      mi = m.iterator();
      while (mi.hasNext()) {
        mi.advance();
        double newVal = mi.value() / denom;
        mi.setValue(newVal);
      }
    }
  }
View Full Code Here

TOP

Related Classes of gnu.trove.iterator.TObjectDoubleIterator

Copyright © 2018 www.massapicom. 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.