Commit 2ec5a5e0 authored by Jakub's avatar Jakub
Browse files

modified export of data + generation of graph with candlesticks

parent c72aa8ed
Loading
Loading
Loading
Loading
+21 −6
Original line number Diff line number Diff line
@@ -100,11 +100,12 @@ public record ExperimentReport(String name, DBReport dbStats, int threshold, dou
            map.get(algo).stream().sorted(Comparator.comparing(Pair::getKey));
        }
    }
    private static <K extends Comparable,V> void mapPrint(String name, Map<Algo, List<Pair<K,V>>> map){
    private static <K extends Comparable,V extends Comparable> void mapPrint(String name, Map<Algo, List<Pair<K,V>>> map){
        StringBuilder csvHeader = new StringBuilder(name);
        List<Algo> algoOrder = new ArrayList<>(map.keySet());
        algoOrder.sort((algo, t1) -> algo.name().compareTo(t1.name()));
        for (Algo algo : algoOrder){
            csvHeader.append(", ").append(algo.name());
            csvHeader.append(", ").append(CandleValues.header(algo.name()));
        }
        csvHeader.append(System.lineSeparator());

@@ -140,8 +141,22 @@ public record ExperimentReport(String name, DBReport dbStats, int threshold, dou
            var pairList = transposedMap.get(key);
            for (var algo : algoOrder){
                //todo:compute candle value and average
                var value = pairList.stream().filter((p)->p.getKey().equals(algo)).findFirst().get().getValue();//todo: tady je druhý problém
                valuesCSV.append(", ").append(value);
                var times = pairList.stream()
                        .filter((p)->p.getKey().equals(algo))
                        .map(x->x.getValue())
                        .flatMap(List::stream)
                        .collect(Collectors.toList());
                times.sort(V::compareTo);
                int indexQuarter = (int)Math.round(times.size()/4d);
                var min = times.get(0);
                var firstQuartile = times.get(Math.max(0,indexQuarter*1-1));
                var median = times.get(Math.max(0, times.size()/2-1));
                var avg = times.stream().mapToDouble(v -> (double)v).average().getAsDouble();
                var thirdQuartile = times.get(Math.max(0,times.size()-indexQuarter-1));
                var max = times.get(times.size()-1);
                var timeValues = new CandleValues<V>(algo.name(), min, firstQuartile, median, avg, thirdQuartile, max);
                valuesCSV.append(timeValues.values());
                valuesCSV.append(", ");
            }
            valuesCSV.append(System.lineSeparator());
        }
@@ -169,9 +184,9 @@ public record ExperimentReport(String name, DBReport dbStats, int threshold, dou
}


record candleValues<T> (String name, T min, T firstQuartile, T median, Float avg, T thirdQuartile, T max){
record CandleValues<T> (String name, T min, T firstQuartile, T median, double avg, T thirdQuartile, T max){

    public String header(){
    public static String header(String name){
        StringBuilder builder = new StringBuilder();
        builder.append(name).append("_min, ");
        builder.append(name).append("_firstQuartile, ");
+28 −20
Original line number Diff line number Diff line
set terminal png size 500,500
set terminal png size 1024,1024
set bmargin 5
set key autotitle columnhead

@@ -19,32 +19,40 @@ set style line 3 \
    linetype 1 linewidth 2 \
    pointtype 7 pointsize 1.5

set boxwidth 0.1 relative
set style fill empty

set output 'sizeExp.png'
plot 'size.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3
plot 'size.csv' using 1:4 with lp title 'GSP' ls 1 , \
             '' using 1:9 with lp title 'PREFIX_SPAN' ls 2 , \
             '' using 1:14 with lp title 'SPAM' ls 3, \
             '' using ($1-1):3:2:6:5 with candlesticks  title 'GSP' whiskerbars, \
             '' using ($1):8:7:11:10 with candlesticks  title 'PREFIX_SPAN' whiskerbars, \
             '' using ($1+1):13:12:16:15 with candlesticks title 'SPAM' whiskerbars

set output 'unique.png'
plot 'unique.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3
#set output 'unique.png'
#plot 'unique.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3

set output 'minLength.png'
plot 'minLength.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3
#set output 'minLength.png'
#plot 'minLength.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3

set output 'avgLength.png'
plot 'avgLength.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3
#set output 'avgLength.png'
#plot 'avgLength.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3

set output 'maxLength.png'
plot 'maxLength.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3
#set output 'maxLength.png'
#plot 'maxLength.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3

set output 'minRepeatibility.png'
plot 'minRepeatibility.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3
#set output 'minRepeatibility.png'
#plot 'minRepeatibility.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3

set output 'avgRepeatibility.png'
plot 'avgRepeatibility.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3
#set output 'avgRepeatibility.png'
#plot 'avgRepeatibility.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3

set output 'maxRepeatibility.png'
plot 'maxRepeatibility.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3
#set output 'maxRepeatibility.png'
#plot 'maxRepeatibility.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3

set output 'avgRepeated.png'
plot 'avgRepeated.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3
#set output 'avgRepeated.png'
#plot 'avgRepeated.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3

set output 'threshold.png'
plot 'threshold.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3
#set output 'threshold.png'
#plot 'threshold.csv' using 1:2 with lp ls 1, '' using 1:3 with lp ls 2, '' using 1:4 with lp ls 3