gpt4 book ai didi

com.facebook.LinkBench.distributions.ZipfDistribution类的使用及代码示例

转载 作者:知者 更新时间:2024-03-13 12:35:55 25 4
gpt4 key购买 nike

本文整理了Java中com.facebook.LinkBench.distributions.ZipfDistribution类的一些代码示例,展示了ZipfDistribution类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZipfDistribution类的具体详情如下:
包路径:com.facebook.LinkBench.distributions.ZipfDistribution
类名称:ZipfDistribution

ZipfDistribution介绍

暂无

代码示例

代码示例来源:origin: facebookarchive/linkbench

/**
 * Algorithm from "Quickly Generating Billion-Record Synthetic Databases",
 * Gray et. al., 1994
 *
 * Pick a value in range [min, max) according to zipf distribution,
 * with min being the most likely to be chosen
 */
@Override
public long choose(Random rng) {
 return quantile(rng.nextDouble());
}

代码示例来源:origin: facebookarchive/linkbench

@Override
public double pdf(long id) {
 return scaledPDF(id, 1.0);
}

代码示例来源:origin: facebookarchive/linkbench

@Test
public void testZipf() {
 ZipfDistribution z = new ZipfDistribution();
 Properties props = new Properties();
 props.setProperty("shape", "0.5");
 int min = 100, max = 200;
 z.init(min, max, props, "");
 ProbAccessDistribution unshuffled = new ProbAccessDistribution(z, null);
 testSanityAccessDist(unshuffled, min, max);
 ProbAccessDistribution shuffled = new ProbAccessDistribution(z,
           new InvertibleShuffler(13, 25, max - min));
 testSanityAccessDist(shuffled, min, max);
}

代码示例来源:origin: facebookarchive/linkbench

@Override
public ProbabilityDistribution getDist() {
 return new ZipfDistribution();
}

代码示例来源:origin: facebookarchive/linkbench

private double calcZetan(long n) {
 if (n < MIN_CACHE_VALUE) {
  return uncachedCalcZetan(n);
 }
 synchronized(ZipfDistribution.class) {
  for (int i = 0; i < zetanCache.size(); i++) {
   CacheEntry ce = zetanCache.get(i);
   if (ce.n == n && ce.shape == shape) {
    return ce.zetan;
   }
  }
 }
 double calcZetan = uncachedCalcZetan(n);
 synchronized (ZipfDistribution.class) {
  CacheEntry ce = new CacheEntry();
  ce.zetan = calcZetan;
  ce.n = n;
  ce.shape = shape;
  if (zetanCache.size() >= MAX_CACHE_ENTRIES) {
   zetanCache.remove(0);
  }
  zetanCache.add(ce);
 }
 return calcZetan;
}

代码示例来源:origin: facebookarchive/linkbench

zetan = calcZetan(n);
eta = (1 - FastMath.pow(2.0 / n, 1 - shape)) /
   (1 - Harmonic.generalizedHarmonic(2, shape) / zetan);

代码示例来源:origin: facebookarchive/linkbench

@Override
public double expectedCount(long id) {
 return scaledPDF(id, scale);
}

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com