当前位置: 首页>>代码示例>>Java>>正文


Java AVLTreeDigest类代码示例

本文整理汇总了Java中com.tdunning.math.stats.AVLTreeDigest的典型用法代码示例。如果您正苦于以下问题:Java AVLTreeDigest类的具体用法?Java AVLTreeDigest怎么用?Java AVLTreeDigest使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


AVLTreeDigest类属于com.tdunning.math.stats包,在下文中一共展示了AVLTreeDigest类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: read

import com.tdunning.math.stats.AVLTreeDigest; //导入依赖的package包/类
@Override
public void read(Kryo kryo, Input input) {
  int digestSize = input.readInt();
  byte[] digestBytes = input.readBytes(digestSize);
  ByteBuffer digestBuff = ByteBuffer.wrap(digestBytes);
  digest = AVLTreeDigest.fromBytes(digestBuff);
  n = input.readLong();
  sum = input.readDouble();
  sumOfSquares = input.readDouble();
  sumOfLogs = input.readDouble();
  min = input.readDouble();
  max = input.readDouble();
  M1 = input.readDouble();
  M2 = input.readDouble();
  M3 = input.readDouble();
  M4 = input.readDouble();
}
 
开发者ID:apache,项目名称:metron,代码行数:18,代码来源:OnlineStatisticsProvider.java

示例2: addIntermediary

import com.tdunning.math.stats.AVLTreeDigest; //导入依赖的package包/类
@Override
public void addIntermediary(IntermediaryResultValueIterator intermediary) {
  Long otherComplete = (Long) intermediary.next();
  if (otherComplete == 1L) {
    // only add state if we received some state where the other instance was "complete", i.e. this is the final result
    // of a single other instance of this function. We will not have to remove this state again (we wouldn't be able
    // to anyway).
    SerializedAVLTreeDigest serialized = (SerializedAVLTreeDigest) intermediary.next();
    AVLTreeDigest other = AVLTreeDigest.fromBytes(ByteBuffer.wrap(serialized.getSerialized()));
    tdigest.add(other);
  }
}
 
开发者ID:diqube,项目名称:diqube,代码行数:13,代码来源:QuantileLongFunction.java

示例3: peekLength

import com.tdunning.math.stats.AVLTreeDigest; //导入依赖的package包/类
public int peekLength(ByteBuffer in) {
    int mark = in.position();
    AVLTreeDigest.fromBytes(in);
    int total = in.position() - mark;
    in.position(mark);
    return total;
}
 
开发者ID:apache,项目名称:kylin,代码行数:8,代码来源:PercentileCounter.java

示例4: setup

import com.tdunning.math.stats.AVLTreeDigest; //导入依赖的package包/类
@Override
public void setup() {
    ExecutorService pool = Executors.newFixedThreadPool(1);
    BlockingQueue<State> q = new ArrayBlockingQueue<>(2000);
    input = q;
    pool.submit(new Producer(q));
    speedDistribution = new AVLTreeDigest(300);
    noise = new Random();

    speed = new Stripchart(10, 430, 460, 80, 1, 0, 0, 90);
    rpm = new Stripchart(10, 520, 460, 80, 1, 0, 0, 2200);
    throttle = new Stripchart(10, 610, 460, 80, 1, 0, 0, 100);

    frameRate(15);
}
 
开发者ID:tdunning,项目名称:log-synth,代码行数:16,代码来源:Trails.java

示例5: OnlineStatisticsProvider

import com.tdunning.math.stats.AVLTreeDigest; //导入依赖的package包/类
public OnlineStatisticsProvider() {
  digest = new AVLTreeDigest(COMPRESSION);
}
 
开发者ID:apache,项目名称:metron,代码行数:4,代码来源:OnlineStatisticsProvider.java

示例6: readRegisters

import com.tdunning.math.stats.AVLTreeDigest; //导入依赖的package包/类
public void readRegisters(ByteBuffer in) {
    registers = AVLTreeDigest.fromBytes(in);
    compression = registers.compression();
}
 
