Search in sources :

Example 6 with AtomicDouble

use of com.google.common.util.concurrent.AtomicDouble in project aic-praise by aic-sri-international.

the class AbstractUAI_to_HOGMv1_Translator method calculateCompressedEntries.

private static double calculateCompressedEntries(Expression compressedTableExpression) {
    AtomicDouble count = new AtomicDouble(0);
    visitCompressedTableEntries(compressedTableExpression, count);
    return count.doubleValue();
}
Also used : AtomicDouble(com.google.common.util.concurrent.AtomicDouble)

Example 7 with AtomicDouble

use of com.google.common.util.concurrent.AtomicDouble in project aic-praise by aic-sri-international.

the class UAIMARSolver method calculateCompressedEntries.

private static double calculateCompressedEntries(Expression compressedTableExpression) {
    AtomicDouble count = new AtomicDouble(0);
    visitCompressedTableEntries(compressedTableExpression, count);
    return count.doubleValue();
}
Also used : AtomicDouble(com.google.common.util.concurrent.AtomicDouble)

Example 8 with AtomicDouble

use of com.google.common.util.concurrent.AtomicDouble in project cdap by caskdata.

the class LogSamplers method exponentialLimit.

/**
   * Returns a {@link LogSampler} that accepts once on every N calls, with N exponentially increased from
   * an initial value to a max value.
   */
public static LogSampler exponentialLimit(final int initialCount, final int maxCount, final double multiplier) {
    Preconditions.checkArgument(initialCount > 0, "Initial count must be >= 0");
    Preconditions.checkArgument(maxCount > 0, "Max count must be >= 0");
    Preconditions.checkArgument(multiplier >= 1.0d, "Multiplier must be >= 1.0");
    final AtomicDouble modular = new AtomicDouble(initialCount);
    return new CountBasedLogSampler() {

        @Override
        protected boolean accept(String message, int logLevel, long callCount) {
            double mod = modular.get();
            if (((callCount - 1) % Math.ceil(mod)) == 0) {
                modular.compareAndSet(mod, Math.min(mod * multiplier, maxCount));
                return true;
            }
            return false;
        }
    };
}
Also used : AtomicDouble(com.google.common.util.concurrent.AtomicDouble)

Aggregations

AtomicDouble (com.google.common.util.concurrent.AtomicDouble)8 DataPoint (org.deeplearning4j.clustering.sptree.DataPoint)2 INDArray (org.nd4j.linalg.api.ndarray.INDArray)2 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 ImmutableList (com.google.common.collect.ImmutableList)1 AtomicInteger (java.util.concurrent.atomic.AtomicInteger)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1 SpTree (org.deeplearning4j.clustering.sptree.SpTree)1 DefaultGradient (org.deeplearning4j.nn.gradient.DefaultGradient)1 Gradient (org.deeplearning4j.nn.gradient.Gradient)1 Test (org.junit.Test)1