Package org.apache.commons.lang.mutable

Examples of org.apache.commons.lang.mutable.MutableDouble


   */
  public void accumulateStoreMetric(final Map<String, MutableDouble> tmpMap,
      StoreMetricType storeMetricType, double val) {
    final String key = getStoreMetricName(storeMetricType);
    if (tmpMap.get(key) == null) {
      tmpMap.put(key, new MutableDouble(val));
    } else {
      tmpMap.get(key).add(val);
    }

    if (this == ALL_SCHEMA_METRICS) {
      // also compute the max value across all Stores on this server
      final String maxKey = getStoreMetricNameMax(storeMetricType);
      MutableDouble cur = tmpMap.get(maxKey);
      if (cur == null) {
        tmpMap.put(maxKey, new MutableDouble(val));
      } else if (cur.doubleValue() < val) {
        cur.setValue(val);
      }
    } else {
      ALL_SCHEMA_METRICS.accumulateStoreMetric(tmpMap, storeMetricType, val);
    }
  }
View Full Code Here


        wordList.put(word, wordList.get(word) + 1);
      } else {
        wordList.put(word, 1);
      }
    }
    final MutableDouble result = new MutableDouble(0.0);
   
    wordList.forEachPair(new ObjectIntProcedure<String>() {
     
      @Override
      public boolean apply(String word, int frequency) {
        try {
          result.add(frequency * featureWeight(datastore, label, word));
        } catch (InvalidDatastoreException e) {
          throw new IllegalStateException(e);
        }
        return true;
      }
    });
    return result.doubleValue();
  }
View Full Code Here

        wordList.put(word, wordList.get(word) + 1);
      } else {
        wordList.put(word, 1);
      }
    }
    final MutableDouble result = new MutableDouble(0.0);
   
    wordList.forEachPair(new ObjectIntProcedure<String>() {
     
      @Override
      public boolean apply(String word, int frequency) {
        try {
          result.add(frequency * featureWeight(datastore, label, word));
        } catch (InvalidDatastoreException e) {
          throw new IllegalStateException(e);
        }
        return true;
      }
    });
    return result.doubleValue();
  }
View Full Code Here

        } else {
          wordList.put(term, 1);
        }
      }
    }
    final MutableDouble lengthNormalisationMut = new MutableDouble(0);
    wordList.forEachPair(new ObjectIntProcedure<String>() {
      @Override
      public boolean apply(String word, int dKJ) {
        lengthNormalisationMut.add(dKJ * dKJ);
        return true;
      }
    });
   
    final double lengthNormalisation = Math.sqrt(lengthNormalisationMut.doubleValue());
   
    // Output Length Normalized + TF Transformed Frequency per Word per Class
    // Log(1 + D_ij)/SQRT( SIGMA(k, D_kj) )
    wordList.forEachPair(new ObjectIntProcedure<String>() {
      @Override
View Full Code Here

   */
  public void accumulateStoreMetric(final Map<String, MutableDouble> tmpMap,
      StoreMetricType storeMetricType, double val) {
    final String key = getStoreMetricName(storeMetricType);
    if (tmpMap.get(key) == null) {
      tmpMap.put(key, new MutableDouble(val));
    } else {
      tmpMap.get(key).add(val);
    }

    if (this == ALL_SCHEMA_METRICS) {
      // also compute the max value across all Stores on this server
      final String maxKey = getStoreMetricNameMax(storeMetricType);
      MutableDouble cur = tmpMap.get(maxKey);
      if (cur == null) {
        tmpMap.put(maxKey, new MutableDouble(val));
      } else if (cur.doubleValue() < val) {
        cur.setValue(val);
      }
    } else {
      ALL_SCHEMA_METRICS.accumulateStoreMetric(tmpMap, storeMetricType, val);
    }
  }
View Full Code Here

   */
  public void accumulateStoreMetric(final Map<String, MutableDouble> tmpMap,
      StoreMetricType storeMetricType, double val) {
    final String key = getStoreMetricName(storeMetricType);
    if (tmpMap.get(key) == null) {
      tmpMap.put(key, new MutableDouble(val));
    } else {
      tmpMap.get(key).add(val);
    }

    if (this == ALL_SCHEMA_METRICS) {
      // also compute the max value across all Stores on this server
      final String maxKey = getStoreMetricNameMax(storeMetricType);
      MutableDouble cur = tmpMap.get(maxKey);
      if (cur == null) {
        tmpMap.put(maxKey, new MutableDouble(val));
      } else if (cur.doubleValue() < val) {
        cur.setValue(val);
      }
    } else {
      ALL_SCHEMA_METRICS.accumulateStoreMetric(tmpMap, storeMetricType, val);
    }
  }
View Full Code Here

        } else {
          wordList.put(term, 1);
        }
      }
    }
    final MutableDouble lengthNormalisationMut = new MutableDouble(0.0);
    wordList.forEachPair(new ObjectIntProcedure<String>() {
      @Override
      public boolean apply(String word, int dKJ) {
        long squared = (long) dKJ * (long) dKJ;
        lengthNormalisationMut.add(squared);
        return true;
      }
    });
   
    final double lengthNormalisation = Math.sqrt(lengthNormalisationMut.doubleValue());
   
    // Output Length Normalized + TF Transformed Frequency per Word per Class
    // Log(1 + D_ij)/SQRT( SIGMA(k, D_kj) )
    wordList.forEachPair(new ObjectIntProcedure<String>() {
      @Override
View Full Code Here

                               String[] document) {
    OpenObjectIntHashMap<String> wordList = new OpenObjectIntHashMap<String>(document.length / 2);
    for (String word : document) {
      wordList.adjustOrPutValue(word, 1, 1);
    }
    final MutableDouble result = new MutableDouble(0.0);
   
    wordList.forEachPair(new ObjectIntProcedure<String>() {
      @Override
      public boolean apply(String word, int frequency) {
        try {
          result.add(frequency * featureWeight(datastore, label, word));
        } catch (InvalidDatastoreException e) {
          throw new IllegalStateException(e);
        }
        return true;
      }
    });
    return result.doubleValue();
  }
View Full Code Here

                               String[] document) {
    OpenObjectIntHashMap<String> wordList = new OpenObjectIntHashMap<String>(document.length / 2);
    for (String word : document) {
      wordList.adjustOrPutValue(word, 1, 1);
    }
    final MutableDouble result = new MutableDouble(0.0);
   
    wordList.forEachPair(new ObjectIntProcedure<String>() {
      @Override
      public boolean apply(String word, int frequency) {
        try {
          result.add(frequency * featureWeight(datastore, label, word));
        } catch (InvalidDatastoreException e) {
          throw new IllegalStateException(e);
        }
        return true;
      }
    });
    return result.doubleValue();
  }
View Full Code Here

        wordList.put(word, wordList.get(word) + 1);
      } else {
        wordList.put(word, 1);
      }
    }
    final MutableDouble result = new MutableDouble(0.0);
   
    wordList.forEachPair(new ObjectIntProcedure<String>() {
     
      @Override
      public boolean apply(String word, int frequency) {
        try {
          result.add(frequency * featureWeight(datastore, label, word));
        } catch (InvalidDatastoreException e) {
          throw new IllegalStateException(e);
        }
        return true;
      }
    });
    return result.doubleValue();
  }
View Full Code Here

TOP

Related Classes of org.apache.commons.lang.mutable.MutableDouble

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.