game.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:temci 作者: parttimenerd 项目源码 文件源码
def get_html(self, base_file_name: str, h_level: int) -> str:
        html = """
            <h{}>{}</h{}>
        """.format(h_level, self.name, h_level)
        scores = self.get_impl_mean_scores()
        std_devs = self.get_statistical_property_scores(rel_std_dev_func)
        if len(self.programs) > 1:
            html += """
                Mean scores per implementation for this program category
                <p>
            """
            html += self.get_box_plot_html(base_file_name)
            html += """
                </p>
                <table class="table">
                    <tr><th>implementation</th><th>geom mean over means relative to best (per input and program) aka mean score</th>
                    <th>... std devs relative to the best means </th>
                    </tr>
            """
            for impl in scores.keys():
                html += """
                    <tr><td>{}</td><td>{:5.2%}</td><td>{:5.2%}</td></tr>
                """.format(impl, scores[impl], std_devs[impl])
            html += "</table>"
            if len(self.get_input_strs()) > 1:
                html += """
                <h{h}> Mean scores per input</h{h}>
                """.format(h=h_level + 1)
                for input in self.get_input_strs():
                    mean_scores = self.get_statistical_property_scores_per_input_per_impl(rel_mean_func, input)
                    std_scores = self.get_statistical_property_scores_per_input_per_impl(rel_std_dev_func, input)
                    html += """
                        <h{h}>Mean scores for input {!r}</h{h}>
                        The plot shows the distribution of mean scores per program for each implementation.
                        <p>
                    """.format(input, h=h_level + 2)
                    html += self.get_box_plot_per_input_per_impl_html(base_file_name, input)
                    html += """
                        </p>
                        <table class="table">
                            <tr><th>impl</th><th>geom mean over means relative to best (per program) aka mean score</th>
                            <th>... std devs relative to the best means </th>
                            </tr>
                    """
                    for impl in mean_scores.keys():
                        html += """
                            <tr><td>{}</td><td>{:5.2%}</td><td>{:5.2%}</td></tr>
                        """.format(impl, stats.gmean(mean_scores[impl]), stats.gmean(std_scores[impl]))
                    html += "</table>"
        impl_names = list(scores.keys())
        for (i, prog) in enumerate(self.programs):
            html += self.programs[prog].get_html(base_file_name + "_" + html_escape_property(prog), h_level + 1)
        return html
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号