Commit 7b97eea9 authored by Anthony Larcher's avatar Anthony Larcher
Browse files

doc

parent 3cde4446
......@@ -344,11 +344,11 @@
<span class="n">warnings</span><span class="o">.</span><span class="n">simplefilter</span><span class="p">(</span><span class="s1">&#39;ignore&#39;</span><span class="p">,</span> <span class="ne">RuntimeWarning</span><span class="p">)</span>
<span class="n">tmp_stat0</span> <span class="o">=</span> <span class="n">multiprocessing</span><span class="o">.</span><span class="n">Array</span><span class="p">(</span><span class="n">ct</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">stat0</span><span class="o">.</span><span class="n">size</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">stat0</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ctypeslib</span><span class="o">.</span><span class="n">as_array</span><span class="p">(</span><span class="n">tmp_stat0</span><span class="o">.</span><span class="n">get_obj</span><span class="p">())</span>
<span class="bp">self</span><span class="o">.</span><span class="n">stat0</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">stat0</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">segset</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">ubm</span><span class="o">.</span><span class="n">distrib_nb</span><span class="p">())</span>
<span class="bp">self</span><span class="o">.</span><span class="n">stat0</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">stat0</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">segset</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">distrib_nb</span><span class="p">)</span>
<span class="n">tmp_stat1</span> <span class="o">=</span> <span class="n">multiprocessing</span><span class="o">.</span><span class="n">Array</span><span class="p">(</span><span class="n">ct</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">stat1</span><span class="o">.</span><span class="n">size</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">stat1</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">ctypeslib</span><span class="o">.</span><span class="n">as_array</span><span class="p">(</span><span class="n">tmp_stat1</span><span class="o">.</span><span class="n">get_obj</span><span class="p">())</span>
<span class="bp">self</span><span class="o">.</span><span class="n">stat1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">stat1</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">segset</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">ubm</span><span class="o">.</span><span class="n">sv_size</span><span class="p">())</span>
<span class="bp">self</span><span class="o">.</span><span class="n">stat1</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">stat1</span><span class="o">.</span><span class="n">reshape</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">segset</span><span class="o">.</span><span class="n">shape</span><span class="p">[</span><span class="mi">0</span><span class="p">],</span> <span class="n">feature_size</span> <span class="o">*</span> <span class="n">distrib_nb</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">stat0</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">tmp</span><span class="o">.</span><span class="n">stat0</span><span class="p">)</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">STAT_TYPE</span><span class="p">)</span>
<span class="bp">self</span><span class="o">.</span><span class="n">stat1</span> <span class="o">=</span> <span class="n">copy</span><span class="o">.</span><span class="n">deepcopy</span><span class="p">(</span><span class="n">tmp</span><span class="o">.</span><span class="n">stat1</span><span class="p">)</span><span class="o">.</span><span class="n">astype</span><span class="p">(</span><span class="n">STAT_TYPE</span><span class="p">)</span>
......@@ -1020,7 +1020,7 @@
<span class="n">index_map</span> <span class="o">=</span> <span class="n">numpy</span><span class="o">.</span><span class="n">repeat</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">arange</span><span class="p">(</span><span class="n">ubm</span><span class="o">.</span><span class="n">distrib_nb</span><span class="p">()),</span> <span class="n">ubm</span><span class="o">.</span><span class="n">dim</span><span class="p">())</span>
<span class="c1"># Adapt mean vectors</span>
<span class="n">alpha</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">stat0</span> <span class="o">+</span> <span class="n">numpy</span><span class="o">.</span><span class="n">finfo</span><span class="p">(</span><span class="n">np</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span><span class="o">.</span><span class="n">eps</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">stat0</span> <span class="o">+</span> <span class="n">numpy</span><span class="o">.</span><span class="n">finfo</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span><span class="o">.</span><span class="n">eps</span> <span class="o">+</span> <span class="n">r</span><span class="p">)</span> <span class="c1"># Adaptation coefficient</span>
<span class="n">alpha</span> <span class="o">=</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">stat0</span> <span class="o">+</span> <span class="n">numpy</span><span class="o">.</span><span class="n">finfo</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span><span class="o">.</span><span class="n">eps</span><span class="p">)</span> <span class="o">/</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">stat0</span> <span class="o">+</span> <span class="n">numpy</span><span class="o">.</span><span class="n">finfo</span><span class="p">(</span><span class="n">numpy</span><span class="o">.</span><span class="n">float32</span><span class="p">)</span><span class="o">.</span><span class="n">eps</span> <span class="o">+</span> <span class="n">r</span><span class="p">)</span>
<span class="n">M</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">stat1</span> <span class="o">/</span> <span class="bp">self</span><span class="o">.</span><span class="n">stat0</span><span class="p">[:,</span> <span class="n">index_map</span><span class="p">]</span>
<span class="n">M</span><span class="p">[</span><span class="n">numpy</span><span class="o">.</span><span class="n">isnan</span><span class="p">(</span><span class="n">M</span><span class="p">)]</span> <span class="o">=</span> <span class="mi">0</span> <span class="c1"># Replace NaN due to divide by zeros</span>
<span class="n">M</span> <span class="o">=</span> <span class="n">alpha</span><span class="p">[:,</span> <span class="n">index_map</span><span class="p">]</span> <span class="o">*</span> <span class="n">M</span> <span class="o">+</span> <span class="p">(</span><span class="mi">1</span> <span class="o">-</span> <span class="n">alpha</span><span class="p">[:,</span> <span class="n">index_map</span><span class="p">])</span> <span class="o">*</span> \
......
This diff is collapsed.
......@@ -228,4 +228,4 @@ The following results should be obtained at the end of this tutorial:
.. image:: rsr2015_gmm-ubm.pdf
.. image:: rsr2015_gmm-ubm.png
......@@ -301,6 +301,6 @@ Plot DET curve and compute minDCF and EER
After running this script you should obtain the following curve
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. image:: rsr2015_svm_nap.pdf
.. image:: rsr2015_svm_nap.png
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment