How to use the temci.misc.game.BOTableColumn function in temci

To help you get started, we’ve selected a few temci examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github parttimenerd / temci / temci / misc / game.py View on Github external
def get_html(self, base_file_name: str, h_level: int) -> str:
        sp = None # type: SingleProperty
        columns = [
            BOTableColumn("n", "{:5d}", lambda sp, _: sp.observations(), first),
            BOTableColumn("mean", "{:10.5f}", lambda sp, _: sp.mean(), first),
            BOTableColumn("mean / best mean", "{:5.5%}", lambda sp, means: sp.mean() / min(means), first),
            BOTableColumn("mean / mean of first impl", "{:5.5%}", lambda sp, means: sp.mean() / means[0], first),
            BOTableColumn("std / mean", "{:5.5%}", lambda sp, _: sp.std_dev_per_mean(), first),
            BOTableColumn("std / best mean", "{:5.5%}", lambda sp, means: sp.std_dev() / min(means), first),
            BOTableColumn("std / mean of first impl", "{:5.5%}", lambda sp, means: sp.std_dev() / means[0], first),
            BOTableColumn("median", "{:5.5f}", lambda sp, _: sp.median(), first)
        ]
        html = """
        Input: {input}
        The following plot shows the actual distribution of the measurements for each implementation.
        {box_plot}
        """.format(h=h_level, input=repr(self.input), box_plot=self.get_box_plot_html(base_file_name))
        html += self.table_html_for_vals_per_impl(columns, base_file_name)
        return html
github parttimenerd / temci / temci / misc / game.py View on Github external
def get_html(self, base_file_name: str, h_level: int) -> str:
        sp = None # type: SingleProperty
        columns = [
            BOTableColumn("n", "{:5d}", lambda sp, _: sp.observations(), first),
            BOTableColumn("mean", "{:10.5f}", lambda sp, _: sp.mean(), first),
            BOTableColumn("mean / best mean", "{:5.5%}", lambda sp, means: sp.mean() / min(means), first),
            BOTableColumn("mean / mean of first impl", "{:5.5%}", lambda sp, means: sp.mean() / means[0], first),
            BOTableColumn("std / mean", "{:5.5%}", lambda sp, _: sp.std_dev_per_mean(), first),
            BOTableColumn("std / best mean", "{:5.5%}", lambda sp, means: sp.std_dev() / min(means), first),
            BOTableColumn("std / mean of first impl", "{:5.5%}", lambda sp, means: sp.std_dev() / means[0], first),
            BOTableColumn("median", "{:5.5f}", lambda sp, _: sp.median(), first)
        ]
        html = """
        Input: {input}
        The following plot shows the actual distribution of the measurements for each implementation.
        {box_plot}
        """.format(h=h_level, input=repr(self.input), box_plot=self.get_box_plot_html(base_file_name))
        html += self.table_html_for_vals_per_impl(columns, base_file_name)
        return html
github parttimenerd / temci / temci / misc / game.py View on Github external
def get_html(self, base_file_name: str, h_level: int) -> str:
        sp = None # type: SingleProperty
        columns = [
            BOTableColumn("n", "{:5d}", lambda sp, _: sp.observations(), first),
            BOTableColumn("mean", "{:10.5f}", lambda sp, _: sp.mean(), first),
            BOTableColumn("mean / best mean", "{:5.5%}", lambda sp, means: sp.mean() / min(means), first),
            BOTableColumn("mean / mean of first impl", "{:5.5%}", lambda sp, means: sp.mean() / means[0], first),
            BOTableColumn("std / mean", "{:5.5%}", lambda sp, _: sp.std_dev_per_mean(), first),
            BOTableColumn("std / best mean", "{:5.5%}", lambda sp, means: sp.std_dev() / min(means), first),
            BOTableColumn("std / mean of first impl", "{:5.5%}", lambda sp, means: sp.std_dev() / means[0], first),
            BOTableColumn("median", "{:5.5f}", lambda sp, _: sp.median(), first)
        ]
        html = """
        Input: {input}
        The following plot shows the actual distribution of the measurements for each implementation.
        {box_plot}
        """.format(h=h_level, input=repr(self.input), box_plot=self.get_box_plot_html(base_file_name))
        html += self.table_html_for_vals_per_impl(columns, base_file_name)
        return html
