gpt4 book ai didi

org.apache.commons.math3.distribution.ZipfDistribution.generalizedHarmonic()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 06:32:49 32 4
gpt4 key购买 nike

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

ZipfDistribution.generalizedHarmonic介绍

[英]Calculates the Nth generalized harmonic number. See Harmonic Series.
[中]计算第n个广义调和数。见Harmonic Series

代码示例

代码示例来源:origin: org.apache.commons/commons-math3

/** {@inheritDoc} */
public double cumulativeProbability(final int x) {
  if (x <= 0) {
    return 0.0;
  } else if (x >= numberOfElements) {
    return 1.0;
  }
  return generalizedHarmonic(x, exponent) / generalizedHarmonic(numberOfElements, exponent);
}

代码示例来源:origin: org.apache.commons/commons-math3

/**
 * Used by {@link #getNumericalVariance()}.
 *
 * @return the variance of this distribution
 */
protected double calculateNumericalVariance() {
  final int N = getNumberOfElements();
  final double s = getExponent();
  final double Hs2 = generalizedHarmonic(N, s - 2);
  final double Hs1 = generalizedHarmonic(N, s - 1);
  final double Hs = generalizedHarmonic(N, s);
  return (Hs2 / Hs) - ((Hs1 * Hs1) / (Hs * Hs));
}

代码示例来源:origin: org.apache.commons/commons-math3

/**
 * Used by {@link #getNumericalMean()}.
 *
 * @return the mean of this distribution
 */
protected double calculateNumericalMean() {
  final int N = getNumberOfElements();
  final double s = getExponent();
  final double Hs1 = generalizedHarmonic(N, s - 1);
  final double Hs = generalizedHarmonic(N, s);
  return Hs1 / Hs;
}

代码示例来源:origin: org.apache.commons/commons-math3

/** {@inheritDoc} */
public double probability(final int x) {
  if (x <= 0 || x > numberOfElements) {
    return 0.0;
  }
  return (1.0 / FastMath.pow(x, exponent)) / generalizedHarmonic(numberOfElements, exponent);
}

代码示例来源:origin: org.apache.commons/commons-math3

/** {@inheritDoc} */
@Override
public double logProbability(int x) {
  if (x <= 0 || x > numberOfElements) {
    return Double.NEGATIVE_INFINITY;
  }
  return -FastMath.log(x) * exponent - FastMath.log(generalizedHarmonic(numberOfElements, exponent));
}

代码示例来源:origin: geogebra/geogebra

/** {@inheritDoc} */
public double cumulativeProbability(final int x) {
  if (x <= 0) {
    return 0.0;
  } else if (x >= numberOfElements) {
    return 1.0;
  }
  return generalizedHarmonic(x, exponent) / generalizedHarmonic(numberOfElements, exponent);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/** {@inheritDoc} */
public double cumulativeProbability(final int x) {
  if (x <= 0) {
    return 0.0;
  } else if (x >= numberOfElements) {
    return 1.0;
  }
  return generalizedHarmonic(x, exponent) / generalizedHarmonic(numberOfElements, exponent);
}

代码示例来源:origin: geogebra/geogebra

/** {@inheritDoc} */
public double probability(final int x) {
  if (x <= 0 || x > numberOfElements) {
    return 0.0;
  }
  return (1.0 / Math.pow(x, exponent)) / generalizedHarmonic(numberOfElements, exponent);
}

代码示例来源:origin: geogebra/geogebra

/** {@inheritDoc} */
@Override
public double logProbability(int x) {
  if (x <= 0 || x > numberOfElements) {
    return Double.NEGATIVE_INFINITY;
  }
  return -Math.log(x) * exponent - Math.log(generalizedHarmonic(numberOfElements, exponent));
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Used by {@link #getNumericalVariance()}.
 *
 * @return the variance of this distribution
 */
protected double calculateNumericalVariance() {
  final int N = getNumberOfElements();
  final double s = getExponent();
  final double Hs2 = generalizedHarmonic(N, s - 2);
  final double Hs1 = generalizedHarmonic(N, s - 1);
  final double Hs = generalizedHarmonic(N, s);
  return (Hs2 / Hs) - ((Hs1 * Hs1) / (Hs * Hs));
}

代码示例来源:origin: geogebra/geogebra

/**
 * Used by {@link #getNumericalVariance()}.
 *
 * @return the variance of this distribution
 */
protected double calculateNumericalVariance() {
  final int N = getNumberOfElements();
  final double s = getExponent();
  final double Hs2 = generalizedHarmonic(N, s - 2);
  final double Hs1 = generalizedHarmonic(N, s - 1);
  final double Hs = generalizedHarmonic(N, s);
  return (Hs2 / Hs) - ((Hs1 * Hs1) / (Hs * Hs));
}

代码示例来源:origin: geogebra/geogebra

/**
 * Used by {@link #getNumericalMean()}.
 *
 * @return the mean of this distribution
 */
protected double calculateNumericalMean() {
  final int N = getNumberOfElements();
  final double s = getExponent();
  final double Hs1 = generalizedHarmonic(N, s - 1);
  final double Hs = generalizedHarmonic(N, s);
  return Hs1 / Hs;
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/** {@inheritDoc} */
public double probability(final int x) {
  if (x <= 0 || x > numberOfElements) {
    return 0.0;
  }
  return (1.0 / FastMath.pow(x, exponent)) / generalizedHarmonic(numberOfElements, exponent);
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/**
 * Used by {@link #getNumericalMean()}.
 *
 * @return the mean of this distribution
 */
protected double calculateNumericalMean() {
  final int N = getNumberOfElements();
  final double s = getExponent();
  final double Hs1 = generalizedHarmonic(N, s - 1);
  final double Hs = generalizedHarmonic(N, s);
  return Hs1 / Hs;
}

代码示例来源:origin: io.virtdata/virtdata-lib-realer

/** {@inheritDoc} */
@Override
public double logProbability(int x) {
  if (x <= 0 || x > numberOfElements) {
    return Double.NEGATIVE_INFINITY;
  }
  return -FastMath.log(x) * exponent - FastMath.log(generalizedHarmonic(numberOfElements, exponent));
}

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