Skip to content

Commit 5cc4172

Browse files
Render bookdown
1 parent 1359fbe commit 5cc4172

36 files changed

+299
-75
lines changed

docs/03-writing_code.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ devtools::session_info()
518518
## collate en_US.UTF-8
519519
## ctype en_US.UTF-8
520520
## tz Etc/UTC
521-
## date 2024-06-14
521+
## date 2024-09-04
522522
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
523523
##
524524
## ─ Packages ───────────────────────────────────────────────────────────────────

docs/03-writing_code_activity.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ devtools::session_info()
5353
## collate en_US.UTF-8
5454
## ctype en_US.UTF-8
5555
## tz Etc/UTC
56-
## date 2024-06-14
56+
## date 2024-09-04
5757
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
5858
##
5959
## ─ Packages ───────────────────────────────────────────────────────────────────

docs/04-refactoring.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ proc.time() - start_time
559559

560560
```
561561
## user system elapsed
562-
## 8.467 0.003 8.469
562+
## 8.472 0.000 8.472
563563
```
564564

565565
:::{.query}
@@ -587,7 +587,7 @@ proc.time() - start_time
587587

588588
```
589589
## user system elapsed
590-
## 0.716 0.575 0.628
590+
## 0.744 0.600 0.646
591591
```
592592

593593
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.
@@ -615,7 +615,7 @@ proc.time() - start_time
615615

616616
```
617617
## user system elapsed
618-
## 0.310 0.291 0.255
618+
## 0.364 0.259 0.262
619619
```
620620

621621
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.

docs/05-annotation.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ devtools::session_info()
386386
## collate en_US.UTF-8
387387
## ctype en_US.UTF-8
388388
## tz Etc/UTC
389-
## date 2024-06-14
389+
## date 2024-09-04
390390
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
391391
##
392392
## ─ Packages ───────────────────────────────────────────────────────────────────

docs/05-annotation_activity.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ devtools::session_info()
192192
## collate en_US.UTF-8
193193
## ctype en_US.UTF-8
194194
## tz Etc/UTC
195-
## date 2024-06-14
195+
## date 2024-09-04
196196
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
197197
##
198198
## ─ Packages ───────────────────────────────────────────────────────────────────

docs/404.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -391,11 +391,19 @@ <h1>Page not found</h1>
391391
<p>You may want to try searching to find the page's new location, or use
392392
the table of contents to find the page you are looking for.</p>
393393
</div>
394+
395+
<hr>
396+
<center>
397+
<div class="container">
398+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
399+
</div>
400+
</div>
401+
</center>
402+
394403
<hr>
395-
<center>
404+
<center>
396405
<div class="footer">
397406
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
398-
<br>
399407
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
400408
<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>
401409
</div>

docs/About.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Tools Used:
3838
## collate en_US.UTF-8
3939
## ctype en_US.UTF-8
4040
## tz Etc/UTC
41-
## date 2024-06-14
41+
## date 2024-09-04
4242
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
4343
##
4444
## ─ Packages ───────────────────────────────────────────────────────────────────

docs/about-the-authors.html

+11-3
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ <h1>About the Authors<a href="about-the-authors.html#about-the-authors" class="a
472472
## collate en_US.UTF-8
473473
## ctype en_US.UTF-8
474474
## tz Etc/UTC
475-
## date 2024-06-14
475+
## date 2024-09-04
476476
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
477477
##
478478
## ─ Packages ───────────────────────────────────────────────────────────────────
@@ -538,11 +538,19 @@ <h1>About the Authors<a href="about-the-authors.html#about-the-authors" class="a
538538
-->
539539

540540
</div>
541+
542+
<hr>
543+
<center>
544+
<div class="container">
545+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
546+
</div>
547+
</div>
548+
</center>
549+
541550
<hr>
542-
<center>
551+
<center>
543552
<div class="footer">
544553
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
545-
<br>
546554
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
547555
<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>
548556
</div>

docs/ai-for-bioinformatics-hands-on-exercise.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -426,11 +426,19 @@ <h2><span class="header-section-number">23.2</span> Questions<a href="ai-for-bio
426426

427427

428428
</div>
429+
430+
<hr>
431+
<center>
432+
<div class="container">
433+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
434+
</div>
435+
</div>
436+
</center>
437+
429438
<hr>
430-
<center>
439+
<center>
431440
<div class="footer">
432441
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
433-
<br>
434442
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
435443
<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>
436444
</div>

docs/ai-for-bioinformatics.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -424,11 +424,19 @@ <h2><span class="header-section-number">21.3</span> Using these topics for Bioin
424424
</div>
425425
</div>
426426
</div>
427+
428+
<hr>
429+
<center>
430+
<div class="container">
431+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
432+
</div>
433+
</div>
434+
</center>
435+
427436
<hr>
428-
<center>
437+
<center>
429438
<div class="footer">
430439
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
431-
<br>
432440
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
433441
<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>
434442
</div>

docs/annotating-your-code.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -607,11 +607,19 @@ <h3><span class="header-section-number">14.7.5</span> Sometimes it has trouble w
607607
</div>
608608
</div>
609609
</div>
610+
611+
<hr>
612+
<center>
613+
<div class="container">
614+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
615+
</div>
616+
</div>
617+
</center>
618+
610619
<hr>
611-
<center>
620+
<center>
612621
<div class="footer">
613622
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
614-
<br>
615623
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
616624
<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>
617625
</div>

docs/annotation-hands-on-exercise.html

+11-3
Original file line numberDiff line numberDiff line change
@@ -566,7 +566,7 @@ <h2><span class="header-section-number">16.2</span> Questions<a href="annotation
566566
## collate en_US.UTF-8
567567
## ctype en_US.UTF-8
568568
## tz Etc/UTC
569-
## date 2024-06-14
569+
## date 2024-09-04
570570
## pandoc 3.1.1 @ /usr/local/bin/ (via rmarkdown)
571571
##
572572
## ─ Packages ───────────────────────────────────────────────────────────────────
@@ -623,11 +623,19 @@ <h2><span class="header-section-number">16.2</span> Questions<a href="annotation
623623

624624
</div>
625625
</div>
626+
627+
<hr>
628+
<center>
629+
<div class="container">
630+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
631+
</div>
632+
</div>
633+
</center>
634+
626635
<hr>
627-
<center>
636+
<center>
628637
<div class="footer">
629638
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
630-
<br>
631639
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
632640
<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>
633641
</div>

docs/ethics-of-using-ai.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -587,11 +587,19 @@ <h2><span class="header-section-number">3.11</span> Summary<a href="ethics-of-us
587587
<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>
588588
</div>
589589
</div>
590+
591+
<hr>
592+
<center>
593+
<div class="container">
594+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
595+
</div>
596+
</div>
597+
</center>
598+
590599
<hr>
591-
<center>
600+
<center>
592601
<div class="footer">
593602
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
594-
<br>
595603
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
596604
<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>
597605
</div>

docs/index.html

+11-3
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ <h1>
388388
<div id="header">
389389
<h1 class="title">AI for Efficient Programming</h1>
390390
<h2 class="subtitle"><em>Harnessing the Power of Large Language Models</em></h2>
391-
<p class="date"><em>June, 2024</em></p>
391+
<p class="date"><em>September, 2024</em></p>
392392
</div>
393393
<div id="about-this-course" class="section level1 unnumbered hasAnchor">
394394
<h1>About this Course<a href="index.html#about-this-course" class="anchor-section" aria-label="Anchor link to header"></a></h1>
@@ -438,11 +438,19 @@ <h2>Learning Objectives<a href="index.html#learning-objectives" class="anchor-se
438438

439439
</div>
440440
</div>
441+
442+
<hr>
443+
<center>
444+
<div class="container">
445+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
446+
</div>
447+
</div>
448+
</center>
449+
441450
<hr>
442-
<center>
451+
<center>
443452
<div class="footer">
444453
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
445-
<br>
446454
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
447455
<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>
448456
</div>

docs/index.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "AI for Efficient Programming"
33
subtitle: "Harnessing the Power of Large Language Models"
4-
date: "June, 2024"
4+
date: "September, 2024"
55
site: bookdown::bookdown_site
66
documentclass: book
77
bibliography: [book.bib]

docs/introduction.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -486,11 +486,19 @@ <h2><span class="header-section-number">1.6</span> About This Book<a href="intro
486486
<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>
487487
</div>
488488
</div>
489+
490+
<hr>
491+
<center>
492+
<div class="container">
493+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
494+
</div>
495+
</div>
496+
</center>
497+
489498
<hr>
490-
<center>
499+
<center>
491500
<div class="footer">
492501
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
493-
<br>
494502
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
495503
<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>
496504
</div>

docs/languages-and-cloud-computing.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -431,11 +431,19 @@ <h2>AI and Cloud Computing<a href="languages-and-cloud-computing.html#ai-and-clo
431431

432432
</div>
433433
</div>
434+
435+
<hr>
436+
<center>
437+
<div class="container">
438+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
439+
</div>
440+
</div>
441+
</center>
442+
434443
<hr>
435-
<center>
444+
<center>
436445
<div class="footer">
437446
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
438-
<br>
439447
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
440448
<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>
441449
</div>

docs/refactoring-code-hands-on-exercise.html

+10-2
Original file line numberDiff line numberDiff line change
@@ -465,11 +465,19 @@ <h2><span class="header-section-number">12.2</span> Questions<a href="refactorin
465465

466466
</div>
467467
</div>
468+
469+
<hr>
470+
<center>
471+
<div class="container">
472+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
473+
</div>
474+
</div>
475+
</center>
476+
468477
<hr>
469-
<center>
478+
<center>
470479
<div class="footer">
471480
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
472-
<br>
473481
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
474482
<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>
475483
</div>

docs/refactoring-code.html

+13-5
Original file line numberDiff line numberDiff line change
@@ -761,7 +761,7 @@ <h2><span class="header-section-number">10.9</span> Code optimization<a href="re
761761
<span id="cb51-16"><a href="refactoring-code.html#cb51-16" tabindex="-1"></a><span class="co"># End timer</span></span>
762762
<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>
763763
<pre><code>## user system elapsed
764-
## 8.467 0.003 8.469</code></pre>
764+
## 8.472 0.000 8.472</code></pre>
765765
<div class="query">
766766
<p>What is a faster, more optimized way of running the following R code?</p>
767767
</div>
@@ -780,7 +780,7 @@ <h2><span class="header-section-number">10.9</span> Code optimization<a href="re
780780
<span id="cb53-12"><a href="refactoring-code.html#cb53-12" tabindex="-1"></a><span class="co"># End timer</span></span>
781781
<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>
782782
<pre><code>## user system elapsed
783-
## 0.716 0.575 0.628</code></pre>
783+
## 0.744 0.600 0.646</code></pre>
784784
<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>
785785
</div>
786786
<p>So much faster! We can look at another option by regenerating the response:</p>
@@ -799,7 +799,7 @@ <h2><span class="header-section-number">10.9</span> Code optimization<a href="re
799799
<span id="cb55-12"><a href="refactoring-code.html#cb55-12" tabindex="-1"></a><span class="co"># End timer</span></span>
800800
<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>
801801
<pre><code>## user system elapsed
802-
## 0.310 0.291 0.255</code></pre>
802+
## 0.364 0.259 0.262</code></pre>
803803
<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>
804804
</div>
805805
<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>
@@ -829,11 +829,19 @@ <h3><span class="header-section-number">10.10.4</span> Security<a href="refactor
829829
</div>
830830
</div>
831831
</div>
832+
833+
<hr>
834+
<center>
835+
<div class="container">
836+
<iframe class="responsive-iframe" src="https://c-savonen.shinyapps.io/widget-survey/?course_name=ai_programming" style="width: 400px; height: 220px; overflow: auto;"></iframe>
837+
</div>
838+
</div>
839+
</center>
840+
832841
<hr>
833-
<center>
842+
<center>
834843
<div class="footer">
835844
All illustrations <a href="https://creativecommons.org/licenses/by/4.0/">CC-BY. </a>
836-
<br>
837845
All other materials <a href= "https://creativecommons.org/licenses/by/4.0/"> CC-BY </a> unless noted otherwise.
838846
<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>
839847
</div>

0 commit comments

Comments
 (0)