/** Returns matrices of the right size for either binary or unary (terminal) classification */ FloatMatrix randomClassificationMatrix() { // Leave the bias column with 0 values float range = 1.0f / (float) (Math.sqrt((float) numHidden)); FloatMatrix ret = FloatMatrix.zeros(numOuts, numHidden + 1); FloatMatrix insert = MatrixUtil.rand(numOuts, numHidden, -range, range, rng); ret.put(interval(0, numOuts), interval(0, numHidden), insert); return SimpleBlas.scal(scalingForInit, ret); }
FloatMatrix randomTransformBlock() { float range = 1.0f / (float) (Math.sqrt((float) numHidden) * 2.0f); FloatMatrix ret = MatrixUtil.rand(numHidden, numHidden, -range, range, rng).add(identity); return ret; }