Skip to content

Commit

Permalink
deploy: 9643b66
Browse files Browse the repository at this point in the history
  • Loading branch information
matthew-brett committed Jun 3, 2024
1 parent fad4f52 commit 01d2dd0
Show file tree
Hide file tree
Showing 180 changed files with 806 additions and 764 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
32 changes: 24 additions & 8 deletions _sources/permutation/permutation_pairs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,30 @@ mosq_counts = beer_afters[['no_odour', 'volunt_odour']]
mosq_counts.head()
```

And do our planned subtraction of the control `no_odour` numbers from the experimental `volunt_odour` numbers:
And do our planned subtraction of the control `no_odour` numbers from the experimental `volunt_odour` numbers.

```{python}
mosq_counts['person_minus_empty'] = (mosq_counts['volunt_odour'] -
mosq_counts['no_odour'])
# Transfer to arrays for simplicity.
empty = np.array(mosq_counts['no_odour'])
person = np.array(mosq_counts['volunt_odour'])
```

```{python}
actual_diffs = person - empty
actual_diffs
```

Here we show the result using Pandas, of which more soon in the course:

```{python}
mosq_counts['person_minus_empty'] = person - empty
mosq_counts.head()
```

If our hypothesis is correct, we expect this difference (person counts minus control counts) to be positive, on average. Let's see what this average difference was for our sample:

```{python}
actual_mean_diff = mosq_counts['person_minus_empty'].mean()
actual_mean_diff = np.mean(actual_diffs)
actual_mean_diff
```

Expand All @@ -154,7 +166,11 @@ scores. Then we would recalculate the mean difference, and this mean difference

We could do this operation, of going through each row, and randomly flipping the `volunt_odour` and `no_odour` values, but we can also simplify our task with a tiny bit of algebra.

Let's say we have the subtraction between any two values $x$ and $y$: $d = x - y$, but we want the subtraction the other way round: $y - x$. But:
Let's say we have the subtraction between any two values $x$ and $y$: $d = x - y$, and we want the subtraction the other way round: $y - x$. But:

$$
d = x - y
$$

$$
y - x = -(y - x) = -d
Expand All @@ -175,10 +191,10 @@ rand_signs

The values of -1 represent rows for which we are flipping the pairs, and values of 1 correspond to pairs we have left in the original order.

Here were the original differences:
Here we recalculate the differences, as we did above:

```{python}
actual_diffs = np.array(mosq_counts['person_minus_empty'])
actual_diffs = person - empty
actual_diffs
```

Expand Down Expand Up @@ -237,7 +253,7 @@ results[:10]
plt.hist(results, bins=50)
plt.title('Sampling distribution of mean of differences')
plt.axvline(actual_mean_diff, color='red', label='Actual value')
plt.legend()
plt.legend();
```

