Exemple #1
0
def printTablesAverages(tableBodySmall, tableBodyLarge, title=""):
    print(title)
    tableSmall = printer.Table(printer.latexToArray(tableBodySmall))
    tableLarge = printer.Table(printer.latexToArray(tableBodyLarge))

    tableSmall.content = tableSmall.content[:-2]
    tableLarge.content = tableLarge.content[:-2]

    tableSmall.removeColumns([0, 17])
    tableLarge.removeColumns([0, 17])

    print("Avg success rate tableSmall: {0}".format(computeAvg(tableSmall)))
    print("Avg success rate tableLarge: {0}".format(computeAvg(tableLarge)))
Exemple #2
0
def generateTableTextRemovedCols(verticalBorder, horizontalBorder,
                                 useBooktabs):
    print("Generating a table for table_variants_text_rc.tex ..")
    dimCx = Dim([("0.0", None), ("0.5", None)])
    dimSel = Dim([("T", None), ("L", None)])
    dimMethod = Dim([("U", None), ("P", None), ("S", None), ("IS", None)])
    dimSingleCol = Dim([("C", None), ("D", None)])
    main = dimSel * dimMethod * dimCx + dimSingleCol
    dimCols = main + Dim([("mean", None)])
    cells, rows_names = printer.latexToArrayRowNames(
        tableBody)  # maybe switch for pandas as a primary representation?
    dimRows = Dim.from_names(rows_names)

    rBold = printer.LatexTextbf(lambda v, b: v == "1.00")
    rShading = printer.CellShading(0.0, 0.5, 1.0, "colorLow", "colorMedium",
                                   "colorHigh")
    table = printer.Table(cells,
                          dimRows=dimRows,
                          dimCols=dimCols,
                          cellRenderers=[rBold, rShading],
                          verticalBorder=verticalBorder,
                          horizontalBorder=horizontalBorder,
                          useBooktabs=useBooktabs,
                          headerRowNames=["method", "", "cx"])

    table.leaveColumns([0, 2, 6, 8, 10, 14])  # leaving out S and C
    return table
Exemple #3
0
def generateTableData(verticalBorder, horizontalBorder, useBooktabs):
    print("Generating a table for table_variants_data.tex ..")

    dimCols = Dim.from_dict(
        data, "A", nameFun=lambda v: "A={0}".format(v)) * Dim.from_dict(
            data, "B", nameFun=lambda v: "B={0}".format(v))
    dimRows = Dim.from_dict(data, "F", nameFun=lambda v: "F={0}".format(v))

    cells = printer.generateTableCells(
        data,
        dimRows=dimRows,
        dimCols=dimCols,
        fun=lambda props: sum([p["value"] for p in props]))

    rShading = printer.CellShading(0.0, 5.0, 10.0, "colorLow", "colorMedium",
                                   "colorHigh")
    table = printer.Table(cells,
                          dimCols=dimCols,
                          dimRows=dimRows,
                          cellRenderers=[rShading],
                          verticalBorder=verticalBorder,
                          horizontalBorder=horizontalBorder,
                          useBooktabs=useBooktabs,
                          headerRowNames=["A-value"])
    return table
Exemple #4
0
def printTablesAveragesSvsIS(tableBody, title="", doPrint=True):
    print(title)
    tableS = printer.Table(printer.latexToArray(tableBody))
    tableIS = printer.Table(printer.latexToArray(tableBody))

    tableS.content = tableS.content[:-2]
    tableIS.content = tableIS.content[:-2]

    tableS.leaveColumns([5, 6, 13, 14])
    tableIS.leaveColumns([7, 8, 15, 16])

    avgS = computeAvg(tableS)
    avgIS = computeAvg(tableIS)
    if doPrint:
        print("Avg success rate S: {0}".format(avgS))
        print("Avg success rate IS: {0}".format(avgIS))
    return avgS, avgIS
Exemple #5
0
def printTablesAveragesCvsN(tableBody, title="", doPrint=True):
    print(title)
    tableC = printer.Table(printer.latexToArray(tableBody))
    tableN = printer.Table(printer.latexToArray(tableBody))

    tableC.content = tableC.content[:-2]
    tableN.content = tableN.content[:-2]

    tableC.removeColumns([0, 2, 4, 6, 8, 10, 12, 14, 16, 17])
    tableN.removeColumns([0, 1, 3, 5, 7, 9, 11, 13, 15, 17])

    avgC = computeAvg(tableC)
    avgN = computeAvg(tableN)
    if doPrint:
        print("Avg success rate C: {0}".format(avgC))
        print("Avg success rate N: {0}".format(avgN))
    return avgC, avgN
Exemple #6
0
def processTableNewInterface_SvsSI(tableBody, title):
    print(title)
    rBold = printer.LatexTextbf(lambda v, b: v == "1.00")
    rShading = printer.CellShading(0.0, 0.5, 1.0, "colorLow", "colorMedium",
                                   "colorHigh")
    table = printer.Table(printer.latexToArray(tableBody),
                          cellRenderers=[rBold, rShading])
    table.leaveColumns([0, 5, 6, 7, 8, 13, 14, 15,
                        16])  # comparing only SI with S

    colored = printer.table_color_map(str(table), 0.0, 0.5, 1.0, "colorLow",
                                      "colorMedium", "colorHigh")
    #print(reporting.color_scheme_green)
    print(colored)
    print(table.renderCsv())