github parttimenerd / temci / temci / misc / game.py View on Github external
mean_score_std_column = lambda: BOTableColumn({
    Mode.geom_mean_rel_to_best: "mean score std (gmean std(mean / best mean))",
    Mode.mean_rel_to_first: "mean score std (gmean std(mean / mean of first impl))",
    Mode.mean_rel_to_one: "mean score std (std(mean / 1))"
}[CALC_MODE], "{:5.1%}", used_rel_mean_property, used_summarize_mean_std)
mean_rel_std = lambda: BOTableColumn({
github parttimenerd / temci / temci / misc / game.py View on Github external
def table_html_for_vals_per_impl(self, columns: t.List[t.Union[BOTableColumn, t.Callable[[], BOTableColumn]]],
                                     base_file_name: str,
                                     x_per_impl_func: t.Callable[[StatProperty], t.Dict[str, t.List[float]]] = None) \
            -> str:
        """
        Returns the html for a table that has a row for each implementation and several columns (the first is the
        implementation column).
        """
        columns = [col() if not isinstance(col, BOTableColumn) else col for col in columns]
        tex = """
        \\begin{{tabular}}{{l{cs}}}\\toprule
           & {header} \\\\ \\midrule
        """.format(cs="".join("r" * len(columns)), header=" & ".join(col.title for col in columns))
        html = """
        {header}
        """.format(header="".join("".format(col.title) for col in columns))
        cells = [["", ]]
        for col in columns:
            cells[0].append(col.title)
        values = InsertionTimeOrderedDict() # t.Dict[t.List[str]]
        for (i, col) in enumerate(columns):
            xes = self.get_reduced_x_per_impl(col.property, col.reduce, x_per_impl_func)
            for (j, impl) in enumerate(xes):
                if impl not in values:<table class="table">
            <tbody><tr><th></th></tr><tr><th>{}</th></tr></tbody></table>
github parttimenerd / temci / temci / misc / game.py View on Github external
def get_html(self, base_file_name: str, h_level: int) -&gt; str:
        sp = None # type: SingleProperty
        columns = [
            BOTableColumn("n", "{:5d}", lambda sp, _: sp.observations(), first),
            BOTableColumn("mean", "{:10.5f}", lambda sp, _: sp.mean(), first),
            BOTableColumn("mean / best mean", "{:5.5%}", lambda sp, means: sp.mean() / min(means), first),
            BOTableColumn("mean / mean of first impl", "{:5.5%}", lambda sp, means: sp.mean() / means[0], first),
            BOTableColumn("std / mean", "{:5.5%}", lambda sp, _: sp.std_dev_per_mean(), first),
            BOTableColumn("std / best mean", "{:5.5%}", lambda sp, means: sp.std_dev() / min(means), first),
            BOTableColumn("std / mean of first impl", "{:5.5%}", lambda sp, means: sp.std_dev() / means[0], first),
            BOTableColumn("median", "{:5.5f}", lambda sp, _: sp.median(), first)
        ]
        html = """
        Input: {input}
        The following plot shows the actual distribution of the measurements for each implementation.
        {box_plot}
        """.format(h=h_level, input=repr(self.input), box_plot=self.get_box_plot_html(base_file_name))
        html += self.table_html_for_vals_per_impl(columns, base_file_name)
        return html
github parttimenerd / temci / temci / misc / game.py View on Github external
mean_score_column = lambda: BOTableColumn({
    Mode.geom_mean_rel_to_best: "mean score (gmean(mean / best mean))",
    Mode.mean_rel_to_first: "mean score (gmean(mean / mean of first impl))",
    Mode.mean_rel_to_one: "mean score (mean(mean / 1))"
}[CALC_MODE], "{:5.1%}", used_rel_mean_property, used_summarize_mean)
mean_score_std_column = lambda: BOTableColumn({