Skip to content
Snippets Groups Projects
Commit e36049c2 authored by Muhammad Raufu Miah's avatar Muhammad Raufu Miah
Browse files

Update ExperimentsBlackBox.java

parent 223c69a7
No related branches found
No related tags found
No related merge requests found
...@@ -25,10 +25,12 @@ import net.automatalib.word.Word; ...@@ -25,10 +25,12 @@ import net.automatalib.word.Word;
import org.knowm.xchart.QuickChart; import org.knowm.xchart.QuickChart;
import org.knowm.xchart.SwingWrapper; import org.knowm.xchart.SwingWrapper;
import org.knowm.xchart.XYChart; import org.knowm.xchart.XYChart;
import org.knowm.xchart.XYSeries;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.stream.Collectors;
public class ExperimentsBlackBox { public class ExperimentsBlackBox {
...@@ -253,6 +255,12 @@ public class ExperimentsBlackBox { ...@@ -253,6 +255,12 @@ public class ExperimentsBlackBox {
// Create the fifth XY chart (accuracy) // Create the fifth XY chart (accuracy)
XYChart chart5 = QuickChart.getChart("Accuracy", "Lookahead", "Queries", seriesNames, xValues, new double[][]{accuracyLstar, accuracyRS, accuracyKV, accuracyOP, accuracyTTT}); XYChart chart5 = QuickChart.getChart("Accuracy", "Lookahead", "Queries", seriesNames, xValues, new double[][]{accuracyLstar, accuracyRS, accuracyKV, accuracyOP, accuracyTTT});
new SwingWrapper(chart5).displayChart(); new SwingWrapper(chart5).displayChart();
printXYChartPairs(chart1);
printXYChartPairs(chart2);
printXYChartPairs(chart3);
printXYChartPairs(chart4);
printXYChartPairs(chart5);
} }
// Define the learning methods // Define the learning methods
...@@ -344,4 +352,31 @@ public class ExperimentsBlackBox { ...@@ -344,4 +352,31 @@ public class ExperimentsBlackBox {
return 0; return 0;
} }
public static void printXYChartPairs(XYChart chart) {
// Get all series in the chart
System.out.println("Chart: " + chart.getTitle());
List<XYSeries> seriesList = chart.getSeriesMap().values().stream().collect(Collectors.toList());
// Iterate over each series
for (XYSeries series : seriesList) {
System.out.println("Series: " + series.getName());
// Get x and y data
double[] xData = series.getXData();
double[] yData = series.getYData();
// Ensure x and y data are of the same size
if (xData.length != yData.length) {
System.out.println("Mismatch in data size for series: " + series.getName());
continue;
}
// Print (x, y) pairs
for (int i = 0; i < xData.length; i++) {
System.out.println("(" + xData[i] + ", " + yData[i] + ")");
}
}
}
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment