Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
smilesun committed May 10, 2024
1 parent eac2583 commit a40cf96
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -324,13 +324,16 @@ <h1 id="modules-domainlab-utils-generate-benchmark-plots--page-root">Source code
matplotlib.use("Agg")

# header of the csv file:
# param_index, task, algo, epos, te_d, seed, params, acc, precision, recall, specificity, f1, auroc
# 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 17, 18, 19
# param_index, method, mname, commit, algo, epos, te_d, seed, params, acc, precision, recall, specificity, f1, auroc, acc_oracle, acc_val, model_selection_epoch, experiment_duration


COLNAME_METHOD = "method"
COLNAME_IDX_PARAM = "param_index"
COLNAME_PARAM = "params"
G_DF_TASK_COL = 1 # column in which the method name is saved
G_DF_PLOT_COL_METRIC_START = 9 # first 0-6 columns are not metric
G_DF_PLOT_COL_METRIC_END = 17 # first 0-6 columns are not metric


<div class="viewcode-block" id="gen_benchmark_plots"><a class="viewcode-back" href="../../../domainlab.utils.html#domainlab.utils.generate_benchmark_plots.gen_benchmark_plots">[docs]</a>def gen_benchmark_plots(
Expand Down Expand Up @@ -396,8 +399,7 @@ <h1 id="modules-domainlab-utils-generate-benchmark-plots--page-root">Source code
['param_index','task',' algo',' epos',' te_d',' seed',' params',' acc','precision',...]
"""
os.makedirs(output_dir, exist_ok=True)
obj = dataframe.columns[G_DF_PLOT_COL_METRIC_START:]

obj = dataframe.columns[G_DF_PLOT_COL_METRIC_START:G_DF_PLOT_COL_METRIC_END]
# boxplots
for objective in obj:
boxplot(
Expand Down Expand Up @@ -574,7 +576,7 @@ <h1 id="modules-domainlab-utils-generate-benchmark-plots--page-root">Source code
but also between the parameter setups
"""
dataframe = dataframe_in.copy()
index = list(range(G_DF_PLOT_COL_METRIC_START, dataframe.shape[1]))
index = list(range(G_DF_PLOT_COL_METRIC_START, G_DF_PLOT_COL_METRIC_END))
if distinguish_param_setups:
dataframe_ = dataframe.iloc[:, index]
dataframe_.insert(
Expand All @@ -587,7 +589,7 @@ <h1 id="modules-domainlab-utils-generate-benchmark-plots--page-root">Source code

g_p = sns.pairplot(data=dataframe_, hue="label", corner=True, kind=kind)
else:
index_ = list(range(G_DF_PLOT_COL_METRIC_START, dataframe.shape[1]))
index_ = list(range(G_DF_PLOT_COL_METRIC_START, G_DF_PLOT_COL_METRIC_END))
index_.insert(0, G_DF_TASK_COL)
dataframe_ = dataframe.iloc[:, index_]

Expand Down Expand Up @@ -724,7 +726,7 @@ <h1 id="modules-domainlab-utils-generate-benchmark-plots--page-root">Source code
else:
dataframe.insert(0, "label", dataframe[COLNAME_METHOD])
# we need "G_DF_PLOT_COL_METRIC_START + 1" as we did insert the columns 'label' at index 0
index = list(range(G_DF_PLOT_COL_METRIC_START + 1, dataframe.shape[1]))
index = list(range(G_DF_PLOT_COL_METRIC_START + 1, G_DF_PLOT_COL_METRIC_END))
num_lines = len(dataframe["label"].unique())
_, axis = plt.subplots(
figsize=(9, 9 + (0.28 * num_lines)), subplot_kw=dict(polar=True)
Expand Down
11 changes: 5 additions & 6 deletions docs/build/html/_sources/doc_benchmark.md.txt
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ the following after cd into the DomainLab directory:
```commandline
python main_out.py --agg_partial_bm OUTPUT_DIR
```
specifying the benchmark output directory containing the partially completed benchmark,
e.g. `./zoutput/benchmarks/demo_benchmark`, where `demo_benchmark` is a name defined in the yaml file.
where `OUTPUT_DIR` specifying the benchmark output directory containing the partially completed benchmark,
e.g. `./zoutput/benchmarks/demo_benchmark`, where `demo_benchmark` is a name defined in the benchmark yaml file.

Alternatively, one could use
```examples
Expand All @@ -155,10 +155,9 @@ Here for, the user must cd into the DomainLab directory and run
```commandline
python main_out.py --gen_plots CSV_FILE --outp_dir OUTPUT_DIR
```

specifying the path of the csv file of the aggregated results (e.g. `./zoutput/benchmarks/demo_benchmark/results.csv`)
and the output directory of the partially completed benchmark (e.g. `./zoutput/benchmarks/demo_benchmark`).
Note that the cvs file must have the same form as the one generated by the fully executed benchmark, i.e.
where `CSV_FILE` specifies the path of the csv file of the aggregated results (e.g. `./zoutput/benchmarks/demo_benchmark/results.csv`)
and `OUTPUT_DIR` specifies the output directory of the partially completed benchmark (e.g. `./zoutput/benchmarks/demo_benchmark`).
Note that the cvs file must have the same form as the one generated by the fully executed benchmark, e.g.



Expand Down
10 changes: 5 additions & 5 deletions docs/build/html/doc_benchmark.html
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,8 @@ <h3 id="obtain-partial-results">Obtain partial results<a class="headerlink" href
<div class="highlight-commandline notranslate"><div class="highlight"><pre><span></span>python main_out.py --agg_partial_bm OUTPUT_DIR
</pre></div>
</div>
<p>specifying the benchmark output directory containing the partially completed benchmark,
e.g. <code class="docutils literal notranslate"><span class="pre">./zoutput/benchmarks/demo_benchmark</span></code>, where <code class="docutils literal notranslate"><span class="pre">demo_benchmark</span></code> is a name defined in the yaml file.</p>
<p>where <code class="docutils literal notranslate"><span class="pre">OUTPUT_DIR</span></code> specifying the benchmark output directory containing the partially completed benchmark,
e.g. <code class="docutils literal notranslate"><span class="pre">./zoutput/benchmarks/demo_benchmark</span></code>, where <code class="docutils literal notranslate"><span class="pre">demo_benchmark</span></code> is a name defined in the benchmark yaml file.</p>
<p>Alternatively, one could use</p>
<div class="highlight-examples notranslate"><div class="highlight"><pre><span></span>cat ./zoutput/benchmarks/[name of the benchmark]/rule_results/*.csv &gt; result.csv
</pre></div>
Expand All @@ -498,9 +498,9 @@ <h3 id="generate-plots-from-csv-file">Generate plots from .csv file<a class="hea
<div class="highlight-commandline notranslate"><div class="highlight"><pre><span></span>python main_out.py --gen_plots CSV_FILE --outp_dir OUTPUT_DIR
</pre></div>
</div>
<p>specifying the path of the csv file of the aggregated results (e.g. <code class="docutils literal notranslate"><span class="pre">./zoutput/benchmarks/demo_benchmark/results.csv</span></code>)
and the output directory of the partially completed benchmark (e.g. <code class="docutils literal notranslate"><span class="pre">./zoutput/benchmarks/demo_benchmark</span></code>).
Note that the cvs file must have the same form as the one generated by the fully executed benchmark, i.e.</p>
<p>where <code class="docutils literal notranslate"><span class="pre">CSV_FILE</span></code> specifies the path of the csv file of the aggregated results (e.g. <code class="docutils literal notranslate"><span class="pre">./zoutput/benchmarks/demo_benchmark/results.csv</span></code>)
and <code class="docutils literal notranslate"><span class="pre">OUTPUT_DIR</span></code> specifies the output directory of the partially completed benchmark (e.g. <code class="docutils literal notranslate"><span class="pre">./zoutput/benchmarks/demo_benchmark</span></code>).
Note that the cvs file must have the same form as the one generated by the fully executed benchmark, e.g.</p>
<table>
<thead>
<tr class="row-odd"><th class="head"><p>param_index</p></th>
Expand Down
11 changes: 5 additions & 6 deletions docs/build/html/doc_benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ the following after cd into the DomainLab directory:
```commandline
python main_out.py --agg_partial_bm OUTPUT_DIR
```
specifying the benchmark output directory containing the partially completed benchmark,
e.g. `./zoutput/benchmarks/demo_benchmark`, where `demo_benchmark` is a name defined in the yaml file.
where `OUTPUT_DIR` specifying the benchmark output directory containing the partially completed benchmark,
e.g. `./zoutput/benchmarks/demo_benchmark`, where `demo_benchmark` is a name defined in the benchmark yaml file.

Alternatively, one could use
```examples
Expand All @@ -155,10 +155,9 @@ Here for, the user must cd into the DomainLab directory and run
```commandline
python main_out.py --gen_plots CSV_FILE --outp_dir OUTPUT_DIR
```

specifying the path of the csv file of the aggregated results (e.g. `./zoutput/benchmarks/demo_benchmark/results.csv`)
and the output directory of the partially completed benchmark (e.g. `./zoutput/benchmarks/demo_benchmark`).
Note that the cvs file must have the same form as the one generated by the fully executed benchmark, i.e.
where `CSV_FILE` specifies the path of the csv file of the aggregated results (e.g. `./zoutput/benchmarks/demo_benchmark/results.csv`)
and `OUTPUT_DIR` specifies the output directory of the partially completed benchmark (e.g. `./zoutput/benchmarks/demo_benchmark`).
Note that the cvs file must have the same form as the one generated by the fully executed benchmark, e.g.



Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/domainlab.utils.html
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,7 @@ <h2 id="submodules">Submodules<a class="headerlink" href="#submodules" title="Pe
<p>static logger class</p>
<dl class="py method">
<dt class="sig sig-object py" id="domainlab.utils.logger.Logger.get_logger">
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get_logger</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">logger_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'logger_733974'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">loglevel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'INFO'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/domainlab/utils/logger.html#Logger.get_logger"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#domainlab.utils.logger.Logger.get_logger" title="Permalink to this definition"></a></dt>
<em class="property"><span class="pre">static</span><span class="w"> </span></em><span class="sig-name descname"><span class="pre">get_logger</span></span><span class="sig-paren">(</span><em class="sig-param"><span class="n"><span class="pre">logger_name</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'logger_589187'</span></span></em>, <em class="sig-param"><span class="n"><span class="pre">loglevel</span></span><span class="o"><span class="pre">=</span></span><span class="default_value"><span class="pre">'INFO'</span></span></em><span class="sig-paren">)</span><a class="reference internal" href="_modules/domainlab/utils/logger.html#Logger.get_logger"><span class="viewcode-link"><span class="pre">[source]</span></span></a><a class="headerlink" href="#domainlab.utils.logger.Logger.get_logger" title="Permalink to this definition"></a></dt>
<dd><p>returns a logger
if no logger was created yet, it will create a logger with the name
specified in logger_name with the level specified in loglevel.
Expand Down
2 changes: 1 addition & 1 deletion docs/build/html/searchindex.js

Large diffs are not rendered by default.

0 comments on commit a40cf96

Please sign in to comment.