use of org.deeplearning4j.ui.components.chart.ChartLine in project deeplearning4j by deeplearning4j.
the class EvaluationTools method getRocFromPoints.
private static Component getRocFromPoints(String title, double[][] points, long positiveCount, long negativeCount, double auc) {
double[] zeroOne = new double[] { 0.0, 1.0 };
ChartLine chartLine = new ChartLine.Builder(title, CHART_STYLE).setXMin(0.0).setXMax(1.0).setYMin(0.0).setYMax(1.0).addSeries("ROC", points[0], //points[0] is false positives -> usually plotted on x axis
points[1]).addSeries("", zeroOne, zeroOne).build();
ComponentTable ct = new ComponentTable.Builder(TABLE_STYLE).header("Field", "Value").content(new String[][] { { "AUC", String.format("%.5f", auc) }, { "Total Data Positive Count", String.valueOf(positiveCount) }, { "Total Data Negative Count", String.valueOf(negativeCount) } }).build();
ComponentDiv divLeft = new ComponentDiv(INNER_DIV_STYLE, PAD_DIV, ct, PAD_DIV, INFO_TABLE);
ComponentDiv divRight = new ComponentDiv(INNER_DIV_STYLE, chartLine);
return new ComponentDiv(OUTER_DIV_STYLE, divLeft, divRight);
}
use of org.deeplearning4j.ui.components.chart.ChartLine in project deeplearning4j by deeplearning4j.
the class TestStandAlone method testStandAlone.
@Test
public void testStandAlone() throws Exception {
ComponentTable ct = new ComponentTable.Builder(new StyleTable.Builder().backgroundColor(Color.LIGHT_GRAY).columnWidths(LengthUnit.Px, 100, 100).build()).content(new String[][] { { "First", "Second" }, { "More", "More2" } }).build();
ChartLine cl = new ChartLine.Builder("Title", new StyleChart.Builder().axisStrokeWidth(1.0).seriesColors(Color.BLACK, Color.ORANGE).width(640, LengthUnit.Px).height(480, LengthUnit.Px).build()).addSeries("First Series", new double[] { 0, 1, 2, 3, 4, 5 }, new double[] { 10, 20, 30, 40, 50, 60 }).addSeries("Second", new double[] { 0, 0.5, 1, 1.5, 2 }, new double[] { 5, 10, 15, 10, 5 }).build();
ChartHistogram ch = new ChartHistogram.Builder("Histogram", new StyleChart.Builder().axisStrokeWidth(1.0).seriesColors(Color.MAGENTA).width(640, LengthUnit.Px).height(480, LengthUnit.Px).build()).addBin(0, 1, 1).addBin(1, 2, 2).addBin(2, 3, 1).build();
System.out.println(StaticPageUtil.renderHTML(ct, cl, ch));
}
Aggregations