Skip to content

Commit

Permalink
deploy: 4857e4d
Browse files Browse the repository at this point in the history
  • Loading branch information
mieskolainen committed Oct 20, 2024
1 parent dd58723 commit a35e7c9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions _modules/icenet/deep/iceboost.html
Original file line number Diff line number Diff line change
Expand Up @@ -754,7 +754,7 @@ <h1>Source code for icenet.deep.iceboost</h1><div class="highlight"><pre>

<span class="n">SWD_loss</span> <span class="o">=</span> <span class="n">torch</span><span class="o">.</span><span class="n">tensor</span><span class="p">(</span><span class="mf">0.0</span><span class="p">)</span><span class="o">.</span><span class="n">to</span><span class="p">(</span><span class="n">device</span><span class="p">)</span>

<span class="k">if</span> <span class="n">SWD_param</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="k">if</span> <span class="p">(</span><span class="n">SWD_param</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">)</span> <span class="ow">and</span> <span class="p">(</span><span class="nb">abs</span><span class="p">(</span><span class="n">SWD_param</span><span class="p">[</span><span class="s2">&quot;beta&quot;</span><span class="p">])</span> <span class="o">&gt;</span> <span class="mf">1E-15</span><span class="p">):</span>

<span class="c1"># Total maximum is limited, pick random subsample</span>
<span class="k">if</span> <span class="n">SWD_param</span><span class="p">[</span><span class="s1">&#39;max_N&#39;</span><span class="p">]</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="n">targets</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="o">&gt;</span> <span class="n">SWD_param</span><span class="p">[</span><span class="s1">&#39;max_N&#39;</span><span class="p">]:</span>
Expand Down Expand Up @@ -1097,7 +1097,7 @@ <h1>Source code for icenet.deep.iceboost</h1><div class="highlight"><pre>

<span class="k">if</span> <span class="s1">&#39;opt_param&#39;</span> <span class="ow">in</span> <span class="n">param</span><span class="p">:</span>

<span class="k">if</span> <span class="s1">&#39;noise_reg&#39;</span> <span class="ow">in</span> <span class="n">param</span><span class="p">[</span><span class="s1">&#39;opt_param&#39;</span><span class="p">]</span> <span class="ow">and</span> <span class="n">param</span><span class="p">[</span><span class="s1">&#39;opt_param&#39;</span><span class="p">][</span><span class="s1">&#39;noise_reg&#39;</span><span class="p">]</span> <span class="o">&gt;</span> <span class="mf">0.0</span><span class="p">:</span>
<span class="k">if</span> <span class="p">(</span><span class="s1">&#39;noise_reg&#39;</span> <span class="ow">in</span> <span class="n">param</span><span class="p">[</span><span class="s1">&#39;opt_param&#39;</span><span class="p">])</span> <span class="ow">and</span> <span class="p">(</span><span class="nb">abs</span><span class="p">(</span><span class="n">param</span><span class="p">[</span><span class="s1">&#39;opt_param&#39;</span><span class="p">][</span><span class="s1">&#39;noise_reg&#39;</span><span class="p">])</span> <span class="o">&gt;</span> <span class="mf">1E-15</span><span class="p">):</span>
<span class="n">X_trn_orig</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">X_trn</span><span class="p">)</span>
<span class="n">noise_reg</span> <span class="o">=</span> <span class="n">param</span><span class="p">[</span><span class="s1">&#39;opt_param&#39;</span><span class="p">][</span><span class="s1">&#39;noise_reg&#39;</span><span class="p">]</span>
<span class="c1"># -------------------------------------------</span>
Expand All @@ -1117,7 +1117,7 @@ <h1>Source code for icenet.deep.iceboost</h1><div class="highlight"><pre>
<span class="c1"># ---------------------------------------</span>

<span class="c1">## What to evaluate</span>
<span class="k">if</span> <span class="n">epoch</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="p">((</span><span class="n">epoch</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="o">%</span> <span class="n">param</span><span class="p">[</span><span class="s1">&#39;evalmode&#39;</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">args</span><span class="p">[</span><span class="s1">&#39;__raytune_running__&#39;</span><span class="p">]:</span>
<span class="k">if</span> <span class="n">epoch</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="p">((</span><span class="n">epoch</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="o">%</span> <span class="n">param</span><span class="p">[</span><span class="s1">&#39;savemode&#39;</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">args</span><span class="p">[</span><span class="s1">&#39;__raytune_running__&#39;</span><span class="p">]:</span>
<span class="n">evallist</span> <span class="o">=</span> <span class="p">[(</span><span class="n">dtrain</span><span class="p">,</span> <span class="s1">&#39;train&#39;</span><span class="p">),</span> <span class="p">(</span><span class="n">deval</span><span class="p">,</span> <span class="s1">&#39;eval&#39;</span><span class="p">)]</span>
<span class="k">else</span><span class="p">:</span>
<span class="n">evallist</span> <span class="o">=</span> <span class="p">[(</span><span class="n">dtrain</span><span class="p">,</span> <span class="s1">&#39;train&#39;</span><span class="p">)]</span>
Expand Down Expand Up @@ -1190,7 +1190,7 @@ <h1>Source code for icenet.deep.iceboost</h1><div class="highlight"><pre>

<span class="c1"># ==============================================</span>
<span class="c1">## Validate</span>
<span class="k">if</span> <span class="n">epoch</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="p">((</span><span class="n">epoch</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="o">%</span> <span class="n">param</span><span class="p">[</span><span class="s1">&#39;evalmode&#39;</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">args</span><span class="p">[</span><span class="s1">&#39;__raytune_running__&#39;</span><span class="p">]:</span>
<span class="k">if</span> <span class="n">epoch</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="p">((</span><span class="n">epoch</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="o">%</span> <span class="n">param</span><span class="p">[</span><span class="s1">&#39;savemode&#39;</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">args</span><span class="p">[</span><span class="s1">&#39;__raytune_running__&#39;</span><span class="p">]:</span>

<span class="c1"># ------- AUC values ------</span>
<span class="k">if</span> <span class="nb">len</span><span class="p">(</span><span class="n">args</span><span class="p">[</span><span class="s1">&#39;primary_classes&#39;</span><span class="p">])</span> <span class="o">&gt;=</span> <span class="mi">2</span><span class="p">:</span>
Expand Down
6 changes: 3 additions & 3 deletions _modules/icenet/deep/train.html
Original file line number Diff line number Diff line change
Expand Up @@ -867,13 +867,13 @@ <h1>Source code for icenet.deep.train</h1><div class="highlight"><pre>
<span class="c1"># Set current epoch (for special scheduling reasons)</span>
<span class="n">opt_param</span><span class="p">[</span><span class="s1">&#39;current_epoch&#39;</span><span class="p">]</span> <span class="o">=</span> <span class="n">epoch</span>

<span class="c1"># Train </span>
<span class="c1"># Train</span>
<span class="n">loss</span> <span class="o">=</span> <span class="n">optimize</span><span class="o">.</span><span class="n">train</span><span class="p">(</span><span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">,</span> <span class="n">loader</span><span class="o">=</span><span class="n">train_loader</span><span class="p">,</span> <span class="n">optimizer</span><span class="o">=</span><span class="n">optimizer</span><span class="p">,</span> <span class="n">device</span><span class="o">=</span><span class="n">device</span><span class="p">,</span> <span class="n">opt_param</span><span class="o">=</span><span class="n">opt_param</span><span class="p">,</span> <span class="n">MI</span><span class="o">=</span><span class="n">MI</span><span class="p">)</span>

<span class="k">if</span> <span class="n">epoch</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="p">((</span><span class="n">epoch</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="o">%</span> <span class="n">param</span><span class="p">[</span><span class="s1">&#39;evalmode&#39;</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">args</span><span class="p">[</span><span class="s1">&#39;__raytune_running__&#39;</span><span class="p">]:</span>
<span class="k">if</span> <span class="n">epoch</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="p">((</span><span class="n">epoch</span><span class="o">+</span><span class="mi">1</span><span class="p">)</span> <span class="o">%</span> <span class="n">param</span><span class="p">[</span><span class="s1">&#39;savemode&#39;</span><span class="p">])</span> <span class="o">==</span> <span class="mi">0</span> <span class="ow">or</span> <span class="n">args</span><span class="p">[</span><span class="s1">&#39;__raytune_running__&#39;</span><span class="p">]:</span>
<span class="n">_</span><span class="p">,</span> <span class="n">train_acc</span><span class="p">,</span> <span class="n">train_auc</span> <span class="o">=</span> <span class="n">optimize</span><span class="o">.</span><span class="n">test</span><span class="p">(</span><span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">,</span> <span class="n">loader</span><span class="o">=</span><span class="n">train_loader</span><span class="p">,</span> <span class="n">device</span><span class="o">=</span><span class="n">device</span><span class="p">,</span> <span class="n">opt_param</span><span class="o">=</span><span class="n">opt_param</span><span class="p">,</span> <span class="n">MI</span><span class="o">=</span><span class="n">MI</span><span class="p">,</span> <span class="n">compute_loss</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span>
<span class="n">validate_loss</span><span class="p">,</span> <span class="n">validate_acc</span><span class="p">,</span> <span class="n">validate_auc</span> <span class="o">=</span> <span class="n">optimize</span><span class="o">.</span><span class="n">test</span><span class="p">(</span><span class="n">model</span><span class="o">=</span><span class="n">model</span><span class="p">,</span> <span class="n">loader</span><span class="o">=</span><span class="n">test_loader</span><span class="p">,</span> <span class="n">device</span><span class="o">=</span><span class="n">device</span><span class="p">,</span> <span class="n">opt_param</span><span class="o">=</span><span class="n">opt_param</span><span class="p">,</span> <span class="n">MI</span><span class="o">=</span><span class="n">MI</span><span class="p">,</span> <span class="n">compute_loss</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>

<span class="c1"># Temperature calibration</span>
<span class="k">try</span><span class="p">:</span>
<span class="kn">from</span> <span class="nn">icenet.deep</span> <span class="kn">import</span> <span class="n">tempscale</span>
Expand Down
Binary file modified objects.inv
Binary file not shown.

0 comments on commit a35e7c9

Please sign in to comment.