List of usage examples for java.lang Double NEGATIVE_INFINITY
double NEGATIVE_INFINITY
To view the source code for java.lang Double NEGATIVE_INFINITY.
Click Source Link
From source file:com.rapidminer.gui.plotter.charts.ColorizedLineAndShapeRenderer.java
public ColorizedLineAndShapeRenderer(double[] colorValues) { this.colorValues = colorValues; this.minColor = Double.POSITIVE_INFINITY; this.maxColor = Double.NEGATIVE_INFINITY; if (this.colorValues != null) { for (double d : this.colorValues) { this.minColor = MathFunctions.robustMin(this.minColor, d); this.maxColor = MathFunctions.robustMax(this.maxColor, d); }// w w w. ja va 2 s .co m } }
From source file:com.insightml.math.distributions.AbstractGaussian.java
@Override public final String toStringInterval(final int precision) { return toStringInterval(this, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY, 2, precision); }
From source file:ch.zweivelo.renderer.simple.math.RayTest.java
@Test public void testIsValidT() throws Exception { assertTrue(ray.isValidT(EPSILON));/*from w w w . j a v a 2 s . c o m*/ assertTrue(ray.isValidT(1d)); assertTrue(ray.isValidT(10d)); assertTrue(ray.isValidT(100d)); assertTrue(ray.isValidT(1000d)); assertTrue(ray.isValidT(EPSIPON_MAX)); assertFalse(ray.isValidT(0d)); assertFalse(ray.isValidT(-1d)); assertFalse(ray.isValidT(-100000d)); assertFalse(ray.isValidT(Double.NaN)); assertFalse(ray.isValidT(Double.POSITIVE_INFINITY)); assertFalse(ray.isValidT(Double.NEGATIVE_INFINITY)); }
From source file:jurls.core.approximation.WeightedInterpolationFunction.java
public WeightedInterpolationFunction(int numInputs, int numPoints, double power) { this.numPoints = numPoints; this.power = power; minInput.set(Double.POSITIVE_INFINITY); maxInput.set(Double.NEGATIVE_INFINITY); points = new Point[numPoints]; for (int i = 0; i < numPoints; ++i) { points[i] = new Point(); }//from ww w. j ava 2 s .c o m }
From source file:com.opengamma.analytics.math.statistics.distribution.BivariateNormalDistribution.java
/** * @param x The parameters for the function, $(x, y, \rho$, with $-1 \geq \rho \geq 1$, not null * @return The cdf/*from w w w . ja va 2 s. co m*/ */ @Override public double getCDF(final double[] x) { Validate.notNull(x); Validate.isTrue(x.length == 3, "Need a, b and rho values"); Validate.isTrue(x[2] >= -1 && x[2] <= 1, "Correlation must be >= -1 and <= 1"); final double a = x[0]; double b = x[1]; final double rho = x[2]; if (a == Double.POSITIVE_INFINITY || b == Double.POSITIVE_INFINITY) { return 1; } if (a == Double.NEGATIVE_INFINITY || b == Double.NEGATIVE_INFINITY) { return 0; } final double sumSq = (a * a + b * b) / 2.; double rho1, rho2, rho3, ab, absDiff, h5, c, d, mult = 0, rho3Sq, eab, e, result; if (Math.abs(rho) >= 0.7) { rho1 = 1 - rho * rho; rho2 = Math.sqrt(rho1); if (rho < 0) { b *= -1; } ab = a * b; eab = Math.exp(-ab / 2.); if (Math.abs(rho) < 1) { absDiff = Math.abs(a - b); h5 = absDiff * absDiff / 2.; absDiff = absDiff / rho2; c = 0.5 - ab / 8.; d = 3. - 2. * c * h5; mult = 0.13298076 * absDiff * d * (1 - NORMAL.getCDF(absDiff)) - Math.exp(-h5 / rho1) * (d + c * rho1) * 0.053051647; for (int i = 0; i < 5; i++) { rho3 = rho2 * X[i]; rho3Sq = rho3 * rho3; rho1 = Math.sqrt(1 - rho3Sq); if (eab == 0) { e = 0; } else { e = Math.exp(-ab / (1 + rho1)) / rho1 / eab; } mult = mult - Y[i] * Math.exp(-h5 / rho3Sq) * (e - 1 - c * rho3Sq); } } result = mult * rho2 * eab + NORMAL.getCDF(Math.min(a, b)); if (rho < 0) { result = NORMAL.getCDF(a) - result; } return result; } ab = a * b; if (rho != 0) { for (int i = 0; i < 5; i++) { rho3 = rho * X[i]; rho1 = 1 - rho3 * rho3; mult = mult + Y[i] * Math.exp((rho3 * ab - sumSq) / rho1) / Math.sqrt(rho1); } } return NORMAL.getCDF(a) * NORMAL.getCDF(b) + rho * mult; }
From source file:com.insightml.data.features.stats.FeatureStatistics.java
public FeatureStatistics(final ISamples<?, Double> instances, final int labelIndex) { this.instances = instances; this.labelIndex = labelIndex; final String[] featureNames = this.instances.featureNames(); final double[][] feats = this.instances.features(); final IntSumMapBuilder<CharSequence> nan = IntSumMap.builder(false, 16); for (int i = 0; i < this.instances.size(); ++i) { for (int j = 0; j < featureNames.length; ++j) { final double value = feats[i][j]; if (Double.isNaN(value) || value == Double.NEGATIVE_INFINITY) { nan.increment(featureNames[j], 1); } else { stats.getOrLoad(featureNames[j]).addValue(value); }//from w w w. j a v a 2 s. com } } nans = nan.build(0); }
From source file:jeans.math.SingleStat.java
public SingleStat() { m_Min = Double.POSITIVE_INFINITY; m_Max = Double.NEGATIVE_INFINITY; }
From source file:ml.shifu.shifu.core.binning.NativeBinning.java
@Override public List<Double> getDataBin() { QuickSort.sort(array);// w w w . j a va 2 s . c o m int actualBinSize = (int) Math.ceil((double) array.size() / (double) expectedBinningNum); int actualBiningNum = this.expectedBinningNum; List<Double> binBoundary = new ArrayList<Double>(); binBoundary.add(Double.NEGATIVE_INFINITY); double prevData = array.get(0); int currBinSize = 0; int currBinIndex = 0; for (int i = 0; i < array.size(); i++) { double currData = array.get(i); currBinSize++; if (currBinSize >= actualBinSize) { if (currBinIndex == actualBiningNum - 1 && i != array.size() - 1) { continue; } if (i == 0 || (mergeEnabled == true && Math.abs(currData - prevData) > EPS) || mergeEnabled == false) { if (i == array.size() - 1) { break; } currBinIndex++; currBinSize = 0; binBoundary.add(currData); } } prevData = currData; } // binBoundary.set(binBoundary.size() - 1, Double.POSITIVE_INFINITY); return binBoundary; }
From source file:edu.byu.nlp.stats.VectorCategoricalDistribution.java
/** {@inheritDoc} */ @Override/*from www .java2s .c o m*/ public double entropy() { double entropy = 0.0; // TODO(rhaertel): when Apache fixes their iterator, then use that. for (int i = 0; i < logProbs.getDimension(); i++) { double logProb = logProbs.getEntry(i); if (logProb > Double.NEGATIVE_INFINITY) { entropy -= Math.exp(logProb) * logProb; } } return entropy; }
From source file:eu.amidst.core.utils.Utils.java
/** * Returns the index of the maximum element in a given vector. * @param vector a {@link Vector} object. * @return an {@code int} that represents the index of the maximum element in the vector. *//* w w w.j ava 2 s .c om*/ public static int maxIndex(Vector vector) { double max = Double.NEGATIVE_INFINITY; int index = -1; for (int i = 0; i < vector.size(); i++) { if (vector.get(i) > max) { max = vector.get(i); index = i; } } if (index == -1) throw new IllegalStateException("There is no maximum. Probably a NaN value."); return index; }