def test_build_to_other_relative_path(self): filepath = './some_doc_path/' doc_name = 'Doc name' doc = Document(doc_name, filepath=filepath) doc += 'Some text' try: doc.build(show_pdf=False) assert os.path.exists(filepath + doc_name + '.tex') assert os.path.exists(filepath + doc_name + '.pdf') finally: shutil.rmtree('./some_doc_path/')
def test_build_with_relative_path_from_source(self): filepath = './some_doc_path/' doc_name = 'Doc name' doc = Document(doc_name, filepath=filepath) doc += 'Some text' try: doc.build(show_pdf=False, build_from_dir='source') assert os.path.exists(filepath + doc_name + '.tex') assert os.path.exists(filepath + doc_name + '.pdf') finally: if os.path.exists(filepath): shutil.rmtree(filepath)
def test_deletes_files_all(self): filepath = './some_doc_path/' doc_name = 'doc_name' doc = Document(doc_name, filepath=filepath) doc += 'Some text' try: doc.build(show_pdf=False, delete_files='all') assert not os.path.exists(filepath + doc_name + '.tex') assert os.path.exists(filepath + doc_name + '.pdf') finally: shutil.rmtree('./some_doc_path/')
def test_deletes_files_aux_and_log(self): filepath = './some_doc_path/' doc_name = 'doc_name' doc = Document(doc_name, filepath=filepath) doc += 'Some text' try: doc.build(show_pdf=False, delete_files=['aux', 'log']) assert not os.path.exists(filepath + doc_name + '.aux') assert not os.path.exists(filepath + doc_name + '.log') assert os.path.exists(filepath + doc_name + '.pdf') assert os.path.exists(filepath + doc_name + '.tex') finally: if os.path.exists(filepath): shutil.rmtree(filepath)
def test_build_with_options(self): doc = Document('With options', doc_type='standalone', options=['12pt', 'Spam'], egg=42) assert doc.build(False, False, False) == cleandoc(r'''\documentclass[12pt, Spam, egg=42]{standalone} \usepackage[utf8]{inputenc} \usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry} \begin{document} \end{document}''')
def write(self, output_path): if not os.path.exists(output_path): os.makedirs(output_path) doc = Document(filename='table4', filepath=output_path, doc_type='article', options=('12pt', )) doc.add_to_preamble(r"\usepgfplotslibrary{fillbetween}") doc.add_to_preamble(r'\usepgfplotslibrary{colorbrewer}') doc.add_to_preamble(r'\pgfplotsset{compat=1.15, colormap/Blues}') sec = doc.new_section('All graphs') self.write_CSLS(sec, output_path) self.write_vocabulary_cutoff(sec, output_path) self.write_stochastic(sec, output_path) doc.build(save_to_disk=True, compile_to_pdf=False, show_pdf=False)
def write(self, output_path): if not os.path.exists(output_path): os.makedirs(output_path) doc = Document(filename='grid_search_experiments', filepath=output_path, doc_type='article', options=('12pt', )) doc.add_to_preamble(r"\usepgfplotslibrary{fillbetween}") doc.add_to_preamble(r'\usepgfplotslibrary{colorbrewer}') doc.add_to_preamble( r'\pgfplotsset{compat=1.15, colormap/Blues, every axis/.append style={label style={font=\footnotesize}, tick label style={font=\footnotesize}}}' ) sec = doc.new_section('All graphs') self.write_CSLS(sec, output_path) self.write_vocabulary_cutoff(sec, output_path) self.write_stochastic(sec, output_path) doc.build(save_to_disk=True, compile_to_pdf=False, show_pdf=False)
def test_preamble_appears_in_document(self): doc = Document('test') colored_text = textcolor(Color(1, 0, 0, color_name='my_color'), 'hello') doc += colored_text assert doc.build(False, False, False) == cleandoc(r''' \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry} \usepackage[dvipsnames]{xcolor} \definecolor{my_color}{rgb}{1,0,0} \begin{document} \textcolor{my_color}{hello} \end{document}''')
def test_preamble_appears_in_document(self): doc = Document('test') color = Color(1, 2, 3) command = TexCommand('somecommand', 'param', options=[color]) doc += command assert doc.build(False, False, False) == cleandoc(r''' \documentclass{article} \usepackage[utf8]{inputenc} \usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry} \definecolor{color1}{rgb}{1,2,3} \begin{document} \somecommand{param}[color1] \end{document}''')
def plot_palette( doc_name, palette, n_colors=5, width=5, height=1, ): palette.n_colors = n_colors palette.tex_colors = [] palette._init_colors() color_width = width / n_colors tikzpic = TexEnvironment('tikzpicture') tikzpic.add_package('tikz') for i, color in zip(range(n_colors), palette): pos = i * color_width tikzpic += f'\\fill[draw, {build(color, tikzpic)}] ({pos},0) rectangle ({pos+color_width},{height});' doc = Document(doc_name, filepath='./palettes/', doc_type='standalone') doc += tikzpic doc.build(delete_files=['log', 'aux'])
def test_build_with_body_and_packages(self): doc = Document('With options', doc_type='standalone', options=['12pt', 'Spam'], egg=42) doc.add_package('tikz') sec = doc.new_section('Section', label='Section') sec.add_text('Hey') assert doc.build(False, False, False) == cleandoc(r'''\documentclass[12pt, Spam, egg=42]{standalone} \usepackage[utf8]{inputenc} \usepackage[top=2.5cm, bottom=2.5cm, left=2.5cm, right=2.5cm]{geometry} \usepackage{tikz} \begin{document} \begin{section}{Section} \label{section:Section} Hey \end{section} \end{document}''')
xticklabel_style='{font=\\footnotesize}', xtick_style='{draw=none}', ytick_style='{draw=none}', ) plot.axis.options += ( 'nodes near coords', 'every node near coord/.append style={font=\\scriptsize}', ) plot.add_plot(x, y1, 'fill', draw='none', legend='Modèle 1') plot.add_plot(x, y2, 'fill', draw='none', legend='Modèle 2') plot.legend_position = 'north west' plot.y_min = 0 plot.y_max = 79 plot.x_min = 0.5 plot.x_ticks = x plot.x_ticks_labels = labels plot.x_label = 'Datasets' plot.y_label = "Précision (\%)" doc = Document('bar_chart_example', filepath='./examples/', doc_type='standalone') doc += plot doc.build(delete_files=['log', 'aux'])
from python2latex import Document, Plot import numpy as np # Document type 'standalone' will only show the plot, but does not support all tex environments. filepath = './examples/simple plot example/' filename = 'simple_plot_example' doc = Document(filename, doc_type='standalone', filepath=filepath) # Create the data X = np.linspace(0,2*np.pi,100) Y1 = np.sin(X) Y2 = np.cos(X) # Create a plot plot = doc.new(Plot(X, Y1, X, Y2, plot_path=filepath, as_float_env=False)) tex = doc.build()
from python2latex import Document doc = Document(filename='simple_document_example', filepath='./examples/simple document example', doc_type='article', options=('12pt',)) doc.set_margins(top='3cm', bottom='3cm', margins='2cm') sec = doc.new_section('Spam and Egg', label='spam_egg') sec.add_text('The Monty Python slays the Spam and eats the Egg.') tex = doc.build() # Builds to tex and compile to pdf print(tex) # Prints the tex string that generated the pdf
def write(self, output_path): if not os.path.exists(output_path): os.makedirs(output_path) experiment = self.experiments['Reproduced Results'] metrics = experiment.aggregate_runs() doc = Document(filename='table1', filepath=output_path, doc_type='article', options=('12pt', )) sec = doc.new_section('Table 1') col, row = 17, 4 table = sec.new( LatexTable(shape=(row, col), alignment=['l'] + ['c'] * 16, float_format='.1f', label='original_results')) table.caption = self.CAPTION table.label_pos = 'bottom' # Main header table[0, 1:5].multicell(bold('EN-DE'), h_align='c') table[0, 5:9].multicell(bold('EN-ES'), h_align='c') table[0, 9:13].multicell(bold('EN-FI'), h_align='c') table[0, 13:17].multicell(bold('EN-IT'), h_align='c') table[0, 1:5].add_rule(trim_left=True, trim_right='.3em') table[0, 5:9].add_rule(trim_left='.3em', trim_right='.3em') table[0, 9:13].add_rule(trim_left='.3em', trim_right='.3em') table[0, 13:17].add_rule(trim_left='.3em', trim_right=True) # Sub header table[1, 1:17] = (['best', 'avg', 's', 't'] * 4) table[1, 0:17].add_rule(trim_left=True, trim_right=True) table[2, 0] = 'Original' table[2, 1] = self.ORIGINAL_RESULTS['de']['best'] table[2, 2] = self.ORIGINAL_RESULTS['de']['avg'] table[2, 3] = self.ORIGINAL_RESULTS['de']['successful'] table[2, 4] = self.ORIGINAL_RESULTS['de']['time'] table[2, 5] = self.ORIGINAL_RESULTS['es']['best'] table[2, 6] = self.ORIGINAL_RESULTS['es']['avg'] table[2, 7] = self.ORIGINAL_RESULTS['es']['successful'] table[2, 8] = self.ORIGINAL_RESULTS['es']['time'] table[2, 9] = self.ORIGINAL_RESULTS['fi']['best'] table[2, 10] = self.ORIGINAL_RESULTS['fi']['avg'] table[2, 11] = self.ORIGINAL_RESULTS['fi']['successful'] table[2, 12] = self.ORIGINAL_RESULTS['fi']['time'] table[2, 13] = self.ORIGINAL_RESULTS['it']['best'] table[2, 14] = self.ORIGINAL_RESULTS['it']['avg'] table[2, 15] = self.ORIGINAL_RESULTS['it']['successful'] table[2, 16] = self.ORIGINAL_RESULTS['it']['time'] table[3, 0] = bold('Reproduced') table[3, 1] = np.max(metrics['accuracies']['de']) table[3, 2] = np.average(metrics['accuracies']['de']) table[3, 3] = np.sum(np.array(metrics['accuracies']['de']) > 1.0) / len( metrics['accuracies']['de']) table[3, 4] = np.average(metrics['times']['de']) table[3, 5] = np.max(metrics['accuracies']['es']) table[3, 6] = np.average(metrics['accuracies']['es']) table[3, 7] = np.sum(np.array(metrics['accuracies']['es']) > 1.0) / len( metrics['accuracies']['es']) table[3, 8] = np.average(metrics['times']['es']) table[3, 9] = np.max(metrics['accuracies']['fi']) table[3, 10] = np.average(metrics['accuracies']['fi']) table[3, 11] = np.sum(np.array(metrics['accuracies']['fi']) > 1.0) / len( metrics['accuracies']['fi']) table[3, 12] = np.average(metrics['times']['fi']) table[3, 13] = np.max(metrics['accuracies']['it']) table[3, 14] = np.average(metrics['accuracies']['it']) table[3, 15] = np.sum(np.array(metrics['accuracies']['it']) > 1.0) / len( metrics['accuracies']['it']) table[3, 16] = np.average(metrics['times']['it']) tex = doc.build(save_to_disk=True, compile_to_pdf=False, show_pdf=False)
def write(self, output_path): if not os.path.exists(output_path): os.makedirs(output_path) experiment = self.experiments['Other Languages'] metrics = experiment.aggregate_runs() random_experiment = self.experiments[ 'Other Languages Unsup. Init (Random)'] random_metrics = random_experiment.aggregate_runs() random_cutoff_experiment = self.experiments[ 'Other Languages Unsup. Init (Random Cutoff)'] random_cutoff_metrics = random_cutoff_experiment.aggregate_runs() stochastic_experiment = self.experiments['Other Languages Stochastic'] stochastic_metrics = stochastic_experiment.aggregate_runs() csls_experiment = self.experiments['Other Languages CSLS'] csls_metrics = csls_experiment.aggregate_runs() bidirectional_experiment = self.experiments[ 'Other Languages Bidrectional'] bidirectional_metrics = bidirectional_experiment.aggregate_runs() reweighting_experiment = self.experiments[ 'Other Languages Re-weighting'] reweighting_metrics = reweighting_experiment.aggregate_runs() doc = Document(filename='table3', filepath=output_path, doc_type='article', options=('12pt', )) sec = doc.new_section('Table 3') col, row = 17, 9 table = sec.new( LatexTable(shape=(row, col), alignment=['l'] + ['c'] * 16, float_format='.1f', label='other_languages_results')) table.caption = self.CAPTION table.label_pos = 'bottom' # Main header table[0, 1:5].multicell(bold('EN-ET'), h_align='c') table[0, 5:9].multicell(bold('EN-FA'), h_align='c') table[0, 9:13].multicell(bold('EN-LV'), h_align='c') table[0, 13:17].multicell(bold('EN-VI'), h_align='c') table[0, 1:5].add_rule(trim_left=True, trim_right='.3em') table[0, 5:9].add_rule(trim_left='.3em', trim_right='.3em') table[0, 9:13].add_rule(trim_left='.3em', trim_right='.3em') table[0, 13:17].add_rule(trim_left='.3em', trim_right=True) # Sub header table[1, 1:17] = (['best', 'avg', 's', 't'] * 4) table[1, 0:17].add_rule(trim_left=True, trim_right=True) table[2, 0] = bold('Vecmap') table[2, 1] = np.max(metrics['accuracies']['et']) table[2, 2] = np.average(metrics['accuracies']['et']) table[2, 3] = np.sum(np.array(metrics['accuracies']['et']) > 1.0) / len( metrics['accuracies']['et']) table[2, 4] = np.average(metrics['times']['et']) table[2, 5] = np.max(metrics['accuracies']['fa']) table[2, 6] = np.average(metrics['accuracies']['fa']) table[2, 7] = np.sum(np.array(metrics['accuracies']['fa']) > 1.0) / len( metrics['accuracies']['fa']) table[2, 8] = np.average(metrics['times']['fa']) table[2, 9] = np.max(metrics['accuracies']['lv']) table[2, 10] = np.average(metrics['accuracies']['lv']) table[2, 11] = np.sum(np.array(metrics['accuracies']['lv']) > 1.0) / len( metrics['accuracies']['lv']) table[2, 12] = np.average(metrics['times']['lv']) table[2, 13] = np.max(metrics['accuracies']['vi']) table[2, 14] = np.average(metrics['accuracies']['vi']) table[2, 15] = np.sum(np.array(metrics['accuracies']['vi']) > 1.0) / len( metrics['accuracies']['vi']) table[2, 16] = np.average(metrics['times']['vi']) table[3, 0] = bold('- Unsupervised (Random)') table[3, 1] = np.max(random_metrics['accuracies']['et']) table[3, 2] = np.average(random_metrics['accuracies']['et']) table[3, 3] = np.sum( np.array(random_metrics['accuracies']['et']) > 1.0) / len( metrics['accuracies']['et']) table[3, 4] = np.average(random_metrics['times']['et']) table[3, 5] = np.max(random_metrics['accuracies']['fa']) table[3, 6] = np.average(random_metrics['accuracies']['fa']) table[3, 7] = np.sum( np.array(random_metrics['accuracies']['fa']) > 1.0) / len( metrics['accuracies']['fa']) table[3, 8] = np.average(random_metrics['times']['fa']) table[3, 9] = np.max(random_metrics['accuracies']['lv']) table[3, 10] = np.average(random_metrics['accuracies']['lv']) table[3, 11] = np.sum( np.array(random_metrics['accuracies']['lv']) > 1.0) / len( metrics['accuracies']['lv']) table[3, 12] = np.average(random_metrics['times']['lv']) table[3, 13] = np.max(random_metrics['accuracies']['vi']) table[3, 14] = np.average(random_metrics['accuracies']['vi']) table[3, 15] = np.sum( np.array(random_metrics['accuracies']['vi']) > 1.0) / len( metrics['accuracies']['vi']) table[3, 16] = np.average(random_metrics['times']['vi']) table[4, 0] = bold('- Unsupervised (Random Cutoff)') table[4, 1] = np.max(random_cutoff_metrics['accuracies']['et']) table[4, 2] = np.average(random_cutoff_metrics['accuracies']['et']) table[4, 3] = np.sum( np.array(random_cutoff_metrics['accuracies']['et']) > 1.0) / len( metrics['accuracies']['et']) table[4, 4] = np.average(random_cutoff_metrics['times']['et']) table[4, 5] = np.max(random_cutoff_metrics['accuracies']['fa']) table[4, 6] = np.average(random_cutoff_metrics['accuracies']['fa']) table[4, 7] = np.sum( np.array(random_cutoff_metrics['accuracies']['fa']) > 1.0) / len( metrics['accuracies']['fa']) table[4, 8] = np.average(random_cutoff_metrics['times']['fa']) table[4, 9] = np.max(random_cutoff_metrics['accuracies']['lv']) table[4, 10] = np.average(random_cutoff_metrics['accuracies']['lv']) table[4, 11] = np.sum( np.array(random_cutoff_metrics['accuracies']['lv']) > 1.0) / len( metrics['accuracies']['lv']) table[4, 12] = np.average(random_cutoff_metrics['times']['lv']) table[4, 13] = np.max(random_cutoff_metrics['accuracies']['vi']) table[4, 14] = np.average(random_cutoff_metrics['accuracies']['vi']) table[4, 15] = np.sum( np.array(random_cutoff_metrics['accuracies']['vi']) > 1.0) / len( metrics['accuracies']['vi']) table[4, 16] = np.average(random_cutoff_metrics['times']['vi']) table[5, 0] = bold('- Stochastic') table[5, 1] = np.max(stochastic_metrics['accuracies']['et']) table[5, 2] = np.average(stochastic_metrics['accuracies']['et']) table[5, 3] = np.sum( np.array(stochastic_metrics['accuracies']['et']) > 1.0) / len( metrics['accuracies']['et']) table[5, 4] = np.average(stochastic_metrics['times']['et']) table[5, 5] = np.max(stochastic_metrics['accuracies']['fa']) table[5, 6] = np.average(stochastic_metrics['accuracies']['fa']) table[5, 7] = np.sum( np.array(stochastic_metrics['accuracies']['fa']) > 1.0) / len( metrics['accuracies']['fa']) table[5, 8] = np.average(stochastic_metrics['times']['fa']) table[5, 9] = np.max(stochastic_metrics['accuracies']['lv']) table[5, 10] = np.average(stochastic_metrics['accuracies']['lv']) table[5, 11] = np.sum( np.array(stochastic_metrics['accuracies']['lv']) > 1.0) / len( metrics['accuracies']['lv']) table[5, 12] = np.average(stochastic_metrics['times']['lv']) table[5, 13] = np.max(stochastic_metrics['accuracies']['vi']) table[5, 14] = np.average(stochastic_metrics['accuracies']['vi']) table[5, 15] = np.sum( np.array(stochastic_metrics['accuracies']['vi']) > 1.0) / len( metrics['accuracies']['vi']) table[5, 16] = np.average(stochastic_metrics['times']['vi']) table[6, 0] = bold('- CSLS') table[6, 1] = np.max(csls_metrics['accuracies']['et']) table[6, 2] = np.average(csls_metrics['accuracies']['et']) table[6, 3] = np.sum( np.array(csls_metrics['accuracies']['et']) > 1.0) / len( metrics['accuracies']['et']) table[6, 4] = np.average(csls_metrics['times']['et']) table[6, 5] = np.max(csls_metrics['accuracies']['fa']) table[6, 6] = np.average(csls_metrics['accuracies']['fa']) table[6, 7] = np.sum( np.array(csls_metrics['accuracies']['fa']) > 1.0) / len( metrics['accuracies']['fa']) table[6, 8] = np.average(csls_metrics['times']['fa']) table[6, 9] = np.max(csls_metrics['accuracies']['lv']) table[6, 10] = np.average(csls_metrics['accuracies']['lv']) table[6, 11] = np.sum( np.array(csls_metrics['accuracies']['lv']) > 1.0) / len( metrics['accuracies']['lv']) table[6, 12] = np.average(csls_metrics['times']['lv']) table[6, 13] = np.max(csls_metrics['accuracies']['vi']) table[6, 14] = np.average(csls_metrics['accuracies']['vi']) table[6, 15] = np.sum( np.array(csls_metrics['accuracies']['vi']) > 1.0) / len( metrics['accuracies']['vi']) table[6, 16] = np.average(csls_metrics['times']['vi']) table[7, 0] = bold('- Bidirectional') table[7, 1] = np.max(bidirectional_metrics['accuracies']['et']) table[7, 2] = np.average(bidirectional_metrics['accuracies']['et']) table[7, 3] = np.sum( np.array(bidirectional_metrics['accuracies']['et']) > 1.0) / len( metrics['accuracies']['et']) table[7, 4] = np.average(bidirectional_metrics['times']['et']) table[7, 5] = np.max(bidirectional_metrics['accuracies']['fa']) table[7, 6] = np.average(bidirectional_metrics['accuracies']['fa']) table[7, 7] = np.sum( np.array(bidirectional_metrics['accuracies']['fa']) > 1.0) / len( metrics['accuracies']['fa']) table[7, 8] = np.average(bidirectional_metrics['times']['fa']) table[7, 9] = np.max(bidirectional_metrics['accuracies']['lv']) table[7, 10] = np.average(bidirectional_metrics['accuracies']['lv']) table[7, 11] = np.sum( np.array(bidirectional_metrics['accuracies']['lv']) > 1.0) / len( metrics['accuracies']['lv']) table[7, 12] = np.average(bidirectional_metrics['times']['lv']) table[7, 13] = np.max(bidirectional_metrics['accuracies']['vi']) table[7, 14] = np.average(bidirectional_metrics['accuracies']['vi']) table[7, 15] = np.sum( np.array(bidirectional_metrics['accuracies']['vi']) > 1.0) / len( metrics['accuracies']['vi']) table[7, 16] = np.average(bidirectional_metrics['times']['vi']) table[8, 0] = bold('- Reweighting') table[8, 1] = np.max(reweighting_metrics['accuracies']['et']) table[8, 2] = np.average(reweighting_metrics['accuracies']['et']) table[8, 3] = np.sum( np.array(reweighting_metrics['accuracies']['et']) > 1.0) / len( metrics['accuracies']['et']) table[8, 4] = np.average(reweighting_metrics['times']['et']) table[8, 5] = np.max(reweighting_metrics['accuracies']['fa']) table[8, 6] = np.average(reweighting_metrics['accuracies']['fa']) table[8, 7] = np.sum( np.array(reweighting_metrics['accuracies']['fa']) > 1.0) / len( metrics['accuracies']['fa']) table[8, 8] = np.average(reweighting_metrics['times']['fa']) table[8, 9] = np.max(reweighting_metrics['accuracies']['lv']) table[8, 10] = np.average(reweighting_metrics['accuracies']['lv']) table[8, 11] = np.sum( np.array(reweighting_metrics['accuracies']['lv']) > 1.0) / len( metrics['accuracies']['lv']) table[8, 12] = np.average(reweighting_metrics['times']['lv']) table[8, 13] = np.max(reweighting_metrics['accuracies']['vi']) table[8, 14] = np.average(reweighting_metrics['accuracies']['vi']) table[8, 15] = np.sum( np.array(reweighting_metrics['accuracies']['vi']) > 1.0) / len( metrics['accuracies']['vi']) table[8, 16] = np.average(reweighting_metrics['times']['vi']) tex = doc.build(save_to_disk=True, compile_to_pdf=False, show_pdf=False)
def write(self, output_path): if not os.path.exists(output_path): os.makedirs(output_path) doc = Document(filename='table2', filepath=output_path, doc_type='article', options=('12pt', )) sec = doc.new_section('Table 2') col, row = 17, 17 table = sec.new( LatexTable(shape=(row, col), alignment=['l'] + ['c'] * 16, float_format='.1f', label='ablation_study')) table.caption = self.CAPTION table.label_pos = 'bottom' # Main header table[0, 1:5].multicell(bold('EN-DE'), h_align='c') table[0, 5:9].multicell(bold('EN-ES'), h_align='c') table[0, 9:13].multicell(bold('EN-FI'), h_align='c') table[0, 13:17].multicell(bold('EN-IT'), h_align='c') table[0, 1:5].add_rule(trim_left=True, trim_right='.3em') table[0, 5:9].add_rule(trim_left='.3em', trim_right='.3em') table[0, 9:13].add_rule(trim_left='.3em', trim_right='.3em') table[0, 13:17].add_rule(trim_left='.3em', trim_right=True) # Sub header table[1, 1:17] = (['best', 'avg', 's', 't'] * 4) table[1, 0:17].add_rule(trim_left=True, trim_right=True) ### Full system metrics table[2, 0] = 'Full System' table = self.write_original_row(table, 2, self.ORIGINAL_RESULTS['Full System']) experiment = self.experiments['Full System'] metrics = experiment.aggregate_runs() table[3, 0] = bold('Reproduced') table = self.write_new_row(table, 3, metrics) table[3, 0:17].add_rule(trim_left=True, trim_right=True) ### Unsup. Init table[4, 0] = '- Unsup. Init.' table = self.write_original_row(table, 4, self.ORIGINAL_RESULTS['Unsup. Init']) experiment = self.experiments['Unsup. Init (Random)'] metrics = experiment.aggregate_runs() table[5, 0] = bold('Rand.') table = self.write_new_row(table, 5, metrics) experiment = self.experiments['Unsup. Init (Random Cutoff)'] metrics = experiment.aggregate_runs() table[6, 0] = bold('Rand. Cut.') table = self.write_new_row(table, 6, metrics) table[6, 0:17].add_rule(trim_left=True, trim_right=True) ### Stochastic table[7, 0] = '- Stochastic' table = self.write_original_row(table, 7, self.ORIGINAL_RESULTS['Stochastic']) experiment = self.experiments['Stochastic'] metrics = experiment.aggregate_runs() table[8, 0] = bold('Reproduced') table = self.write_new_row(table, 8, metrics) table[8, 0:17].add_rule(trim_left=True, trim_right=True) ### Cutoff table[9, 0] = '- Cutoff (k=100k)' table = self.write_original_row( table, 9, self.ORIGINAL_RESULTS['Cutoff (k=100k)']) # experiment = self.experiments['Cutoff (k=100k)'] # metrics = experiment.aggregate_runs() table[10, 0] = bold('Reproduced') # table = self.write_new_row(table, 10, metrics) table[10, 1:] = ['-'] * 16 table[10, 0:17].add_rule(trim_left=True, trim_right=True) ### CSLS table[11, 0] = '- CSLS' table = self.write_original_row(table, 11, self.ORIGINAL_RESULTS['CSLS']) experiment = self.experiments['CSLS'] metrics = experiment.aggregate_runs() table[12, 0] = bold('Reproduced') table = self.write_new_row(table, 12, metrics) table[12, 0:17].add_rule(trim_left=True, trim_right=True) ### Bidrectional table[13, 0] = '- Bidrectional' table = self.write_original_row(table, 13, self.ORIGINAL_RESULTS['Bidrectional']) experiment = self.experiments['Bidrectional'] metrics = experiment.aggregate_runs() table[14, 0] = bold('Reproduced') table = self.write_new_row(table, 14, metrics) table[14, 0:17].add_rule(trim_left=True, trim_right=True) ### Re-weighting table[15, 0] = '- Re-weighting' table = self.write_original_row(table, 15, self.ORIGINAL_RESULTS['Re-weighting']) experiment = self.experiments['Re-weighting'] metrics = experiment.aggregate_runs() table[16, 0] = bold('Reproduced') table = self.write_new_row(table, 16, metrics) tex = doc.build(save_to_disk=True, compile_to_pdf=False, show_pdf=False)