use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class SpaceBattleLinkTest method main.
public static void main(String[] args) {
StatSummary ss = new StatSummary();
int nTrials = 10;
ElapsedTimer t = new ElapsedTimer();
for (int i = 0; i < nTrials; i++) {
System.out.println("Trial: " + i);
ss.add(runTrial(runVisible));
System.out.println();
}
System.out.println(ss);
System.out.println();
System.out.println(t);
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class HyperParamTuneRunner method runTrials.
public void runTrials(EvoAlg evoAlg, AnnotatedFitnessSpace annotatedFitnessSpace) {
ElapsedTimer timer = new ElapsedTimer();
StatSummary ss = new StatSummary("Overall results: " + evoAlg.getClass().getSimpleName());
for (int i = 0; i < nTrials; i++) {
System.out.println();
System.out.println("Running trial: " + (i + 1));
try {
ss.add(runTrial(evoAlg, annotatedFitnessSpace));
System.out.println("Stats so far");
System.out.println(ss);
if (verbose) {
plotFitnessEvolution(annotatedFitnessSpace.logger(), annotatedFitnessSpace, plotChecks);
// annotatedFitnessSpace.logger()
// ((NTupleSystem) ((NTupleBanditEA) evoAlg).banditLandscapeModel).printDetailedReport(new EvoAgentSearchSpaceAsteroids().getParams());
NTupleSystem nTupleSystem = ((NTupleSystem) ((NTupleBanditEA) evoAlg).banditLandscapeModel);
nTupleSystem.printDetailedReport(annotatedFitnessSpace.getParams());
// new Plotter().setModel(nTupleSystem).defaultPlot().plot1Tuples();
}
} catch (Exception e) {
e.printStackTrace();
}
}
if (verbose) {
lineChart.addLineGroup(sampleEvolution);
if (plotChecks > 0)
lineChart.addLineGroup(bestGuess);
new JEasyFrame(lineChart, "Sample Evolution");
}
System.out.println("nEvals per run: " + nEvals);
System.out.println(ss);
System.out.println("Total time for experiment: " + timer);
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class HyperParamTuneRunner method plotFitnessEvolution.
private void plotFitnessEvolution(EvolutionLogger logger, AnnotatedFitnessSpace eval, int plotChecks) {
// the idea is to also add a new line group showing how the actual fitness evolved
// versus the solutions that were sampled
ArrayList<Double> data = new ArrayList<>();
data.addAll(logger.fa);
// System.out.println(data);
// System.out.println(data.size());
sampleEvolution.add(data);
ArrayList<Double> bests = new ArrayList<>();
// now this will be slow, but for now just sample every now and then ...
for (int[] solution : logger.bestYetSolutions) {
// System.out.println(Arrays.toString(solution));
StatSummary ss = new StatSummary();
for (int i = 0; i < plotChecks; i++) ss.add(eval.evaluate(solution));
bests.add(ss.mean());
}
if (plotChecks > 0) {
System.out.println("Bests: " + bests);
bestGuess.add(bests);
}
// lineChart.addLine(new LinePlot().setData(data).setRandomColor());
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class NTuple method add.
public void add(int[] x, StatSummary ssIncoming) {
// for each address that occurs, we're going to store something
StatSummary ss = getStatsForceCreate(x);
ss.add(ssIncoming);
nSamples++;
}
use of utilities.StatSummary in project SimpleAsteroids by ljialin.
the class NTuple method printNonEmpty.
public void printNonEmpty() {
TreeSet<IntArrayPattern> orderedKeys = new TreeSet<>();
orderedKeys.addAll(ntMap.keySet());
for (IntArrayPattern key : orderedKeys) {
StatSummary ss = ntMap.get(key);
System.out.println(key + "\t " + ss.n() + "\t " + ss.mean() + "\t " + ss.sd());
}
}
Aggregations