Java Code Examples for java.util.DoubleSummaryStatistics#getMax()
The following examples show how to use
java.util.DoubleSummaryStatistics#getMax() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AxisInlierUtils.java From bisq with GNU Affero General Public License v3.0 | 6 votes |
private static Tuple2<Double, Double> findInlierRange( List<Double> yValues, double percentToTrim, double howManyStdDevsConstituteOutlier ) { Tuple2<Double, Double> inlierThreshold = computeInlierThreshold(yValues, percentToTrim, howManyStdDevsConstituteOutlier); DoubleSummaryStatistics inlierStatistics = yValues .stream() .filter(y -> withinBounds(inlierThreshold, y)) .mapToDouble(Double::doubleValue) .summaryStatistics(); var inlierMin = inlierStatistics.getMin(); var inlierMax = inlierStatistics.getMax(); return new Tuple2<>(inlierMin, inlierMax); }
Example 2
Source File: BankStatementProcessor.java From Real-World-Software-Development with Apache License 2.0 | 5 votes |
public SummaryStatistics summarizeTransactions() { final DoubleSummaryStatistics doubleSummaryStatistics = bankTransactions.stream() .mapToDouble(BankTransaction::getAmount) .summaryStatistics(); return new SummaryStatistics(doubleSummaryStatistics.getSum(), doubleSummaryStatistics.getMax(), doubleSummaryStatistics.getMin(), doubleSummaryStatistics.getAverage()); }
Example 3
Source File: WordleLayout.java From TweetwallFX with MIT License | 5 votes |
public Configuration(final List<Word> words, final Font font, final double maxFontSize, final Bounds layoutBounds) { this.words = words; this.font = font; this.maxFontSize = maxFontSize; this.layoutBounds = layoutBounds; final DoubleSummaryStatistics weightSummary = words.stream().mapToDouble(Word::getWeight).summaryStatistics(); this.minWeight = weightSummary.getMin(); this.maxWeight = weightSummary.getMax(); LOG.info("MaxWeight: " + maxWeight); LOG.info("MiWeight: " + minWeight); }
Example 4
Source File: DoubleSummary.java From jenetics with Apache License 2.0 | 5 votes |
/** * Return a new value object of the statistical summary, currently * represented by the {@code statistics} object. * * @param statistics the creating (mutable) statistics class * @return the statistical moments */ public static DoubleSummary of(final DoubleSummaryStatistics statistics) { return new DoubleSummary( statistics.getCount(), statistics.getMin(), statistics.getMax(), statistics.getSum(), statistics.getAverage() ); }
Example 5
Source File: WineQualityExample.java From JavaFM with Mozilla Public License 2.0 | 4 votes |
private static FMData getWineQualityDataset() throws IOException { int columns = 11; SimpleFMData data = new SimpleFMData(columns); String filePath = "winequality-white.csv"; if (!new File(filePath).exists()) { URL url = new URL("https://archive.ics.uci.edu/ml/machine-learning-databases/wine-quality/winequality-white.csv"); ReadableByteChannel rbc = Channels.newChannel(url.openStream()); FileOutputStream fos = new FileOutputStream(filePath); fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); } InputStream is = new FileInputStream(filePath); try (BufferedReader in = new BufferedReader(new InputStreamReader(is))) { in.readLine(); String instance; while ((instance = in.readLine()) != null) { String[] tokens = instance.split(";"); double target = parseDouble(tokens[columns]); int[] k = range(0, columns).toArray(); double[] v = Stream.of(tokens) .limit(columns) .mapToDouble(Double::parseDouble) .toArray(); data.add(new FMInstance(target, k, v)); } } for (int _col = 0; _col < columns; _col++) { int col = _col; DoubleSummaryStatistics stats = data.stream() .mapToDouble(x -> x.get(col)) .summaryStatistics(); double max = stats.getMax(); double min = stats.getMin(); if (max == min) { data.stream().forEach(x -> x.set(col, 0.0)); } else { data.stream().forEach(x -> x.set(col, (x.get(col) - min) / (max - min))); } } return data; }