List of usage examples for java.lang Double POSITIVE_INFINITY
double POSITIVE_INFINITY
To view the source code for java.lang Double POSITIVE_INFINITY.
Click Source Link
From source file:ml.shifu.dtrain.DTrainRequestProcessor.java
private void validateTreeParams(Params params) { validateInt(params, DtrainConstants.SHIFU_DTRAIN_TREE_TREENUM); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_TREE_TREENUM); // TODO validate SHIFU_DTRAIN_TREE_FEATURESUBSETSTRATEGY in list of choices validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_TREE_FEATURESUBSETSTRATEGY); validateInt(params, DtrainConstants.SHIFU_DTRAIN_TREE_MAXDEPTH); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_TREE_MAXDEPTH); // TODO validate SHIFU_DTRAIN_TREE_IMPURITY in list of choices validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_TREE_IMPURITY); validateDoubleAndRange(params, DtrainConstants.SHIFU_DTRAIN_TREE_LEARNINGRATE, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_TREE_LEARNINGRATE); validateInt(params, DtrainConstants.SHIFU_DTRAIN_TREE_MININSTANCESPERNODE); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_TREE_MININSTANCESPERNODE); validateDoubleAndRange(params, DtrainConstants.SHIFU_DTRAIN_TREE_MININFOGAIN, Double.NEGATIVE_INFINITY, Double.POSITIVE_INFINITY); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_TREE_MININFOGAIN); // TODO validate SHIFU_DTRAIN_TREE_LOSS in list of choices validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_TREE_LOSS); // TODO validate SHIFU_DTRAIN_TARGET_COLUMN_NAME in list of choices validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_TARGET_COLUMN_NAME); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_NEGATIVE_TAGS); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_POSITIVE_TAGS); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_EPOCH); validateInt(params, DtrainConstants.SHIFU_DTRAIN_EPOCH); validateBoolean(params, DtrainConstants.SHIFU_DTRAIN_IS_TRAIN_ON_DISK); validateBoolean(params, DtrainConstants.SHIFU_DTRAIN_IS_BAGGING_WITH_REPLACEMENT); validateBoolean(params, DtrainConstants.SHIFU_DTRAIN_IS_FIX_INITIAL_INPUT); validateBoolean(params, DtrainConstants.SHIFU_DTRAIN_PARALLEL); validateDoubleAndRange(params, DtrainConstants.SHIFU_DTRAIN_CROSS_VALIDATION_RATE, 0.0d, 1.0d); validateDoubleAndRange(params, DtrainConstants.SHIFU_DTRAIN_BAGGING_SAMPLE_RATE, 0.0d, 1.0d); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_INPUT); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_INPUT_DELIMETER); validateNotNull(params, DtrainConstants.SHIFU_DTRAIN_ALGORITHM); }
From source file:Math.java
/** * Returns the relative absolute difference between the specified * values, defined to be:/* w w w. j av a 2s .co m*/ * * <blockquote><pre> * relAbsDiff(x,y) = abs(x-y) / (abs(x) + abs(y))</pre></blockquote> * * @param x First value. * @param y Second value. * @return The absolute relative difference between the values. */ public static double relativeAbsoluteDifference(double x, double y) { return (Double.isInfinite(x) || Double.isInfinite(y)) ? Double.POSITIVE_INFINITY : (java.lang.Math.abs(x - y) / (java.lang.Math.abs(x) + java.lang.Math.abs(y))); }
From source file:de.ipk_gatersleben.ag_pbi.mmd.visualisations.gradient.GradientDataChartComponent.java
/** * Fixes the barwidth problem of jfreechart by calculating the position bandwidth * for each bar (based only on the first series!) *//* w w w . j a v a 2 s . c o m*/ private double calculateBarWidth(IntervalXYDataset dataset) { if (dataset.getSeriesCount() == 0 || dataset.getItemCount(0) == 0) return 0.7; double smallestPositionDistance = Double.POSITIVE_INFINITY; for (int i = 1; i < dataset.getItemCount(0); i++) { double mt = dataset.getXValue(0, i) - dataset.getXValue(0, i - 1); if (mt < smallestPositionDistance) smallestPositionDistance = mt; } return 0.7 * smallestPositionDistance; }
From source file:de.tudarmstadt.ukp.dkpro.lexsemresource.graph.EntityGraphJGraphT.java
@Override public double getShortestPathLength(Entity source, Entity target, DirectionMode mode) { List<Entity> path = getShortestPath(source, target, mode); if (path != null) { return path.size() - 1; // we need to decrease by one, as we want to return the distance // in edges, not nodes } else {//from ww w . ja va 2s . c om return Double.POSITIVE_INFINITY; } }
From source file:com.yahoo.ycsb.db.RedisClient.java
@Override public int scan(String table, String startkey, int recordcount, Set<String> fields, Vector<HashMap<String, ByteIterator>> result) { Set<String> keys; if (cluster) { keys = jedisCluster.zrangeByScore(INDEX_KEY, hash(startkey), Double.POSITIVE_INFINITY, 0, recordcount); } else {//from w ww .j a v a 2s. c om keys = jedis.zrangeByScore(INDEX_KEY, hash(startkey), Double.POSITIVE_INFINITY, 0, recordcount); } HashMap<String, ByteIterator> values; for (String key : keys) { values = new HashMap<String, ByteIterator>(); for (String st : values.keySet()) { values.put(st, decompress(values.get(st))); } read(table, key, fields, values); result.add(values); } return 0; }
From source file:de.thkwalter.et.ortskurve.Startpunktbestimmung.java
/** * Diese Methode bestimmt den Messpunkt mit dem kleinsten Wert der x- bzw. y-Komponente. * /*www .j a v a 2 s.c om*/ * @param liste Eine Liste der x- bzw. y-Komponenten der Messpunkte * * @return Der Messpunkt mit dem kleinstenbgh Wert der x- bzw. y-Komponente */ private static Vector2D minMesspunktBestimmen(ArrayList<? extends KomponenteMesspunkt> liste) { // Die Messpunkte mit der kleinsten x- bzw. y-Komponente. KomponenteMesspunkt minKomponenteMesspunkt = null; // Die x- bzw. y-Komponente eines Messwertes. double wert = Double.NaN; // Die kleinste bisher gefundene x- bzw. y-Komponente. double minWert = Double.POSITIVE_INFINITY; // Eine Schleife ber alle Messpunkte in der Liste for (KomponenteMesspunkt komponenteMesspunkt : liste) { // Die x- bzw. y-Komponente des Messpunktes wird gelesen. wert = komponenteMesspunkt.getWert(); // Falls die x- bzw. y-Komponente des Messpunkts kleiner als die kleinste bisher gefundene x- bzw. y-Komponente, ... if (wert < minWert) { // Die grte bisher gefundene x- bzw. y-Komponente wird aktualisiert. minWert = wert; // Der Messpunkt mit der kleinsten x- bzw. y-Komponente wird aktualisiert. minKomponenteMesspunkt = komponenteMesspunkt; } } // Der Messpunkt mit der kleinsten x- bzw. y-Komponente wird aus der Liste entfernt. liste.remove(minKomponenteMesspunkt); // Der Messpunkt mit der grten x- bzw. y-Komponente wird zurckgegeben. return minKomponenteMesspunkt.getMesspunkt(); }
From source file:mase.app.soccer.ProgSoccerAgent.java
private SoccerAgent closestTeammate(Double2D point, boolean includeSelf, boolean includeJustPassed) { SoccerAgent closest = null;/*w ww . ja v a 2 s . c o m*/ double min = Double.POSITIVE_INFINITY; for (SoccerAgent a : teamMates) { if (includeJustPassed || !((ProgSoccerAgent) a).justPassed) { double d = a.distanceTo(point); if (d < min) { min = d; closest = a; } } } if (includeSelf && this.distanceTo(point) < min) { closest = this; } return closest; }
From source file:org.jfree.data.time.TimeSeries.java
/** * Finds the range of y-values that fall within the specified range of * x-values (where the x-values are interpreted as milliseconds since the * epoch and converted to time periods using the specified timezone). * //from ww w .j a va 2s .c om * @param xRange the subset of x-values to use (<code>null</code> not * permitted). * @param xAnchor the anchor point for the x-values (<code>null</code> * not permitted). * @param zone the time zone (<code>null</code> not permitted). * * @return The range of y-values. * * @since 1.0.18 */ public Range findValueRange(Range xRange, TimePeriodAnchor xAnchor, TimeZone zone) { ParamChecks.nullNotPermitted(xRange, "xRange"); ParamChecks.nullNotPermitted(xAnchor, "xAnchor"); ParamChecks.nullNotPermitted(zone, "zone"); if (this.data.isEmpty()) { return null; } Calendar calendar = Calendar.getInstance(zone); // since the items are ordered, we could be more clever here and avoid // iterating over all the data double lowY = Double.POSITIVE_INFINITY; double highY = Double.NEGATIVE_INFINITY; for (int i = 0; i < this.data.size(); i++) { TimeSeriesDataItem item = (TimeSeriesDataItem) this.data.get(i); long millis = item.getPeriod().getMillisecond(xAnchor, calendar); if (xRange.contains(millis)) { Number n = item.getValue(); if (n != null) { double v = n.doubleValue(); lowY = Math.min(lowY, v); highY = Math.max(highY, v); } } } if (Double.isInfinite(lowY) && Double.isInfinite(highY)) { if (lowY < highY) { return new Range(lowY, highY); } else { return new Range(Double.NaN, Double.NaN); } } return new Range(lowY, highY); }
From source file:ddf.catalog.source.opensearch.OpenSearchSiteUtil.java
/** * Takes in an array of coordinates and converts it to a (rough approximation) bounding box. * <p/>// w w w . j a va2s . c om * Note: Searches being performed where the polygon goes through the international date line may * return a bad bounding box. * * @param polyAry array of coordinates (lon,lat,lon,lat,lon,lat..etc) * @return Array of bounding box coordinates in the following order: West South East North. Also * described as minX, minY, maxX, maxY (where longitude is the X-axis, and latitude is * the Y-axis). */ public static double[] createBBoxFromPolygon(String[] polyAry) { double minX = Double.POSITIVE_INFINITY; double minY = Double.POSITIVE_INFINITY; double maxX = Double.NEGATIVE_INFINITY; double maxY = Double.NEGATIVE_INFINITY; double curX, curY; for (int i = 0; i < polyAry.length - 1; i += 2) { LOGGER.debug("polyToBBox: lon - {} lat - {}", polyAry[i], polyAry[i + 1]); curX = Double.parseDouble(polyAry[i]); curY = Double.parseDouble(polyAry[i + 1]); if (curX < minX) { minX = curX; } if (curX > maxX) { maxX = curX; } if (curY < minY) { minY = curY; } if (curY > maxY) { maxY = curY; } } return new double[] { minX, minY, maxX, maxY }; }
From source file:iDynoOptimizer.MOEAFramework26.src.org.moeaframework.algorithm.MOEAD.java
/** * Initializes the ideal point./*from w ww .jav a2 s . c o m*/ */ private void initializeIdealPoint() { idealPoint = new double[problem.getNumberOfObjectives()]; Arrays.fill(idealPoint, Double.POSITIVE_INFINITY); }