com.clearspring.analytics.stream.cardinality.HyperLogLog.linearCounting()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.6k)|赞(0)|评价(0)|浏览(136)

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

HyperLogLog.linearCounting介绍

暂无

代码示例

代码示例来源:origin: addthis/stream-lib

@Override
public long cardinality() {
  double registerSum = 0;
  int count = registerSet.count;
  double zeros = 0.0;
  for (int j = 0; j < registerSet.count; j++) {
    int val = registerSet.get(j);
    registerSum += 1.0 / (1 << val);
    if (val == 0) {
      zeros++;
    }
  }
  double estimate = alphaMM * (1 / registerSum);
  if (estimate <= (5.0 / 2.0) * count) {
    // Small Range Estimate
    return Math.round(linearCounting(count, zeros));
  } else {
    return Math.round(estimate);
  }
}

代码示例来源:origin: addthis/stream-lib

H = HyperLogLog.linearCounting(count, zeros);
} else {
  H = estimatePrime;
return Math.round(HyperLogLog.linearCounting(sm, sm - sparseSet.length));

代码示例来源:origin: com.addthis/stream-lib

@Override
public long cardinality() {
  double registerSum = 0;
  int count = registerSet.count;
  double zeros = 0.0;
  for (int j = 0; j < registerSet.count; j++) {
    int val = registerSet.get(j);
    registerSum += 1.0 / (1 << val);
    if (val == 0) {
      zeros++;
    }
  }
  double estimate = alphaMM * (1 / registerSum);
  if (estimate <= (5.0 / 2.0) * count) {
    // Small Range Estimate
    return Math.round(linearCounting(count, zeros));
  } else {
    return Math.round(estimate);
  }
}

代码示例来源:origin: com.addthis/stream-lib

H = HyperLogLog.linearCounting(count, zeros);
} else {
  H = estimatePrime;
return Math.round(HyperLogLog.linearCounting(sm, sm - sparseSet.length));

相关文章