/** * 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; }
@Override public void actionPerformed(ActionEvent e) { setTitle((String) propertyTable.getValueAt(0, 1)); setTitleFont((Font) propertyTable.getValueAt(1, 1)); setTitleColor((Color) propertyTable.getValueAt(2, 1));
/** * 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; } }
/** * 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; } }
if (Arrays.stream(data).mapToInt(x -> x.length).sum() == 0) return null; @Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "log10(Fitness)"); plot.setSize(600, 400); if (Arrays.stream(data).mapToInt(x -> x.length).sum() == 0) return null; @Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "Fitness"); plot.setSize(600, 400);
if (Arrays.stream(data).mapToInt(x -> x.length).sum() == 0) return null; @Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "log10(Fitness)"); plot.setSize(600, 400); if (Arrays.stream(data).mapToInt(x -> x.length).sum() == 0) return null; @Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "Fitness"); plot.setSize(600, 400);
/** * 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; }); } }
if (Arrays.stream(data).mapToInt(x -> x.length).sum() == 0) return null; @Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "log10(Fitness)"); plot.setSize(600, 400); if (Arrays.stream(data).mapToInt(x -> x.length).sum() == 0) return null; @Nonnull final PlotCanvas plot = ScatterPlot.plot(data); plot.setTitle("Convergence Plot"); plot.setAxisLabels("Iteration", "Fitness"); plot.setSize(600, 400);
@Nonnull final double[] upperBound = {totalTime / 1000.0, yStatistics.getCount() == 1 ? 0 : yStatistics.getMax()}; @Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Time", "log10(Fitness)"); canvas.setSize(600, 400);
@Nonnull final double[] upperBound = {xStatistics.getCount() == 0 ? 1 : xStatistics.getMax(), yStatistics.getCount() < 2 ? 1 : yStatistics.getMax()}; @Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Iteration", "log10(Fitness)"); canvas.setSize(600, 400);
@Nonnull final double[] upperBound = {xStatistics.getCount() == 0 ? 1 : xStatistics.getMax(), yStatistics.getCount() < 2 ? 1 : yStatistics.getMax()}; @Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Iteration", "log10(Fitness)"); canvas.setSize(600, 400);
@Nonnull final double[] upperBound = {totalTime / 1000.0, yStatistics.getCount() == 1 ? 0 : yStatistics.getMax()}; @Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Time", "log10(Fitness)"); canvas.setSize(600, 400);
@Nonnull final double[] upperBound = {totalTime / 1000.0, yStatistics.getCount() == 1 ? 0 : yStatistics.getMax()}; @Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Time", "log10(Fitness)"); canvas.setSize(600, 400);
@Nonnull final double[] upperBound = {xStatistics.getCount() == 0 ? 1 : xStatistics.getMax(), yStatistics.getCount() < 2 ? 1 : yStatistics.getMax()}; @Nonnull final PlotCanvas canvas = new PlotCanvas(lowerBound, upperBound); canvas.setTitle(title); canvas.setAxisLabels("Iteration", "log10(Fitness)"); canvas.setSize(600, 400);
public static PlotCanvas create(String plotTitle, String xTitle, String yTitle, NumberColumn column) { PlotCanvas canvas = smile.plot.Histogram.plot(column.asDoubleArray()); canvas.setForeground(Color.DARK_GRAY); canvas.setTitle(plotTitle); canvas.setAxisLabel(0, xTitle); canvas.setAxisLabel(1, yTitle); return canvas; }
public static PlotCanvas create(String plotTitle, TableSliceGroup groups, int columnNumber) { double[][] dataArray = DoubleArrays.to2dArray(groups, columnNumber); String[] grounpNames = groupNames(groups); PlotCanvas canvas = BoxPlot.plot(dataArray, grounpNames); canvas.setTitle(plotTitle); canvas.setAxisLabel(0, ""); canvas.setAxisLabel(1, groups.getSourceTable().column(columnNumber).name()); return canvas; }
public static PlotCanvas create(String plotTitle, Table table, String summaryColumnName, String groupingColumnName) { TableSliceGroup groups = table.splitOn(table.categoricalColumn(groupingColumnName)); int columnNumber = table.columnIndex(summaryColumnName); double[][] dataArray = DoubleArrays.to2dArray(groups, columnNumber); String[] grounpNames = groupNames(groups); PlotCanvas canvas = BoxPlot.plot(dataArray, grounpNames); canvas.setTitle(plotTitle); canvas.setAxisLabel(0, groupingColumnName); canvas.setAxisLabel(1, summaryColumnName); return canvas; }