Finally we ask how unusual the actual value is in the sampling distribution from the null world:
Expand Down
10 changes: 5 additions & 5 deletions arrays/boolean_arrays.html
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ <h1>Boolean arrays<a class="headerlink" href="#boolean-arrays" title="Link to th
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([1, 0, 0, 0])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([1, 1, 1, 1])
</pre></div>
</div>
</div>
Expand All @@ -673,7 +673,7 @@ <h1>Boolean arrays<a class="headerlink" href="#boolean-arrays" title="Link to th
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>1
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>4
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -724,7 +724,7 @@ <h1>Boolean arrays<a class="headerlink" href="#boolean-arrays" title="Link to th
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([3., 2., 2., 2., 3.])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([1., 3., 2., 4., 3.])
</pre></div>
</div>
</div>
Expand All @@ -741,7 +741,7 @@ <h1>Boolean arrays<a class="headerlink" href="#boolean-arrays" title="Link to th
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([ True, False, False, False, True])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([False, True, False, False, True])
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -780,7 +780,7 @@ <h1>Boolean arrays<a class="headerlink" href="#boolean-arrays" title="Link to th
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([ True, False, False, False, True])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([False, True, False, False, True])
</pre></div>
</div>
</div>
Expand Down
8 changes: 4 additions & 4 deletions arrays/leaping_ahead.html
Original file line number Diff line number Diff line change
Expand Up @@ -771,7 +771,7 @@ <h1>Leaping ahead<a class="headerlink" href="#leaping-ahead" title="Link to this
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([1., 4., 2., 1., 1., 2., 1., 1., 2., 0.])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([1., 3., 3., 2., 1., 3., 2., 1., 2., 3.])
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -808,7 +808,7 @@ <h1>Leaping ahead<a class="headerlink" href="#leaping-ahead" title="Link to this
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2541
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>2451
</pre></div>
</div>
</div>
Expand All @@ -823,7 +823,7 @@ <h1>Leaping ahead<a class="headerlink" href="#leaping-ahead" title="Link to this
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.2541
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.2451
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -857,7 +857,7 @@ <h2>The whole thing<a class="headerlink" href="#the-whole-thing" title="Link to
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.2568
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.2515
</pre></div>
</div>
</div>
Expand Down
28 changes: 14 additions & 14 deletions arrays/rng_choice.html
Original file line number Diff line number Diff line change
Expand Up @@ -673,7 +673,7 @@ <h1>Random choice<a class="headerlink" href="#random-choice" title="Link to this
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>1
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0
</pre></div>
</div>
</div>
Expand All @@ -693,7 +693,7 @@ <h1>Random choice<a class="headerlink" href="#random-choice" title="Link to this
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>1
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -749,7 +749,7 @@ <h2>Multiple choices with <code class="docutils literal notranslate"><span class
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 1, 0])
</pre></div>
</div>
</div>
Expand All @@ -766,7 +766,7 @@ <h2>Multiple choices with <code class="docutils literal notranslate"><span class
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([0, 0, 1, 1])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([0, 1, 1, 0])
</pre></div>
</div>
</div>
Expand All @@ -783,7 +783,7 @@ <h2>Multiple choices with <code class="docutils literal notranslate"><span class
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([1, 0, 1, 1])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([0, 1, 1, 1])
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -827,7 +827,7 @@ <h2><code class="docutils literal notranslate"><span class="pre">replace</span><
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([9, 1, 3])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([9, 7, 0])
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -856,7 +856,7 @@ <h2><code class="docutils literal notranslate"><span class="pre">replace</span><
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([7, 8, 4])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([0, 1, 7])
</pre></div>
</div>
</div>
Expand All @@ -873,7 +873,7 @@ <h2><code class="docutils literal notranslate"><span class="pre">replace</span><
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([9, 7, 6, 8, 7, 6, 8, 1, 0, 9])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([1, 4, 1, 7, 9, 0, 8, 6, 8, 3])
</pre></div>
</div>
</div>
Expand All @@ -886,7 +886,7 @@ <h2><code class="docutils literal notranslate"><span class="pre">replace</span><
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([7, 6, 0, 2, 7, 1, 4, 0, 6, 6])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([6, 0, 2, 2, 9, 9, 9, 9, 3, 7])
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -931,11 +931,11 @@ <h2><code class="docutils literal notranslate"><span class="pre">replace</span><
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([8, 3, 0, 2, 1, 9, 7, 8, 2, 9, 1, 7, 9, 6, 3, 8, 6, 9, 6, 2, 9, 2,
9, 9, 1, 6, 4, 9, 9, 8, 1, 1, 9, 4, 4, 8, 7, 1, 6, 5, 6, 5, 4, 2,
3, 6, 2, 4, 0, 3, 1, 7, 6, 6, 7, 5, 6, 1, 7, 5, 3, 6, 3, 1, 2, 1,
3, 8, 0, 4, 7, 3, 6, 3, 2, 2, 0, 1, 3, 9, 0, 2, 2, 7, 6, 6, 2, 2,
9, 0, 3, 7, 0, 6, 3, 2, 8, 2, 0, 9])
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>array([8, 8, 2, 8, 1, 0, 5, 9, 3, 9, 7, 1, 7, 4, 9, 1, 5, 4, 5, 1, 9, 1,
9, 5, 5, 0, 8, 7, 3, 6, 0, 9, 1, 1, 9, 7, 7, 8, 4, 2, 1, 6, 9, 8,
6, 6, 8, 4, 3, 5, 6, 1, 1, 9, 6, 5, 4, 4, 2, 5, 2, 9, 6, 5, 3, 8,
0, 7, 3, 4, 8, 1, 6, 5, 2, 3, 8, 2, 8, 4, 1, 7, 1, 5, 2, 6, 3, 0,
1, 6, 1, 4, 4, 2, 4, 8, 4, 9, 8, 5])
</pre></div>
</div>
</div>
Expand Down
6 changes: 3 additions & 3 deletions classification/Accuracy_of_the_Classifier.html
Original file line number Diff line number Diff line change
Expand Up @@ -786,7 +786,7 @@ <h2>Measuring the Accuracy of Our Wine Classifier<a class="headerlink" href="#me
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.8876404494382022
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.9550561797752809
</pre></div>
</div>
</div>
Expand Down Expand Up @@ -943,7 +943,7 @@ <h2>Breast Cancer Diagnosis<a class="headerlink" href="#breast-cancer-diagnosis"
<p>Oops. That plot is utterly misleading, because there are a bunch of points that have identical values for both the x- and y-coordinates. To make it easier to see all the data points, I’m going to add a little bit of random jitter to the x- and y-values. Here’s how that looks:</p>
<div class="cell tag_remove-input docutils container">
<div class="cell_output docutils container">
<img alt="../_images/4a93c97034f3e5462fc0ad695161f0f1e4e9f842da2e37e8cc72dfa46dd54f52.png" src="../_images/4a93c97034f3e5462fc0ad695161f0f1e4e9f842da2e37e8cc72dfa46dd54f52.png" />
<img alt="../_images/77ee22559c2ee08fc3d10834e49a1532ea8c99b1920134039eb477974846c85d.png" src="../_images/77ee22559c2ee08fc3d10834e49a1532ea8c99b1920134039eb477974846c85d.png" />
</div>
</div>
<p>For instance, you can see there are lots of samples with chromatin = 2 and epithelial cell size = 2; all non-cancerous.</p>
Expand All @@ -967,7 +967,7 @@ <h2>Breast Cancer Diagnosis<a class="headerlink" href="#breast-cancer-diagnosis"
</div>
</div>
<div class="cell_output docutils container">
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.9589442815249267
<div class="output text_plain highlight-myst-ansi notranslate"><div class="highlight"><pre><span></span>0.9736070381231672
</pre></div>
</div>
</div>
Expand Down
Loading

0 comments on commit 01d2dd0

Please sign in to comment.