Skip to content

Commit

Permalink
deploy: 85316a4
Browse files Browse the repository at this point in the history
  • Loading branch information
nmcardoso committed Aug 22, 2023
1 parent f9b85c8 commit fb4779e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion _modules/mergernet/estimators/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,7 @@ <h1>Source code for mergernet.estimators.base</h1><div class="highlight"><pre>
<span class="kn">from</span> <span class="nn">typing</span> <span class="kn">import</span> <span class="n">Callable</span><span class="p">,</span> <span class="n">List</span><span class="p">,</span> <span class="n">Tuple</span><span class="p">,</span> <span class="n">Union</span>

<span class="kn">import</span> <span class="nn">tensorflow</span> <span class="k">as</span> <span class="nn">tf</span>
<span class="kn">import</span> <span class="nn">tensorflow_addons</span> <span class="k">as</span> <span class="nn">tfa</span>

<span class="kn">from</span> <span class="nn">mergernet.core.constants</span> <span class="kn">import</span> <span class="n">RANDOM_SEED</span>
<span class="kn">from</span> <span class="nn">mergernet.core.experiment</span> <span class="kn">import</span> <span class="n">Experiment</span>
Expand Down Expand Up @@ -689,7 +690,8 @@ <h1>Source code for mergernet.estimators.base</h1><div class="highlight"><pre>

<div class="viewcode-block" id="Estimator.get_metric"><a class="viewcode-back" href="../../../api/mergernet.estimators.base.Estimator.html#mergernet.estimators.base.Estimator.get_metric">[docs]</a> <span class="k">def</span> <span class="nf">get_metric</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">metric</span><span class="p">:</span> <span class="nb">str</span><span class="p">):</span>
<span class="k">if</span> <span class="n">metric</span> <span class="o">==</span> <span class="s1">&#39;f1&#39;</span><span class="p">:</span>
<span class="k">return</span> <span class="n">tf</span><span class="o">.</span><span class="n">keras</span><span class="o">.</span><span class="n">metrics</span><span class="o">.</span><span class="n">F1Score</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;f1&#39;</span><span class="p">,</span> <span class="n">average</span><span class="o">=</span><span class="s1">&#39;weighted&#39;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">tfa</span><span class="o">.</span><span class="n">metrics</span><span class="o">.</span><span class="n">F1Score</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;f1&#39;</span><span class="p">,</span> <span class="n">average</span><span class="o">=</span><span class="s1">&#39;weighted&#39;</span><span class="p">)</span>
<span class="c1"># return tf.keras.metrics.F1Score(name=&#39;f1&#39;, average=&#39;weighted&#39;) # tf 2.13</span>
<span class="k">elif</span> <span class="n">metric</span> <span class="o">==</span> <span class="s1">&#39;precision&#39;</span><span class="p">:</span>
<span class="k">return</span> <span class="n">tf</span><span class="o">.</span><span class="n">keras</span><span class="o">.</span><span class="n">metrics</span><span class="o">.</span><span class="n">Precision</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="s1">&#39;precision&#39;</span><span class="p">)</span>
<span class="k">elif</span> <span class="n">metric</span> <span class="o">==</span> <span class="s1">&#39;recall&#39;</span><span class="p">:</span>
Expand Down

0 comments on commit fb4779e

Please sign in to comment.