Skip to content

Commit

Permalink
Render bookdown
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Sep 4, 2024
1 parent 1359fbe commit 5cc4172
Show file tree
Hide file tree
Showing 36 changed files with 299 additions and 75 deletions.
2 changes: 1 addition & 1 deletion docs/03-writing_code.md
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ devtools::session_info()
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2024-06-14
## date 2024-09-04
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
##
## ─ Packages ───────────────────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion docs/03-writing_code_activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ devtools::session_info()
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2024-06-14
## date 2024-09-04
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
##
## ─ Packages ───────────────────────────────────────────────────────────────────
Expand Down
6 changes: 3 additions & 3 deletions docs/04-refactoring.md
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ proc.time() - start_time

```
## user system elapsed
## 8.467 0.003 8.469
## 8.472 0.000 8.472
```

:::{.query}
Expand Down Expand Up @@ -587,7 +587,7 @@ proc.time() - start_time

```
## user system elapsed
## 0.716 0.575 0.628
## 0.744 0.600 0.646
```

The `outer()` function performs the same calculation as the nested loop in the original code, but more efficiently. It returns a matrix of all possible combinations of x and y values, with each element of the matrix being the product of the corresponding x and y values. The `rowSums()` function is then used to sum the elements of each row of the matrix, which is equivalent to summing the products of x and y for each index `i` in the original loop. This method avoids the need for the nested loop, resulting in a faster and more efficient computation.
Expand Down Expand Up @@ -615,7 +615,7 @@ proc.time() - start_time

```
## user system elapsed
## 0.310 0.291 0.255
## 0.364 0.259 0.262
```

One optimized way to perform the same calculation is by using the `%*%` operator to perform matrix multiplication. This can be done by converting x and y to matrices and transposing one of them so that their dimensions align for matrix multiplication. This code should be much faster than the original implementation because it takes advantage of highly optimized matrix multiplication algorithms in R.
Expand Down
2 changes: 1 addition & 1 deletion docs/05-annotation.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ devtools::session_info()
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2024-06-14
## date 2024-09-04
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
##
## ─ Packages ───────────────────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion docs/05-annotation_activity.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ devtools::session_info()
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2024-06-14
## date 2024-09-04
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
##
## ─ Packages ───────────────────────────────────────────────────────────────────
Expand Down
12 changes: 10 additions & 2 deletions docs/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -391,11 +391,19 @@ <h1>Page not found</h1>
<p>You may want to try searching to find the page's new location, or use
the table of contents to find the page you are looking for.</p>
</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/About.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Tools Used:
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2024-06-14
## date 2024-09-04
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
##
## ─ Packages ───────────────────────────────────────────────────────────────────
Expand Down
14 changes: 11 additions & 3 deletions docs/about-the-authors.html
Original file line number Diff line number Diff line change
Expand Up @@ -472,7 +472,7 @@ <h1>About the Authors<a href="about-the-authors.html#about-the-authors" class="a
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2024-06-14
## date 2024-09-04
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
##
## ─ Packages ───────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -538,11 +538,19 @@ <h1>About the Authors<a href="about-the-authors.html#about-the-authors" class="a
-->

</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
12 changes: 10 additions & 2 deletions docs/ai-for-bioinformatics-hands-on-exercise.html
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,19 @@ <h2><span class="header-section-number">23.2</span> Questions<a href="ai-for-bio


</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
12 changes: 10 additions & 2 deletions docs/ai-for-bioinformatics.html
Original file line number Diff line number Diff line change
Expand Up @@ -424,11 +424,19 @@ <h2><span class="header-section-number">21.3</span> Using these topics for Bioin
</div>
</div>
</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
12 changes: 10 additions & 2 deletions docs/annotating-your-code.html
Original file line number Diff line number Diff line change
Expand Up @@ -607,11 +607,19 @@ <h3><span class="header-section-number">14.7.5</span> Sometimes it has trouble w
</div>
</div>
</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
14 changes: 11 additions & 3 deletions docs/annotation-hands-on-exercise.html
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ <h2><span class="header-section-number">16.2</span> Questions<a href="annotation
## collate en_US.UTF-8
## ctype en_US.UTF-8
## tz Etc/UTC
## date 2024-06-14
## date 2024-09-04
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
##
## ─ Packages ───────────────────────────────────────────────────────────────────
Expand Down Expand Up @@ -623,11 +623,19 @@ <h2><span class="header-section-number">16.2</span> Questions<a href="annotation

</div>
</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
12 changes: 10 additions & 2 deletions docs/ethics-of-using-ai.html
Original file line number Diff line number Diff line change
Expand Up @@ -587,11 +587,19 @@ <h2><span class="header-section-number">3.11</span> Summary<a href="ethics-of-us
<p>Overall, we hope that these guidelines and tips will help us all to use AI tools more responsibly for writing code. We recognize however, that as this is emerging technology and more ethical issues will emerge as we continue to use these tools in new ways. AI tools can even help us to use them more responsibly when we ask the right additional questions when writing code, but remember that human review is always necessary. Staying up-to-date on the current ethical considerations will also help us all continue to use AI responsibly.</p>
</div>
</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
14 changes: 11 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ <h1>
<div id="header">
<h1 class="title">AI for Efficient Programming</h1>
<h2 class="subtitle"><em>Harnessing the Power of Large Language Models</em></h2>
<p class="date"><em>June, 2024</em></p>
<p class="date"><em>September, 2024</em></p>
</div>
<div id="about-this-course" class="section level1 unnumbered hasAnchor">
<h1>About this Course<a href="index.html#about-this-course" class="anchor-section" aria-label="Anchor link to header"></a></h1>
Expand Down Expand Up @@ -438,11 +438,19 @@ <h2>Learning Objectives<a href="index.html#learning-objectives" class="anchor-se

</div>
</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "AI for Efficient Programming"
subtitle: "Harnessing the Power of Large Language Models"
date: "June, 2024"
date: "September, 2024"
site: bookdown::bookdown_site
documentclass: book
bibliography: [book.bib]
Expand Down
12 changes: 10 additions & 2 deletions docs/introduction.html
Original file line number Diff line number Diff line change
Expand Up @@ -486,11 +486,19 @@ <h2><span class="header-section-number">1.6</span> About This Book<a href="intro
<p>We used AI bots (including ChatGPT, Bard, Sage, and Claude) as part of the process of creating this book. The words are all original content, but we used AI bots to edit for grammar and tone. We firmly believe this new technology can be used in ethical ways and we put into practice all the rules and suggestions offered over the following modules while we created this book.</p>
</div>
</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
12 changes: 10 additions & 2 deletions docs/languages-and-cloud-computing.html
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,19 @@ <h2>AI and Cloud Computing<a href="languages-and-cloud-computing.html#ai-and-clo

</div>
</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
12 changes: 10 additions & 2 deletions docs/refactoring-code-hands-on-exercise.html
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,19 @@ <h2><span class="header-section-number">12.2</span> Questions<a href="refactorin

</div>
</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
18 changes: 13 additions & 5 deletions docs/refactoring-code.html
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ <h2><span class="header-section-number">10.9</span> Code optimization<a href="re
<span id="cb51-16"><a href="refactoring-code.html#cb51-16" tabindex="-1"></a><span class="co"># End timer</span></span>
<span id="cb51-17"><a href="refactoring-code.html#cb51-17" tabindex="-1"></a><span class="fu">proc.time</span>() <span class="sc">-</span> start_time</span></code></pre></div>
<pre><code>## user system elapsed
## 8.467 0.003 8.469</code></pre>
## 8.472 0.000 8.472</code></pre>
<div class="query">
<p>What is a faster, more optimized way of running the following R code?</p>
</div>
Expand All @@ -780,7 +780,7 @@ <h2><span class="header-section-number">10.9</span> Code optimization<a href="re
<span id="cb53-12"><a href="refactoring-code.html#cb53-12" tabindex="-1"></a><span class="co"># End timer</span></span>
<span id="cb53-13"><a href="refactoring-code.html#cb53-13" tabindex="-1"></a><span class="fu">proc.time</span>() <span class="sc">-</span> start_time</span></code></pre></div>
<pre><code>## user system elapsed
## 0.716 0.575 0.628</code></pre>
## 0.744 0.600 0.646</code></pre>
<p>The <code>outer()</code> function performs the same calculation as the nested loop in the original code, but more efficiently. It returns a matrix of all possible combinations of x and y values, with each element of the matrix being the product of the corresponding x and y values. The <code>rowSums()</code> function is then used to sum the elements of each row of the matrix, which is equivalent to summing the products of x and y for each index <code>i</code> in the original loop. This method avoids the need for the nested loop, resulting in a faster and more efficient computation.</p>
</div>
<p>So much faster! We can look at another option by regenerating the response:</p>
Expand All @@ -799,7 +799,7 @@ <h2><span class="header-section-number">10.9</span> Code optimization<a href="re
<span id="cb55-12"><a href="refactoring-code.html#cb55-12" tabindex="-1"></a><span class="co"># End timer</span></span>
<span id="cb55-13"><a href="refactoring-code.html#cb55-13" tabindex="-1"></a><span class="fu">proc.time</span>() <span class="sc">-</span> start_time</span></code></pre></div>
<pre><code>## user system elapsed
## 0.310 0.291 0.255</code></pre>
## 0.364 0.259 0.262</code></pre>
<p>One optimized way to perform the same calculation is by using the <code>%*%</code> operator to perform matrix multiplication. This can be done by converting x and y to matrices and transposing one of them so that their dimensions align for matrix multiplication. This code should be much faster than the original implementation because it takes advantage of highly optimized matrix multiplication algorithms in R.</p>
</div>
<p>While this second suggestion is faster, you will need to consider what aspects of the codebase are most important in each instance. For example, this code runs more quickly, but <a href="https://stat.ethz.ch/R-manual/R-patched/library/base/html/matmult.html">the <code>%*%</code> operator</a> might be unfamiliar to some R programmers. In cases where efficiency is less important, or the data are not large, you might consider maximizing readability.</p>
Expand Down Expand Up @@ -829,11 +829,19 @@ <h3><span class="header-section-number">10.10.4</span> Security<a href="refactor
</div>
</div>
</div>

<hr>
<center>
<div class="container">
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
</div>
</div>
</center>

<hr>
<center>
<center>
<div class="footer">
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
<br>
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
<a href="https://hutchdatascience.org/" target="_blank"><img src="https://hutchdatascience.org/images/crazy-idea-wide.png" style="width: 80%; padding-left: 15px; padding-top: 8px;"</a>
</div>
Expand Down
Loading

0 comments on commit 5cc4172

Please sign in to comment.