Skip to content

Commit

Permalink
build based on ae5051a
Browse files Browse the repository at this point in the history
  • Loading branch information
Documenter.jl committed Apr 27, 2024
1 parent 8c1ec42 commit f2006b0
Show file tree
Hide file tree
Showing 17 changed files with 55 additions and 55 deletions.
36 changes: 18 additions & 18 deletions previews/PR65/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion previews/PR65/search/search_index.json

Large diffs are not rendered by default.

Binary file removed previews/PR65/vignettes/bnmyfqr.png
Binary file not shown.
6 changes: 3 additions & 3 deletions previews/PR65/vignettes/entropize/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -409,19 +409,19 @@ <h1 id="getting-the-entropy-matrix">Getting the entropy matrix</h1>
<div class="highlight"><pre><span></span><code><span class="n">measurements</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rand</span><span class="p">(</span><span class="n">MidpointDisplacement</span><span class="p">(),</span><span class="w"> </span><span class="p">(</span><span class="mi">200</span><span class="p">,</span><span class="w"> </span><span class="mi">200</span><span class="p">))</span><span class="w"> </span><span class="o">.*</span><span class="w"> </span><span class="mi">100</span>
<span class="n">heatmap</span><span class="p">(</span><span class="n">measurements</span><span class="p">)</span>
</code></pre></div>
<p><img alt="" src="../bnmyfqr.png" /></p>
<p><img alt="" src="../yvyrlqc.png" /></p>
<p>Using the <code>entropize</code> function will convert these values into entropy at the pixel scale: </p>
<div class="highlight"><pre><span></span><code><span class="n">U</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">entropize</span><span class="p">(</span><span class="n">measurements</span><span class="p">)</span>
<span class="n">heatmap</span><span class="p">(</span><span class="n">U</span><span class="p">)</span>
</code></pre></div>
<p><img alt="" src="../jfzioqv.png" /></p>
<p><img alt="" src="../gbfwvxs.png" /></p>
<p>The values closest to the median of the distribution have the highest entropy, and the values closest to its extrema have an entropy of 0. The entropy matrix is guaranteed to have values on the unit interval.</p>
<p>We can use <code>entropize</code> as part of a pipeline, and overlay the points optimized based on entropy on the measurement map:</p>
<div class="highlight"><pre><span></span><code><span class="n">locations</span><span class="w"> </span><span class="o">=</span>
<span class="w"> </span><span class="n">measurements</span><span class="w"> </span><span class="o">|&gt;</span><span class="w"> </span><span class="n">entropize</span><span class="w"> </span><span class="o">|&gt;</span><span class="w"> </span><span class="n">seed</span><span class="p">(</span><span class="n">BalancedAcceptance</span><span class="p">(;</span><span class="w"> </span><span class="n">numpoints</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">100</span><span class="p">))</span><span class="w"> </span><span class="o">|&gt;</span><span class="w"> </span><span class="n">first</span>
<span class="n">heatmap</span><span class="p">(</span><span class="n">U</span><span class="p">)</span>
</code></pre></div>
<p><img alt="" src="../yjrnfxx.png" /></p>
<p><img alt="" src="../zhcpfbl.png" /></p>



Expand Down
Binary file removed previews/PR65/vignettes/fbpniuq.png
Binary file not shown.
Binary file added previews/PR65/vignettes/gbfwvxs.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 removed previews/PR65/vignettes/jfzioqv.png
Binary file not shown.
Binary file added previews/PR65/vignettes/kdskdad.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 removed previews/PR65/vignettes/mgbeaxi.png
Binary file not shown.
64 changes: 32 additions & 32 deletions previews/PR65/vignettes/overview/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -405,22 +405,22 @@ <h1 id="an-introduction-to-biodiversityobservationnetworks">An introduction to B
<div class="highlight"><pre><span></span><code><span class="n">U</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">rand</span><span class="p">(</span><span class="n">MidpointDisplacement</span><span class="p">(</span><span class="mf">0.5</span><span class="p">),</span><span class="w"> </span><span class="p">(</span><span class="mi">100</span><span class="p">,</span><span class="w"> </span><span class="mi">100</span><span class="p">))</span>
<span class="n">heatmap</span><span class="p">(</span><span class="n">U</span><span class="p">)</span>
</code></pre></div>
<p><img alt="" src="../fbpniuq.png" /></p>
<p><img alt="" src="../roejlsl.png" /></p>
<p>In practice, this uncertainty matrix is likely to be derived from an application of the hyper-parameters optimization step, which is detailed in other vignettes.</p>
<p>The first step of defining a series of locations to sample is to use a <code>BONSeeder</code>, which will generate a number of relatively coarse proposals that cover the entire landscape, and have a balanced distribution in space. We do so using the <code>BalancedAcceptance</code> sampler, which can be tweaked to capture more (or less) uncertainty. To start with, we will extract 200 candidate points, <em>i.e.</em> 200 possible locations which will then be refined. </p>
<div class="highlight"><pre><span></span><code><span class="n">pack</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">seed</span><span class="p">(</span><span class="n">BalancedAcceptance</span><span class="p">(;</span><span class="w"> </span><span class="n">numpoints</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="mi">200</span><span class="p">),</span><span class="w"> </span><span class="n">U</span><span class="p">);</span>
</code></pre></div>
<div class="highlight"><pre><span></span><code>(CartesianIndex[CartesianIndex(81, 17), CartesianIndex(19, 50), CartesianIndex(69, 84), CartesianIndex(44, 28), CartesianIndex(94, 61), CartesianIndex(13, 95), CartesianIndex(63, 9), CartesianIndex(38, 43), CartesianIndex(88, 76), CartesianIndex(25, 21) … CartesianIndex(56, 52), CartesianIndex(31, 86), CartesianIndex(81, 30), CartesianIndex(18, 63), CartesianIndex(68, 97), CartesianIndex(43, 11), CartesianIndex(93, 45), CartesianIndex(12, 78), CartesianIndex(62, 23), CartesianIndex(37, 56)], [0.34936644311376736 0.2963291791072726 … 0.6103195781606581 0.656451463904019; 0.38667829951358235 0.38387510215269177 … 0.5988243185509109 0.6310920539864477; … ; 0.8347531595584842 0.8769922729013369 … 0.4529643990045687 0.491649641834681; 0.7281710847482984 0.7824992184213061 … 0.44351271989771424 0.5380136791633866])
<div class="highlight"><pre><span></span><code>(CartesianIndex[CartesianIndex(81, 10), CartesianIndex(19, 44), CartesianIndex(69, 77), CartesianIndex(44, 21), CartesianIndex(94, 55), CartesianIndex(12, 88), CartesianIndex(62, 33), CartesianIndex(37, 66), CartesianIndex(87, 99), CartesianIndex(25, 4) … CartesianIndex(55, 44), CartesianIndex(30, 77), CartesianIndex(80, 22), CartesianIndex(18, 55), CartesianIndex(68, 89), CartesianIndex(43, 33), CartesianIndex(93, 66), CartesianIndex(12, 100), CartesianIndex(62, 1), CartesianIndex(37, 35)], [0.6457023076171001 0.6530873362023615 … 0.4802747697941122 0.495825668828999; 0.6662755323284345 0.6646109378460477 … 0.4476078092501954 0.5244434382647728; … ; 0.20054927953972762 0.19293310548992137 … 0.4423561795343221 0.45279935857264714; 0.2781285320931762 0.2056391355970853 … 0.4695128732448035 0.41903900630023805])
</code></pre></div>
<p>The output of a <code>BONSampler</code> (whether at the seeding or refinement step) is always a tuple, storing in the first position a vector of <code>CartesianIndex</code> elements, and in the second position the matrix given as input. We can have a look at the first five points: </p>
<div class="highlight"><pre><span></span><code><span class="n">first</span><span class="p">(</span><span class="n">pack</span><span class="p">)[</span><span class="mi">1</span><span class="o">:</span><span class="mi">5</span><span class="p">]</span>
</code></pre></div>
<div class="highlight"><pre><span></span><code>5-element Vector{CartesianIndex}:
CartesianIndex(81, 17)
CartesianIndex(19, 50)
CartesianIndex(69, 84)
CartesianIndex(44, 28)
CartesianIndex(94, 61)
CartesianIndex(81, 10)
CartesianIndex(19, 44)
CartesianIndex(69, 77)
CartesianIndex(44, 21)
CartesianIndex(94, 55)
</code></pre></div>
<p>Although returning the input matrix may seem redundant, it actually allows to chain samplers together to build pipelines that take a matrix as input, and return a set of places to sample as outputs; an example is given below.</p>
<p>The positions of locations to sample are given as a vector of <code>CartesianIndex</code>, which are coordinates in the uncertainty matrix. Once we have generated a candidate proposal, we can further refine it using a <code>BONRefiner</code> – in this case, <code>AdaptiveSpatial</code>, which performs adaptive spatial sampling (maximizing the distribution of entropy while minimizing spatial auto-correlation).</p>
Expand All @@ -429,11 +429,11 @@ <h1 id="an-introduction-to-biodiversityobservationnetworks">An introduction to B
<span class="n">locations</span><span class="p">[</span><span class="mi">1</span><span class="o">:</span><span class="mi">5</span><span class="p">]</span>
</code></pre></div>
<div class="highlight"><pre><span></span><code>5-element Vector{CartesianIndex}:
CartesianIndex(90, 15)
CartesianIndex(87, 14)
CartesianIndex(86, 10)
CartesianIndex(82, 7)
CartesianIndex(80, 4)
CartesianIndex(10, 1)
CartesianIndex(3, 44)
CartesianIndex(1, 49)
CartesianIndex(4, 50)
CartesianIndex(8, 54)
</code></pre></div>
<p>The reason we start from a candidate set of points is that some algorithms struggle with full landscapes, and work much better with a sub-sample of them. There is no hard rule (or no heuristic) to get a sense for how many points should be generated at the seeding step, and so experimentation is a must!</p>
<p>The previous code examples used a version of the <code>seed</code> and <code>refine</code> functions that is very useful if you want to change arguments between steps, or examine the content of the candidate pool of points. In addition to this syntax, both functions have a curried version that allows chaining them together using pipes (<code>|&gt;</code>):</p>
Expand All @@ -444,32 +444,32 @@ <h1 id="an-introduction-to-biodiversityobservationnetworks">An introduction to B
<span class="w"> </span><span class="n">first</span>
</code></pre></div>
<div class="highlight"><pre><span></span><code>50-element Vector{CartesianIndex}:
CartesianIndex(77, 11)
CartesianIndex(80, 3)
CartesianIndex(82, 8)
CartesianIndex(87, 13)
CartesianIndex(81, 18)
CartesianIndex(84, 21)
CartesianIndex(77, 23)
CartesianIndex(74, 19)
CartesianIndex(70, 20)
CartesianIndex(72, 25)
CartesianIndex(1, 60)
CartesianIndex(25, 50)
CartesianIndex(4, 62)
CartesianIndex(28, 47)
CartesianIndex(27, 43)
CartesianIndex(32, 49)
CartesianIndex(34, 53)
CartesianIndex(8, 65)
CartesianIndex(39, 52)
CartesianIndex(41, 54)
CartesianIndex(85, 80)
CartesianIndex(23, 25)
CartesianIndex(73, 58)
CartesianIndex(48, 91)
CartesianIndex(98, 6)
CartesianIndex(3, 40)
CartesianIndex(53, 73)
CartesianIndex(28, 17)
CartesianIndex(78, 51)
CartesianIndex(67, 9)
CartesianIndex(42, 42)
CartesianIndex(92, 76)
CartesianIndex(11, 20)
CartesianIndex(61, 53)
CartesianIndex(36, 87)
CartesianIndex(86, 31)
CartesianIndex(23, 65)
CartesianIndex(73, 98)
</code></pre></div>
<p>This works because <code>seed</code> and <code>refine</code> have curried versions that can be used directly in a pipeline. Proposed sampling locations can then be overlayed onto the original uncertainty matrix: </p>
<div class="highlight"><pre><span></span><code><span class="n">plt</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">heatmap</span><span class="p">(</span><span class="n">U</span><span class="p">)</span>
<span class="c">#scatter!(plt, [x[1] for x in locations], [x[2] for x in locations], ms=2.5, mc=:white, label=&quot;&quot;)</span>
</code></pre></div>
<p><img alt="" src="../mgbeaxi.png" /></p>
<p><img alt="" src="../zpglfmw.png" /></p>



Expand Down
Binary file added previews/PR65/vignettes/roejlsl.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion previews/PR65/vignettes/uniqueness/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ <h1 id="selecting-environmentally-unique-locations">Selecting environmentally un
uncert = rand(MidpointDisplacement(0.8), size(temp), mask=temp);
heatmap(uncert)
</code></pre></div></p>
<p><img alt="" src="../zgjcpln.png" /></p>
<p><img alt="" src="../kdskdad.png" /></p>
<p>Now we'll get a set of candidate points from a BalancedAcceptance seeder that has no bias toward higher uncertainty values.</p>
<p>```@example 1
candpts, uncert = uncert |&gt; seed(BalancedAcceptance(numpoints=100, α=0.0));
Expand Down
Binary file removed previews/PR65/vignettes/yjrnfxx.png
Binary file not shown.
Binary file added previews/PR65/vignettes/yvyrlqc.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 removed previews/PR65/vignettes/zgjcpln.png
Binary file not shown.
Binary file added previews/PR65/vignettes/zhcpfbl.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 added previews/PR65/vignettes/zpglfmw.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit f2006b0

Please sign in to comment.