slides/modules/reproducibility.html
2025-06-29 12:38:48 +02:00

179 lines
8.2 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html lang="en">
<head>
<title>Reproducibility</title>
<meta name="description" content="DataLad for reproducible science and provenance capture">
<meta name="author" content="The DataLad Team">
<meta charset="utf-8">
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui">
<!-- Original reveal JS stylesheets-->
<link rel="stylesheet" href="../reveal.js/dist/reset.css">
<link rel="stylesheet" href="../reveal.js/dist/reveal.css">
<link rel="stylesheet" href="../reveal.js/dist/theme/beige.css">
<!-- custom styles, e.g., imgcredit -->
<link rel="stylesheet" href="../custom/css/main.css" id="theme">
<script src="../custom/js/printpdf.js"></script>
</head>
<body>
<div class="reveal">
<div class="slides">
<section>
<h1>Provenance and reproducibility<br><small>Keep track, redo, verify</small></h1>
</section>
<section>
<section>
<img height="400px" src="../img/xkcd/2054.png"><imgcredit>xkcd comic<a href="https://xkcd.com/2054/" target="_blank">
2054</a></imgcredit>
</section>
<section data-markdown><script type="text/template">
## Reproducibility: Why should *I* care?
</script></section>
<section data-markdown><script type="text/template">
## Your schools, your pension, your comfort!
> Reinhart and Rogoff’s work showed average real economic growth slows (a 0.1% decline) when a country’s debt rises to more than 90% of gross domestic product (GDP) – and this 90% figure was employed repeatedly in political arguments over high-profile austerity measures.
<!-- .element: style="text-align:left;margin:0px;width:100%" -->
> The most serious was that, in their Excel spreadsheet, Reinhart and Rogoff had not selected the entire row when averaging growth figures: they omitted data from Australia, Austria, Belgium, Canada and **Denmark**.
<!-- .element: style="text-align:left;margin:0px;width:100%" -->
> When that error was corrected, the **“0.1% decline” data became a 2.2% average increase** in economic growth.
<!-- .element: style="text-align:left;margin:0px;width:100%" -->
<note>https://theconversation.com/the-reinhart-rogoff-error-or-how-not-to-excel-at-economics-13646</note>
</script></section>
<section data-markdown><script type="text/template">
## The good, the bad, and the ugly
> Traditionally, researchers have been taught to record every detail of their work, including experimental design, procedures, equipment, raw results, data processing, statistical methods and other tools used to analyse the results.
<!-- .element: style="text-align:left;margin:0px;width:100%" -->
> In contrast, relatively few researchers who employ computing in modern science [...] typically take such care in their work.
In most cases, there is no record of workflow, hardware and software configuration, and often even the source code is no longer available (or has been revised numerous times since the study was conducted).
<!-- .element: style="text-align:left;margin:0px;width:100%"" -->
> We think this is a seriously lax environment in which **deliberate fraud** and **genuine error** can proliferate.
<!-- .element: style="text-align:left;margin:0px;width:100%"" -->
<note>https://theconversation.com/the-reinhart-rogoff-error-or-how-not-to-excel-at-economics-13646</note>
</script></section>
</section>
<section>
<section data-markdown><script type="text/template">
If everything is important... **track everything!**
We can only track things that are written... **write down/out everything!**
</script></section>
<section>
We perform a reproducible data processing task in the previously created <code>penguin-beaks</code>dataset hierarchy.<br><br>
Download a script, and save it as "code/extract.py":<br> <a href="https://hub.datalad.org/edu/scripts/raw/branch/main/penguins/extract.py" target="_blank">hub.datalad.org/edu/scripts/raw/branch/main/penguins/extract.py</a>
<pre><code data-trim class="language-bash" onmousemove="showHover(event)" onmousedown="clickCopy(event)" onmouseleave="leaveElement(event)">
curl https://hub.datalad.org/edu/scripts/raw/branch/main/penguins/extract.py -o code/extract.py
</code></pre>
<pre><code data-trim class="language-bash" onmousemove="showHover(event)" onmousedown="clickCopy(event)" onmouseleave="leaveElement(event)">
datalad status
</code></pre>
<pre><code data-trim class="language-bash" onmousemove="showHover(event)" onmousedown="clickCopy(event)" onmouseleave="leaveElement(event)">
datalad save -m "Add processing script"
</code></pre>
"<code>python code/extract.py</code>" executes the script on data in <code>inputs/</code>.
Wrapping it inside of <code>datalad run</code> records what happens:
<pre><code data-trim class="language-bash" onmousemove="showHover(event)" onmousedown="clickCopy(event)" onmouseleave="leaveElement(event)">
datalad run -m "extract culmen length of male adelie penguins" -i inputs/adelie/table_219.csv -o reproducible-results.dat "python code/extract.py > reproducible-results.dat"
</code></pre>
Check out the recorded provenance in the revision history:
<pre><code data-trim class="language-bash" onmousemove="showHover(event)" onmousedown="clickCopy(event)" onmouseleave="leaveElement(event)">
gitk
</code></pre>
</ul>
</section>
<section data-transition="None">
Drop the file (with force):
<pre><code data-trim class="language-bash" onmousemove="showHover(event)" onmousedown="clickCopy(event)" onmouseleave="leaveElement(event)">
datalad drop --reckless availability reproducible-results.dat</code></pre>
Get will fail:
<pre><code data-trim class="language-bash" onmousemove="showHover(event)" onmousedown="clickCopy(event)" onmouseleave="leaveElement(event)">
datalad get results.dat </code></pre>
Rerun the process and update the dataset if outputs change:
<pre><code data-trim class="language-bash" onmousemove="showHover(event)" onmousedown="clickCopy(event)" onmouseleave="leaveElement(event)">
datalad rerun
</code></pre>
</section>
<section data-transition="None">
<p> <strong>datalad run</strong> wraps around anything expressed in a command
line call and saves the dataset modifications resulting from the execution.</p>
<img src="../img/concepts/run.svg">
</section>
<section data-transition="None">
<p> <strong>datalad rerun</strong> repeats captured executions.
<br>If the outcomes differ, it saves a new state of them.</p>
<img src="../img/concepts/rerun.svg">
</section>
</section>
</div> <!-- /.slides -->
</div> <!-- /.reveal -->
<script src="../reveal.js/dist/reveal.js"></script>
<script src="../reveal.js/plugin/notes/notes.js"></script>
<script src="../reveal.js/plugin/markdown/markdown.js"></script>
<script src="../reveal.js/plugin/highlight/highlight.js"></script>
<script src="../custom/js/copy-code.js"></script>
<script>
// Full list of configuration options available at:
// https://github.com/hakimel/reveal.js#configuration
Reveal.initialize({
// The "normal" size of the presentation, aspect ratio will be preserved
// when the presentation is scaled to fit different resolutions. Can be
// specified using percentage units.
width: 1280,
height: 960,
// Factor of the display size that should remain empty around the content
margin: 0.1,
// Bounds for smallest/largest possible scale to apply to content
minScale: 0.2,
maxScale: 1.0,
controls: true,
progress: true,
history: true,
center: true,
transition: 'slide', // none/fade/slide/convex/concave/zoom
// Optional reveal.js plugins
plugins: [ RevealMarkdown, RevealHighlight, RevealNotes ]
});
</script>
<!-- A footer with a "1" and "home" button to get back to the first slide and the index page -->
<div id="hidden" style="display:none;">
<div id="header">
<div id="footer-left"><a href="#0">1️⃣</a></div>
<div id="footer-right"><a href="../workshops/2025-DKZ.2R.html">🏠</a></div>
<!-- <div id="footer-right"><a href="../index.html">🏠</a></div>-->
</div>
</div>
<script src="https://code.jquery.com/jquery-2.2.4.min.js"></script>
<script src="../custom/js/headerandfooter.js"></script>
</body>
</html>