• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java AVLTreeDigest类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了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;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java CompilationUnit类代码示例发布时间:2022-05-22
下一篇:
Java JavaElementImageDescriptor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap