/** * Plot plot canvas. * * @param title the title * @param data the data * @return the plot canvas */ @Nonnull public static PlotCanvas plot(final String title, final double[][] data) { @Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle(title); plot.setAxisLabels("x", "y"); plot.setSize(600, 400); return plot; }
/** * Print history. * * @param log the logger * @param history the history */ public static void printHistory(@Nonnull final NotebookOutput log, @Nonnull final List<StepRecord> history) { if (!history.isEmpty()) { log.out("Convergence Plot: "); log.eval(() -> { final DoubleSummaryStatistics valueStats = history.stream().mapToDouble(x -> x.fitness).filter(x -> x > 0).summaryStatistics(); @Nonnull final PlotCanvas plot = ScatterPlot.plot(history.stream().map(step -> new double[]{step.iteration, Math.log10(Math.max(valueStats.getMin(), step.fitness))}) .toArray(i -> new double[i][])); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "log10(Fitness)"); plot.setSize(600, 400); return plot; }); } }
/** * Plot plot canvas. * * @param history the history * @return the plot canvas */ public static PlotCanvas plotTime(@Nonnull final List<StepRecord> history) { try { final LongSummaryStatistics timeStats = history.stream().mapToLong(x -> x.epochTime).summaryStatistics(); final DoubleSummaryStatistics valueStats = history.stream().mapToDouble(x -> x.fitness).filter(x -> x > 0).summaryStatistics(); @Nonnull final PlotCanvas plot = ScatterPlot.plot(history.stream().map(step -> new double[]{ (step.epochTime - timeStats.getMin()) / 1000.0, Math.log10(Math.max(valueStats.getMin(), step.fitness))}) .filter(x -> Arrays.stream(x).allMatch(Double::isFinite)) .toArray(i -> new double[i][])); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Time", "log10(Fitness)"); plot.setSize(600, 400); return plot; } catch (@Nonnull final Exception e) { e.printStackTrace(System.out); return null; } }
/** * Plot plot canvas. * * @param history the history * @return the plot canvas */ public static PlotCanvas plotTime(@Nonnull final List<StepRecord> history) { try { final LongSummaryStatistics timeStats = history.stream().mapToLong(x -> x.epochTime).summaryStatistics(); final DoubleSummaryStatistics valueStats = history.stream().mapToDouble(x -> x.fitness).filter(x -> x > 0).summaryStatistics(); @Nonnull final PlotCanvas plot = ScatterPlot.plot(history.stream().map(step -> new double[]{ (step.epochTime - timeStats.getMin()) / 1000.0, Math.log10(Math.max(valueStats.getMin(), step.fitness))}) .filter(x -> Arrays.stream(x).allMatch(Double::isFinite)) .toArray(i -> new double[i][])); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Time", "log10(Fitness)"); plot.setSize(600, 400); return plot; } catch (@Nonnull final Exception e) { e.printStackTrace(System.out); return null; } }
/** * Print history. * * @param log the logger * @param history the history */ public static void printHistory(@Nonnull final NotebookOutput log, @Nonnull final List<StepRecord> history) { if (!history.isEmpty()) { log.out("Convergence Plot: "); log.eval(() -> { final DoubleSummaryStatistics valueStats = history.stream().mapToDouble(x -> x.fitness).filter(x -> x > 0).summaryStatistics(); @Nonnull final PlotCanvas plot = ScatterPlot.plot(history.stream().map(step -> new double[]{step.iteration, Math.log10(Math.max(valueStats.getMin(), step.fitness))}) .toArray(i -> new double[i][])); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "log10(Fitness)"); plot.setSize(600, 400); return plot; }); } }
/** * Plot plot canvas. * * @param history the history * @return the plot canvas */ public static PlotCanvas plotTime(@Nonnull final List<StepRecord> history) { try { final LongSummaryStatistics timeStats = history.stream().mapToLong(x -> x.epochTime).summaryStatistics(); final DoubleSummaryStatistics valueStats = history.stream().mapToDouble(x -> x.fitness).filter(x -> x > 0).summaryStatistics(); @Nonnull final PlotCanvas plot = ScatterPlot.plot(history.stream().map(step -> new double[]{ (step.epochTime - timeStats.getMin()) / 1000.0, Math.log10(Math.max(valueStats.getMin(), step.fitness))}) .filter(x -> Arrays.stream(x).allMatch(Double::isFinite)) .toArray(i -> new double[i][])); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Time", "log10(Fitness)"); plot.setSize(600, 400); return plot; } catch (@Nonnull final Exception e) { e.printStackTrace(System.out); return null; } }
@Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "log10(Fitness)"); plot.setSize(600, 400); return plot; @Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "Fitness"); plot.setSize(600, 400); return plot;
@Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "log10(Fitness)"); plot.setSize(600, 400); return plot; @Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "Fitness"); plot.setSize(600, 400); return plot;
/** * Print history. * * @param log the logger * @param history the history */ public static void printHistory(@Nonnull final NotebookOutput log, @Nonnull final List<StepRecord> history) { if (!history.isEmpty()) { log.out("Convergence Plot: "); log.eval(() -> { final DoubleSummaryStatistics valueStats = history.stream().mapToDouble(x -> x.fitness).filter(x -> x > 0).summaryStatistics(); @Nonnull final PlotCanvas plot = ScatterPlot.plot(history.stream().map(step -> new double[]{step.iteration, Math.log10(Math.max(valueStats.getMin(), step.fitness))}) .toArray(i -> new double[i][])); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "log10(Fitness)"); plot.setSize(600, 400); return plot; }); } }
@Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "log10(Fitness)"); plot.setSize(600, 400); return plot; @Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "Fitness"); plot.setSize(600, 400); return plot;
@Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Iteration", "log10(Fitness)"); canvas.setSize(600, 400); final List<ProblemRun> filtered = Arrays.stream(trials).filter(x -> !x.history.isEmpty()).collect(Collectors.toList());
@Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Time", "log10(Fitness)"); canvas.setSize(600, 400); final List<ProblemRun> filtered = Arrays.stream(trials).filter(x -> !x.history.isEmpty()).collect(Collectors.toList());
@Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Time", "log10(Fitness)"); canvas.setSize(600, 400); final List<ProblemRun> filtered = Arrays.stream(trials).filter(x -> !x.history.isEmpty()).collect(Collectors.toList());
@Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Time", "log10(Fitness)"); canvas.setSize(600, 400); final List<ProblemRun> filtered = Arrays.stream(trials).filter(x -> !x.history.isEmpty()).collect(Collectors.toList());
@Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Iteration", "log10(Fitness)"); canvas.setSize(600, 400); final List<ProblemRun> filtered = Arrays.stream(trials).filter(x -> !x.history.isEmpty()).collect(Collectors.toList());
@Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Iteration", "log10(Fitness)"); canvas.setSize(600, 400); final List<ProblemRun> filtered = Arrays.stream(trials).filter(x -> !x.history.isEmpty()).collect(Collectors.toList());
canvas.setAxisLabels("Principal Component", "Proportion of Variance");