public void normalizedInitializationSigmoid(int fanin, int fanout) { double max = 4 * Math.sqrt(6.0d / (fanin + fanout)); double[][] featuresMatrixStub = new double[inputSize][outputSize]; RandomUtils.initializeRandomMatrix(featuresMatrixStub, -max, max, 1); features = Nd4j.create(featuresMatrixStub); featuresT = features.transpose(); }
public INDArray genGaussianNoise(int id) { if (!currentNoise.containsKey(id)) { INDArray zeroMean = Nd4j.zeros(inputSize, outputSize); currentNoise.put(id, Sampling.normal(RandomUtils.getRandomGenerator(id), zeroMean, noiseVar)); } else { RealDistribution reals = new NormalDistribution( RandomUtils.getRandomGenerator(id), 0, noiseVarSqrt, NormalDistribution.DEFAULT_INVERSE_ABSOLUTE_ACCURACY); INDArrayUtils.shiftLeft( currentNoise.get(id), inputSize, outputSize, RandomUtils.getRandomGenerator(id).nextInt(inputSize * outputSize), reals.sample()); } // currentNoise = Sampling.normal(RandomUtils.getRandomGenerator(id), zeroMean, noiseVar); return currentNoise.get(id); }
public void initializeUniform(double min, double max) { double[][] featuresMatrixStub = new double[inputSize][outputSize]; RandomUtils.initializeRandomMatrix(featuresMatrixStub, min, max, 1); features = Nd4j.create(featuresMatrixStub); featuresT = features.transpose(); }