當前位置: 首頁>>代碼示例>>Java>>正文


Java RandomGenerator.nextGaussian方法代碼示例

本文整理匯總了Java中org.apache.commons.math3.random.RandomGenerator.nextGaussian方法的典型用法代碼示例。如果您正苦於以下問題:Java RandomGenerator.nextGaussian方法的具體用法?Java RandomGenerator.nextGaussian怎麽用?Java RandomGenerator.nextGaussian使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.commons.math3.random.RandomGenerator的用法示例。


在下文中一共展示了RandomGenerator.nextGaussian方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: normallyRandomInitialParams

import org.apache.commons.math3.random.RandomGenerator; //導入方法依賴的package包/類
public void normallyRandomInitialParams(double mu, double sigma) {
	RandomGenerator rg = RandomGeneratorFactory.createRandomGenerator(new Random(System.currentTimeMillis()));
	_W = new double[layerNum - 1][][];
	for (int l = 0; l < layerNum - 1; l++) {
		_W[l] = new double[activationLayerNum[l + 1]][];
		for (int i = 0; i < activationLayerNum[l + 1]; i++) {
			_W[l][i] = new double[activationLayerNum[l]];
			for (int j = 0; j < activationLayerNum[l]; j++) {
				// 將原始為mu為0.5,3sigma為0.5的正態分布,轉移到mu,sigma為此處設置的正態分布的隨機值
				_W[l][i][j] = (rg.nextGaussian() - 0.5 + mu) * 6.0 * sigma;
			}
		}
	}

	_B = new double[layerNum - 1];

	for (int l = 0; l < layerNum - 1; l++) {
		_B[l] = (rg.nextGaussian() - 0.5 + mu) * 6.0 * sigma;
	}
}
 
開發者ID:feelingyang,項目名稱:deeplearning-stanford,代碼行數:21,代碼來源:NeuralNetworks.java

示例2: randomVectorF

import org.apache.commons.math3.random.RandomGenerator; //導入方法依賴的package包/類
/**
 * @param features dimension of vector
 * @param random random number generator
 * @return vector whose direction from the origin is chosen uniformly at random, but which is not normalized
 */
public static float[] randomVectorF(int features, RandomGenerator random) {
  float[] vector = new float[features];
  for (int i = 0; i < features; i++) {
    vector[i] = (float) random.nextGaussian();
  }
  return vector;
}
 
開發者ID:oncewang,項目名稱:oryx2,代碼行數:13,代碼來源:VectorMath.java

示例3: generate

import org.apache.commons.math3.random.RandomGenerator; //導入方法依賴的package包/類
@Override
public Pair<String,String> generate(int id, RandomGenerator random) {
  return new Pair<>(Integer.toString(id),
                    id + "," +
                    random.nextInt(100) + ',' +
                    random.nextBoolean() + ',' +
                    random.nextGaussian());
}
 
開發者ID:oncewang,項目名稱:oryx2,代碼行數:9,代碼來源:DefaultCSVDatumGenerator.java

示例4: normal

import org.apache.commons.math3.random.RandomGenerator; //導入方法依賴的package包/類
public static double normal(double mean, double sd) {
	RandomGenerator rg = getInstance().get();
	return rg.nextGaussian()*sd+mean;
}
 
開發者ID:Quanticol,項目名稱:CARMA,代碼行數:5,代碼來源:RandomGeneratorRegistry.java

示例5: generateData

import org.apache.commons.math3.random.RandomGenerator; //導入方法依賴的package包/類
protected static double generateData(final double trueStandardDeviation, final Double cr, final RandomGenerator rng) {
    return cr + rng.nextGaussian() * trueStandardDeviation;
}
 
開發者ID:broadinstitute,項目名稱:gatk-protected,代碼行數:4,代碼來源:CopyRatioSegmenterUnitTest.java


注:本文中的org.apache.commons.math3.random.RandomGenerator.nextGaussian方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。