我正在使用EnumeratedIntegerDistribution從我的密鑰集中生成樣本。如何以編程方式計算離散概率
如何以編程方式計算「離散概率」數組。例如,我可能想要一個近似的「正常」分佈或Zipf分佈。
int[] keys = keyDomain(domainMin, domainMax);
double[] discreteProbabilities = new double[] { ?, ?, ?, ?, .... };
EnumeratedIntegerDistribution distribution = new EnumeratedIntegerDistribution(keys, discreteProbabilities);
int numSamples = 100;
int[] samples = distribution.sample(numSamples);
要離散概率是從正常或Zipf分佈? – paisanco
確定Zipf分佈,所以我想將discreteProbabilities數組設置爲值,這將導致樣本數組確認Zipf的分佈。謝謝(使用時)https://commons.apache.org/proper/commons-math/javadocs/api-3.5/org/apache/commons/math3/distribution/EnumeratedIntegerDistribution.html#EnumeratedIntegerDistribution(int [],double [] ) – dmc