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:edu.oregonstate.eecs.mcplan.bandit.HeuristicBandit.java
@Override protected final int selectArm(final RandomGenerator rng) { int istar = 0; double hstar = Double.NEGATIVE_INFINITY; for (int i = 0; i < Narms(); ++i) { final double h = heuristic(i); if (h > hstar) { hstar = h;//from w ww. j a v a 2 s .c om istar = i; } if (h == Double.POSITIVE_INFINITY) { // Since POSITIVE_INFINITY > POSITIVE_INFINITY is false, no // other arm can replace istar in the future. break; } } return istar; }
From source file:jasima.core.random.continuous.DblNormal.java
@Override public Pair<Double, Double> getValueRange() { return new Pair<>(Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); }
From source file:com.golemgame.functional.functions.KnottedFunctionView.java
@Override public UnivariateRealFunction getFunction() { CollectionType xKnots = interpreter.getXKnots(); CollectionType yKnots = interpreter.getYKnots(); int size = Math.min(xKnots.getValues().size(), yKnots.getValues().size()); double[] xs = new double[size]; double[] ys = new double[size]; for (int i = 0; i < size; i++) { DataType x = xKnots.getElement(i); DataType y = yKnots.getElement(i); if (y.getType() == DataType.Type.DOUBLE && x.getType() == DataType.Type.DOUBLE) { xs[i] = ((DoubleType) x).getValue(); ys[i] = ((DoubleType) y).getValue(); } else/* w w w. j av a 2s. c om*/ xs[i] = Double.NEGATIVE_INFINITY; } return LinearInterpolator.getInstance().interpolate(xs, ys); }
From source file:com.clust4j.kernel.CircularKernel.java
@Override public double getPartialSimilarity(double[] a, double[] b) { final double lp = toHilbertPSpace(a, b); // Per corner case condition if (lp >= getSigma()) return 0.0; final double twoOverPi = (2d / FastMath.PI); final double lpOverSig = lp / getSigma(); /* Front segment */ final double front = twoOverPi * FastMath.acos(-lpOverSig); /* Back segment */ final double first = twoOverPi * lpOverSig; final double second = FastMath.sqrt(1.0 - FastMath.pow(lpOverSig, 2)); final double back = first * second; final double answer = front - back; return Double.isNaN(answer) ? Double.NEGATIVE_INFINITY : answer; }
From source file:jeans.math.SingleStat.java
public void reset() { m_Sum = 0.0;/*from www . j a v a 2 s . c om*/ m_SumSQ = 0.0; m_Count = 0.0; m_Min = Double.POSITIVE_INFINITY; m_Max = Double.NEGATIVE_INFINITY; // m_Distribution = null; }
From source file:hyperheuristics.algorithm.moeadfrrmab.UCBSelector.java
public LowLevelHeuristic selectOperator(HashMap<String, Double> frr, HashMap<String, Integer> nt) { if (!this.alltried) { for (int i = 0; i < this.operators.size(); i++) { LowLevelHeuristic op = this.operators.get(i); if (nt.get(op.getName()) == 0) { //never tried return op; }//from w ww . j a va2s .co m } this.alltried = true; } ArrayList<Integer> selected = new ArrayList<>(); double biggervalue = Double.NEGATIVE_INFINITY; double sumNt = this.sumNt(nt); for (int i = 0; i < this.operators.size(); i++) { LowLevelHeuristic op = this.operators.get(i); double value = this.equation(op, frr, nt, sumNt); if (value > biggervalue) { biggervalue = value; selected = new ArrayList<>(); selected.add(i); } else if (value == biggervalue) { selected.add(i); } } Random rand = new Random(); int p = rand.nextInt(selected.size()); int select = selected.get(p); LowLevelHeuristic llh = this.operators.get(select); return llh; }
From source file:ch.ethz.bsse.quasirecomb.model.hmm.EM.java
private void blackbox(Read[] reads, int N, int L, int K, int n) { Globals.getINSTANCE().setLOG(new StringBuilder()); Globals.getINSTANCE().setMAX_LLH(-1); Globals.getINSTANCE().setMIN_BIC(Double.MAX_VALUE); String pathOptimum = null;//from w w w.j a v a2 s . com if (K == 1 || Globals.getINSTANCE().isFORCE_NO_RECOMB()) { Globals.getINSTANCE().setNO_RECOMB(true); } else { Globals.getINSTANCE().setNO_RECOMB(false); } if (Globals.getINSTANCE().getOPTIMUM() == null) { double maxLLH = Double.NEGATIVE_INFINITY; bics = new Double[Globals.getINSTANCE().getREPEATS()]; double[] bics_local = new double[Globals.getINSTANCE().getREPEATS()]; for (int i = 0; i < Globals.getINSTANCE().getREPEATS(); i++) { SingleEM sem = new SingleEM(N, K, L, n, reads, Globals.getINSTANCE().getDELTA_LLH(), i); bics_local[i] = sem.getOptimalResult().getBIC(); bics[i] = sem.getOptimalResult().getBIC(); this.maxBIC = Math.max(this.maxBIC, sem.getOptimalResult().getBIC()); if (sem.getLoglikelihood() > maxLLH) { maxLLH = sem.getLoglikelihood(); pathOptimum = sem.getOptimumPath(); } } medianBIC = new Median().evaluate(bics_local); lowerBoundBIC = medianBIC - new StandardDeviation().evaluate(bics_local) * Math.sqrt(1 + 1d / bics_local.length); } else { pathOptimum = Globals.getINSTANCE().getOPTIMUM(); } if (Globals.getINSTANCE().isMODELSELECTION()) { try { FileInputStream fis = new FileInputStream(pathOptimum); try (ObjectInputStream in = new ObjectInputStream(fis)) { or = (OptimalResult) in.readObject(); } } catch (IOException | ClassNotFoundException ex) { System.err.println(ex); } StatusUpdate.getINSTANCE().printBIC(K, (int) or.getBIC()); } else { try { FileInputStream fis = new FileInputStream(pathOptimum); try (ObjectInputStream in = new ObjectInputStream(fis)) { or = (OptimalResult) in.readObject(); } } catch (IOException | ClassNotFoundException ex) { System.err.println(ex); } StatusUpdate.getINSTANCE().printBIC(K, (int) or.getBIC()); System.out.print("\n"); if (!Globals.getINSTANCE().isSUBSAMPLE()) { // Globals.getINSTANCE().setREFINEMENT(true); if (!Globals.getINSTANCE().isANNEALING()) { SingleEM bestEM = new SingleEM(or, Globals.getINSTANCE().getDELTA_REFINE_LLH(), reads); this.or = bestEM.getOptimalResult(); } StatusUpdate.getINSTANCE().printBIC(K, 100, (int) this.or.getBIC()); if (Globals.getINSTANCE().isLOGGING()) { Utils.saveFile(Globals.getINSTANCE().getSAVEPATH() + "support" + File.separator + "log_K" + K, Globals.getINSTANCE().getLOG().toString()); } } } }
From source file:edu.byu.nlp.stats.VectorCategoricalDistributionTest.java
@Test public void testLogProbabilityOf() { double[] logProbs = new double[] { log(0.7), log(0.0), log(0.3) }; VectorCategoricalDistribution dist = new VectorCategoricalDistribution(new ArrayRealVector(logProbs)); assertThat(dist.logProbabilityOf(0)).isEqualTo(logProbs[0], Delta.delta(1e-14)); assertThat(dist.logProbabilityOf(1)).isEqualTo(Double.NEGATIVE_INFINITY, Delta.delta(1e-14)); assertThat(dist.logProbabilityOf(2)).isEqualTo(logProbs[2], Delta.delta(1e-14)); try {//from ww w . j a v a 2 s . c o m dist.logProbabilityOf(3); } catch (Exception expected) { } // TODO(rhaertel): more specific exception }
From source file:ml.shifu.core.di.builtin.binning.MunroPatBinning.java
/** * set min/max, merge same bins/*ww w. ja va 2s .c o m*/ * * @param bins * @return */ private List<Double> binMerge(List<Double> bins) { List<Double> newBins = new ArrayList<Double>(); if (bins.size() == 0) { bins.add(Double.NaN); return bins; } Double cur = bins.get(0); newBins.add(cur); int i = 1; while (i < bins.size()) { if (Math.abs(cur - bins.get(i)) > 1e-10) { newBins.add(bins.get(i)); } cur = bins.get(i); i++; } if (newBins.size() == 1) { // special case since there is only 1 candidate in the bins double val = newBins.get(0); newBins = Arrays.asList(Double.NEGATIVE_INFINITY, val); } else if (newBins.size() == 2) { newBins.set(0, Double.NEGATIVE_INFINITY); } else { newBins.set(0, Double.NEGATIVE_INFINITY); // remove the max, and became open interval newBins.remove(newBins.size() - 1); } return newBins; }
From source file:statistic.graph.XYChart.java
private void initXAxis(String label) { plot.setDomainAxis(new NumberAxis(label)); double max = Double.NEGATIVE_INFINITY; double min = Double.POSITIVE_INFINITY; for (int s = 0; s < collection.getSeriesCount(); s++) { for (int d = 0; d < collection.getItemCount(s); d++) { XYDataItem data = collection.getSeries(s).getDataItem(d); if (data.getX().longValue() == Integer.MAX_VALUE || data.getX().longValue() == Integer.MIN_VALUE) { continue; }/*from ww w. ja v a 2 s.c o m*/ if (data.getX().doubleValue() > max) { max = data.getX().doubleValue(); } if (data.getX().doubleValue() < min) { min = data.getX().doubleValue(); } } } plot.getDomainAxis().setStandardTickUnits(NumberAxis.createIntegerTickUnits()); plot.getDomainAxis().setRange(min - 0.5, max + 0.5); }