Skip to content

Commit

Permalink
update code
Browse files Browse the repository at this point in the history
  • Loading branch information
pglpm committed Nov 6, 2024
1 parent 18d1718 commit 1e7cea5
Show file tree
Hide file tree
Showing 18 changed files with 24 additions and 24 deletions.
4 changes: 2 additions & 2 deletions _freeze/example_opm1/execute-results/html.json

Large diffs are not rendered by default.

Binary file modified _freeze/example_opm1/figure-html/unnamed-chunk-10-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _freeze/example_opm1/figure-html/unnamed-chunk-11-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _freeze/example_opm1/figure-html/unnamed-chunk-12-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _freeze/example_opm1/figure-html/unnamed-chunk-13-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _freeze/example_opm1/figure-html/unnamed-chunk-14-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _freeze/example_opm1/figure-html/unnamed-chunk-21-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified _freeze/example_opm1/figure-html/unnamed-chunk-9-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
38 changes: 19 additions & 19 deletions docs/example_opm1.html
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ <h1 class="title d-none d-lg-block"><span id="sec-example-opm1" class="quarto-se
<p>Let’s illustrate the example workflow described in <a href="prototype_code.html#sec-opm-workflow" class="quarto-xref">§&nbsp;<span>34.2</span></a> with a toy, but not too simplistic, example, based on the <a href="https://archive.ics.uci.edu/dataset/2/adult">adult-income dataset</a>.</p>
<p>All code functions and data files are in the directory<br>
<a href="https://github.com/pglpm/ADA511/tree/master/code/OPM-nominal">https://github.com/pglpm/ADA511/tree/master/code/OPM-nominal</a></p>
<p>We start loading the R libraries and functions needed at several stages. You need to have installed<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a> the packages <a href="https://cran.r-project.org/package=data.table"><em>data.table</em></a>, <a href="https://cran.r-project.org/package=extraDistr"><em>extraDistr</em></a>, <a href="https://cran.r-project.org/package=foreach"><em>foreach</em></a>, <a href="https://cran.r-project.org/package=khroma"><em>khroma</em></a>. Make sure you have saved all source files and data files in the same directory.</p>
<p>We start loading the R libraries and functions needed at several stages. You need to have installed<a href="#fn1" class="footnote-ref" id="fnref1" role="doc-noteref"><sup>1</sup></a> the packages <a href="https://cran.r-project.org/package=extraDistr"><em>extraDistr</em></a> and <a href="https://cran.r-project.org/package=foreach"><em>foreach</em></a>. Make sure you have saved all source files and data files in the same directory.</p>
<div class="no-row-height column-margin column-container"><p><sup>1</sup>&nbsp;This is done with the <a href="https://rdrr.io/r/utils/install.packages.html"><code>install.packages()</code> function</a>.</p></div><div class="cell">
<div class="sourceCode cell-code" id="cb1"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(<span class="st">'extraDistr'</span>)</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(<span class="st">'foreach'</span>)</span>
Expand Down Expand Up @@ -1004,22 +1004,22 @@ <h3 class="anchored" data-anchor-id="the-rf-function">The <code>rF()</code> func

sex
income Female Male
&lt;=50K 28.15335 43.0257
&gt;50K 6.83391 21.9871
&lt;=50K 28.37067 42.6948
&gt;50K 6.93957 21.9949

, , sample = #2

sex
income Female Male
&lt;=50K 27.89583 42.9927
&gt;50K 6.92664 22.1848
&lt;=50K 28.24020 42.8617
&gt;50K 7.14656 21.7515

, , sample = #3

sex
income Female Male
&lt;=50K 28.63955 43.3967
&gt;50K 6.97052 20.9933</code></pre>
&lt;=50K 28.81207 43.2170
&gt;50K 6.92254 21.0484</code></pre>
</div>
</div>
<p>These possible full-population frequency distributions can be used to assess how much the probabilities we find could change, if we collected a much, much larger amount of training data. Here is an example:</p>
Expand All @@ -1038,19 +1038,19 @@ <h3 class="anchored" data-anchor-id="the-rf-function">The <code>rF()</code> func
<div class="cell-output cell-output-stdout">
<pre><code> sex
occupation Female Male
Adm-clerical 0.27 0.33
Armed-Forces 0.16 0.16
Adm-clerical 0.29 0.33
Armed-Forces 0.16 0.17
Craft-repair 0.17 0.47
Exec-managerial 0.29 0.61
Farming-fishing 0.16 0.23
Handlers-cleaners 0.17 0.20
Machine-op-inspct 0.17 0.28
Other-service 0.19 0.22
Priv-house-serv 0.16 0.16
Prof-specialty 0.35 0.57
Exec-managerial 0.30 0.59
Farming-fishing 0.16 0.24
Handlers-cleaners 0.15 0.20
Machine-op-inspct 0.16 0.28
Other-service 0.20 0.22
Priv-house-serv 0.17 0.16
Prof-specialty 0.34 0.59
Protective-serv 0.16 0.29
Sales 0.22 0.48
Tech-support 0.19 0.29
Sales 0.21 0.49
Tech-support 0.20 0.29
Transport-moving 0.16 0.30</code></pre>
</div>
</div>
Expand Down Expand Up @@ -1185,7 +1185,7 @@ <h2 data-number="35.6" class="anchored" data-anchor-id="example-application-to-n
<span id="cb28-28"><a href="#cb28-28" aria-hidden="true" tabindex="-1"></a><span class="do">## Print total time required</span></span>
<span id="cb28-29"><a href="#cb28-29" aria-hidden="true" tabindex="-1"></a><span class="fu">print</span>(<span class="fu">Sys.time</span>() <span class="sc">-</span> stopwatch)</span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
<div class="cell-output cell-output-stdout">
<pre><code>Time difference of 4.30813 secs</code></pre>
<pre><code>Time difference of 4.46228 secs</code></pre>
</div>
<div class="sourceCode cell-code" id="cb30"><pre class="sourceCode r code-with-copy"><code class="sourceCode r"><span id="cb30-1"><a href="#cb30-1" aria-hidden="true" tabindex="-1"></a><span class="do">## Histogram and average accuracy (rounded to one decimal)</span></span>
<span id="cb30-2"><a href="#cb30-2" aria-hidden="true" tabindex="-1"></a><span class="fu">myhist</span>(testprobs, <span class="at">n =</span> <span class="fu">seq</span>(<span class="dv">0</span>,<span class="dv">1</span>,<span class="at">length.out =</span> <span class="dv">10</span>), <span class="at">plot =</span> <span class="cn">TRUE</span>,</span>
Expand Down
Binary file modified docs/example_opm1_files/figure-html/unnamed-chunk-10-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/example_opm1_files/figure-html/unnamed-chunk-11-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/example_opm1_files/figure-html/unnamed-chunk-12-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/example_opm1_files/figure-html/unnamed-chunk-13-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/example_opm1_files/figure-html/unnamed-chunk-14-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/example_opm1_files/figure-html/unnamed-chunk-21-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified docs/example_opm1_files/figure-html/unnamed-chunk-9-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 1e7cea5

Please sign in to comment.