开发者ID:apache,项目名称:kylin,代码行数:5,代码来源:PercentileCounter.java

示例7: create

import com.tdunning.math.stats.AVLTreeDigest; //导入依赖的package包/类
@Override
TDigest create(double compression) {
    return new AVLTreeDigest(compression);
}
 
开发者ID:tdunning,项目名称:t-digest-benchmark,代码行数:5,代码来源:TDigestBench.java

示例8: create

import com.tdunning.math.stats.AVLTreeDigest; //导入依赖的package包/类
TDigest create(double compression) {
    return new AVLTreeDigest(compression);
}
 
开发者ID:tdunning,项目名称:t-digest,代码行数:4,代码来源:Util.java

示例9: testBasics

import com.tdunning.math.stats.AVLTreeDigest; //导入依赖的package包/类
@Test
public void testBasics() throws IOException {
    // this sampler has four variables
    // g1 is gamma distributed with alpha = 0.2, beta = 0.2
    // v1 is unit normal
    // v2 is normal with mean = 0, sd = 2
    // v3 is gamma-normal with dof=2, mean = 0.
    SchemaSampler s = new SchemaSampler(Resources.asCharSource(Resources.getResource("schema015.json"), Charsets.UTF_8).read());

    TDigest tdG1 = new AVLTreeDigest(500);
    TDigest tdG2 = new AVLTreeDigest(500);
    TDigest td1 = new AVLTreeDigest(500);
    TDigest td2 = new AVLTreeDigest(500);
    TDigest td3 = new AVLTreeDigest(500);

    double x1 = 0;
    double x2 = 0;
    double x3 = 0;

    for (int i = 0; i < 1000000; i++) {
        JsonNode r = s.sample();
        tdG1.add(r.get("g1").asDouble());
        tdG2.add(r.get("g2").asDouble());

        double step1 = r.get("v1").get("step").asDouble();
        td1.add(step1);
        x1 += step1;
        assertEquals(x1, r.get("v1").get("value").asDouble(), 0);
        assertEquals(x1, r.get("v1-bare").asDouble(), 0);

        double step2 = r.get("v2").get("step").asDouble();
        td2.add(step2);
        x2 += step2;
        assertEquals(x2, r.get("v2").get("value").asDouble(), 0);

        double step3 = r.get("v3").get("step").asDouble();
        td3.add(step3);
        x3 += step3;
        assertEquals(x3, r.get("v3").get("value").asDouble(), 0);
    }

    // now compare against reference distributions to test accuracy of the observed step distributions
    NormalDistribution normalDistribution = new NormalDistribution();
    GammaDistribution gd1 = new GammaDistribution(0.2, 5);
    GammaDistribution gd2 = new GammaDistribution(1, 1);
    TDistribution tDistribution = new TDistribution(2);
    for (double q : new double[]{0.001, 0.01, 0.1, 0.2, 0.5, 0.8, 0.9, 0.99, 0.99}) {
        double uG1 = gd1.cumulativeProbability(tdG1.quantile(q));
        assertEquals(q, uG1, (1 - q) * q * 10e-2);

        double uG2 = gd2.cumulativeProbability(tdG2.quantile(q));
        assertEquals(q, uG2, (1 - q) * q * 10e-2);

        double u1 = normalDistribution.cumulativeProbability(td1.quantile(q));
        assertEquals(q, u1, (1 - q) * q * 10e-2);

        double u2 = normalDistribution.cumulativeProbability(td2.quantile(q) / 2);
        assertEquals(q, u2, (1 - q) * q * 10e-2);

        double u3 = tDistribution.cumulativeProbability(td3.quantile(q));
        assertEquals(q, u3, (1 - q) * q * 10e-2);
    }
}
 
开发者ID:tdunning,项目名称:log-synth,代码行数:64,代码来源:RandomWalkSamplerTest.java


注:本文中的com.tdunning.math.stats.AVLTreeDigest类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。