public BinaryMinimalRelativeError(INDArray x, INDArray y, double thresholdRelative, double thresholdAbsolute) { super(x, y, x, x.lengthLong()); this.thresholdRelative = thresholdRelative; this.thresholdAbsolute = thresholdAbsolute; }
/** * Specify an alternative result array * * @param x the input * @param z the output array */ public BaseOp(INDArray x, INDArray z) { this(x, z, x.lengthLong()); }
@Override public void init(INDArray x, INDArray y, INDArray z, long n) { super.init(x, y, z, n); if (x.lengthLong() < n || y.lengthLong() < n || z.lengthLong() < n) throw new IllegalStateException("Mis matched lengths: X: [" + x.lengthLong() + "], Y: [" + y.lengthLong() + "], Z: [" + z.lengthLong() + "], N: [" + n + "]"); this.extraArgs = new Object[] {p, (double) n}; }
public LogNormalDistribution(@NonNull INDArray z, @NonNull INDArray means, double stddev) { if (z.lengthLong() != means.lengthLong()) throw new IllegalStateException("Result length should be equal to provided Means length"); if (means.elementWiseStride() < 1) throw new IllegalStateException("Means array can't have negative EWS"); init(z, means, z, z.lengthLong()); this.mean = 0.0; this.stddev = stddev; this.extraArgs = new Object[] {this.mean, this.stddev}; }
public GaussianDistribution(@NonNull INDArray z, @NonNull INDArray means, double stddev) { if (z.lengthLong() != means.lengthLong()) throw new IllegalStateException("Result length should be equal to provided Means length"); if (means.elementWiseStride() < 1) throw new IllegalStateException("Means array can't have negative EWS"); init(z, means, z, z.lengthLong()); this.mean = 0.0; this.stddev = stddev; this.extraArgs = new Object[] {this.mean, this.stddev}; }
/** * This op fills Z with binomial distribution over given trials with single given probability for all trials * @param z * @param trials * @param probability */ public BinomialDistribution(@NonNull INDArray z, int trials, double probability) { init(z, z, z, z.lengthLong()); this.trials = trials; this.probability = probability; this.extraArgs = new Object[] {(double) this.trials, this.probability}; }
/** * This op fills Z with random values within from...to boundaries * @param z * @param from * @param to */ public UniformDistribution(@NonNull INDArray z, double from, double to) { init(null, null, z, z.lengthLong()); this.from = from; this.to = to; this.extraArgs = new Object[] {this.from, this.to}; }
public Pow(INDArray x, INDArray z, double pow) { super(x, z); this.pow = pow; init(x, null, z, x.lengthLong()); }
private void init() { if (z == null || x == z) init(x, y, x, x.lengthLong()); else init(x, y, z, x.lengthLong()); }
public PowDerivative(INDArray x, INDArray z, double pow) { super(x, z); this.pow = pow; init(x, null, z, x.lengthLong()); }
public PowDerivative(INDArray x, INDArray z, long n, double pow) { super(x, z, n); this.pow = pow; init(x, null, z, x.lengthLong()); }
/** * This op fills Z with binomial distribution over given trials with single given probability for all trials * @param z * @param trials * @param probability */ public BinomialDistributionEx(@NonNull INDArray z, int trials, double probability) { init(z, z, z, z.lengthLong()); this.trials = trials; this.probability = probability; this.extraArgs = new Object[] {(double) this.trials, this.probability}; }
public PowDerivative(INDArray x, double pow) { super(x); this.pow = pow; init(x, null, z, x.lengthLong()); }
/** * This op fills Z with bernoulli trial results, so 0, or 1, depending by common probability * @param z */ public BernoulliDistribution(@NonNull INDArray z, double prob) { init(null, null, z, z.lengthLong()); this.prob = prob; this.extraArgs = new Object[] {this.prob}; }
/** * This op fills Z with random values within stddev..mean..stddev boundaries * @param z * @param mean * @param stddev */ public LogNormalDistribution(@NonNull INDArray z, double mean, double stddev) { init(z, z, z, z.lengthLong()); this.mean = mean; this.stddev = stddev; this.extraArgs = new Object[] {this.mean, this.stddev}; }
public MatchConditionTransform(INDArray x, INDArray z, double eps, @NonNull Condition condition) { super(x, null, z, z.lengthLong()); this.compare = condition.getValue(); this.mode = condition.condtionNum(); this.eps = eps; this.extraArgs = new Object[] {compare, eps, (double) mode}; }
@Override public INDArray divi(Number n, INDArray result) { if (Double.isNaN(n.doubleValue())) n = Nd4j.EPS_THRESHOLD; Nd4j.getExecutioner().exec(new ScalarDivision(this, null, result, result.lengthLong(), n)); if (Nd4j.ENFORCE_NUMERICAL_STABILITY) Nd4j.clearNans(result); return result; }
@Override public INDArray muli(Number n, INDArray result) { if (Double.isNaN(n.doubleValue())) n = Nd4j.EPS_THRESHOLD; Nd4j.getExecutioner().exec(new ScalarMultiplication(this, null, result, result.lengthLong(), n)); if (Nd4j.ENFORCE_NUMERICAL_STABILITY) Nd4j.clearNans(result); return result; }
@Override public INDArray rsubi(Number n, INDArray result) { if (Double.isNaN(n.doubleValue())) n = Nd4j.EPS_THRESHOLD; Nd4j.getExecutioner().exec(new ScalarReverseSubtraction(this, null, result, result.lengthLong(), n)); if (Nd4j.ENFORCE_NUMERICAL_STABILITY) Nd4j.clearNans(result); return result; }
@Override public INDArray subi(Number n, INDArray result) { if (Double.isNaN(n.doubleValue())) n = Nd4j.EPS_THRESHOLD; Nd4j.getExecutioner().exec(new ScalarSubtraction(this, null, result, result.lengthLong(), n)); if (Nd4j.ENFORCE_NUMERICAL_STABILITY) Nd4j.clearNans(result); return result; }