Exemple #7
0
def processTableNewInterface_withoutSC(tableBody, title):
    dimCx = Dim([("0.0", None), ("0.5", None)])
    dimSel = Dim([("T", None), ("L", None)])
    dimMethod = Dim([("U", None), ("P", None), ("S", None), ("IS", None)])
    main = dimSel * dimMethod * dimCx
    dimCols = Dim([("method", None)]) + main + Dim([("mean", None)])
    print("numConfigs: " + str(len(dimCols.configs)))
    print("asd: " + title)
    rBold = printer.LatexTextbf(lambda v, b: v == "1.00")
    rShading = printer.CellShading(0.0, 0.5, 1.0, "colorLow", "colorMedium",
                                   "colorHigh")
    table = printer.Table(printer.latexToArray(tableBody),
                          dimCols=dimCols,
                          cellRenderers=[rBold, rShading])
    table.leaveColumns([0, 1, 3, 7, 9, 11, 15])  # leaving out S and C
    print(table.render())
    print(table.renderCsv())
    \benchNameEps{Koza1-p-2D} & \cellcolor{colorLow!62.84!colorMedium}9.29 & \cellcolor{colorLow!31.28!colorMedium}17.18 & \cellcolor{colorLow!41.6!colorMedium}14.60 & & \cellcolor{colorLow!9.599999999999994!colorMedium}22.60 & \cellcolor{colorLow!57.36!colorMedium}10.66 & \cellcolor{colorHigh!17.879999999999995!colorMedium}29.47 & \cellcolor{colorHigh!84.91999999999999!colorMedium}\textbf{46.23} & \cellcolor{colorLow!49.76!colorMedium}12.56 & \cellcolor{colorLow!38.36!colorMedium}15.41\\    
"""

    text_successRate = r"""
	\benchNameEps{Keijzer12} & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!90.0!colorMedium}0.05 & & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!98.0!colorMedium}0.01 & \cellcolor{colorLow!22.0!colorMedium}\textbf{0.39} & \cellcolor{colorLow!98.0!colorMedium}0.01 & \cellcolor{colorLow!100.0!colorMedium}0.00\\
	\benchNameEps{Koza1} & \cellcolor{colorLow!62.0!colorMedium}0.19 & \cellcolor{colorHigh!36.0!colorMedium}0.68 & \cellcolor{colorHigh!92.0!colorMedium}0.96 & & \cellcolor{colorLow!34.0!colorMedium}0.33 & - & \cellcolor{colorLow!36.0!colorMedium}0.32 & \cellcolor{colorHigh!100.0!colorMedium}\textbf{1.00} & - & \cellcolor{colorHigh!100.0!colorMedium}\textbf{1.00}\\
	\benchNameEps{Koza1-p} & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!100.0!colorMedium}0.00 & & \cellcolor{colorLow!90.0!colorMedium}0.05 & - & \cellcolor{colorLow!94.0!colorMedium}0.03 & \cellcolor{colorHigh!100.0!colorMedium}\textbf{1.00} & - & \cellcolor{colorHigh!100.0!colorMedium}\textbf{1.00}\\
	\benchNameEps{Koza1-2D} & \cellcolor{colorLow!98.0!colorMedium}0.01 & \cellcolor{colorLow!76.0!colorMedium}0.12 & \cellcolor{colorLow!60.0!colorMedium}0.20 & & \cellcolor{colorLow!96.0!colorMedium}0.02 & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!78.0!colorMedium}0.11 & \cellcolor{colorHigh!60.0!colorMedium}\textbf{0.80} & \cellcolor{colorLow!58.0!colorMedium}0.21 & \cellcolor{colorLow!54.0!colorMedium}0.23\\
	\benchNameEps{Koza1-p-2D} & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!100.0!colorMedium}0.00 & & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!98.0!colorMedium}0.01 & \cellcolor{colorHigh!50.0!colorMedium}\textbf{0.75} & \cellcolor{colorLow!100.0!colorMedium}0.00 & \cellcolor{colorLow!100.0!colorMedium}0.00\\
"""

    cells_runtime = printer.latexToArray(text_runtime, removeRenderings=True)
    table_runtime = printer.Table(cells_runtime,
                                  cellRenderers=[
                                      printer.LatexTextbfMinInRow(),
                                      printer.CellShadingRow(
                                          "colorLow", "colorMedium",
                                          "colorHigh")
                                  ])  #, valueExtractor=log10ValueExtractor
    print("RUNTIME")
    print(table_runtime.renderTableBody())

    cells_fitness = printer.latexToArray(text_fitness, removeRenderings=True)
    table_fitness = printer.Table(cells_fitness,
                                  cellRenderers=[
                                      printer.LatexTextbfMaxInRow(),
                                      printer.CellShadingRow(
                                          "colorLow", "colorMedium",
                                          "colorHigh")
                                  ])  # , valueExtractor=log10ValueExtractor
    print("FITNESS")
Exemple #9
0
from evoplotter import utils
from evoplotter import plotter
from evoplotter import printer
from evoplotter import reporting
from evoplotter.dims import *

tableRaw = r"""
P0 & 0.5 & 0.4 & 1.0 & 0.1 \\
P1 & 0.2 & 0.4 & 0.5 & 0.9 \\
P2 & 0.8 & 0.1 & 0.8 & 0.3 \\
P3 & 0.9 & 0.0 & 0.2 & 0.3 \\
"""

table = printer.Table(printer.latexToArray(tableRaw))
table.removeColumn(1)
print(table.renderLatex())
print(table.renderCsv())

table = printer.Table(printer.latexToArray(tableRaw),
                      dimCols=Dim([("A", None),
                                   ("B", None)]) * Dim([("c", None),
                                                        ("d", None)]),
                      dimRows=Dim(["P0", "P1", "P2", "P3"]))
table.removeColumn(1)
print(table.renderLatex())
print(table.renderCsv())

table.insertColumn(1, ["0.0", "0.0", "0.0", "0.0"])
print(table.renderLatex())
print(table.renderCsv())