Updating slides
|
@ -77,7 +77,6 @@ title: "UB Hacking: Microkernel Notebooks"
|
||||||
WHERE l.orderkey = o.orderkey
|
WHERE l.orderkey = o.orderkey
|
||||||
AND o.orderdate > DATE(NOW() - '1 Month')
|
AND o.orderdate > DATE(NOW() - '1 Month')
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<div class="fragment" style="font-size: 70%;">
|
|
||||||
<pre><code class="sql">
|
<pre><code class="sql">
|
||||||
SELECT partkey FROM salesSinceLastMonth
|
SELECT partkey FROM salesSinceLastMonth
|
||||||
ORDER BY shipdate DESC LIMIT 10;
|
ORDER BY shipdate DESC LIMIT 10;
|
||||||
|
@ -88,17 +87,61 @@ title: "UB Hacking: Microkernel Notebooks"
|
||||||
GROUP BY suppkey;
|
GROUP BY suppkey;
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<pre><code class="sql">
|
<pre><code class="sql">
|
||||||
SELECT partkey, COUNT(*)
|
SELECT DISTINCT partkey
|
||||||
FROM salesSinceLastMonth
|
FROM salesSinceLastMonth
|
||||||
GROUP BY partkey;
|
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</div>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<pre><code class="python">
|
||||||
|
def really_expensive_computation():
|
||||||
|
return [
|
||||||
|
expensive_computation(i)
|
||||||
|
for i in range(1, 1000000):
|
||||||
|
if expensive_test(i)
|
||||||
|
]
|
||||||
|
</code></pre>
|
||||||
|
<pre><code class="python">
|
||||||
|
print(sorted(really_expensive_computation())[:10])
|
||||||
|
</code></pre>
|
||||||
|
<pre><code class="python">
|
||||||
|
print(len(really_expensive_computation()))
|
||||||
|
</code></pre>
|
||||||
|
<pre><code class="python">
|
||||||
|
print(set(really_expensive_computation()))
|
||||||
|
</code></pre>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<p><b>Opportunity:</b> Views exist to be queried frequently</p>
|
<p><b>Opportunity:</b> Views are queried frequently</p>
|
||||||
<p class="fragment"><b>Idea: </b> Pre-compute and save the view’s contents!</p>
|
<p class="fragment"><b>Idea: </b> Pre-compute and save the view’s contents!</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<pre><code class="python">
|
||||||
|
def really_expensive_computation():
|
||||||
|
return [
|
||||||
|
expensive_computation(i)
|
||||||
|
for i in range(1, 1000000):
|
||||||
|
if expensive_test(i)
|
||||||
|
]
|
||||||
|
|
||||||
|
view = really_expensive_computation()
|
||||||
|
</code></pre>
|
||||||
|
<pre><code class="python">
|
||||||
|
print(sorted(view)[:10])
|
||||||
|
</code></pre>
|
||||||
|
<pre><code class="python">
|
||||||
|
print(len(view))
|
||||||
|
</code></pre>
|
||||||
|
<pre><code class="python">
|
||||||
|
print(set(view))
|
||||||
|
</code></pre>
|
||||||
|
</section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<p>Btw... the last slide was the essence of CSE 250.</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<svg data-src="graphics/2022-04-02/DBToQ.svg" />
|
<svg data-src="graphics/2022-04-02/DBToQ.svg" />
|
||||||
|
@ -196,11 +239,7 @@ title: "UB Hacking: Microkernel Notebooks"
|
||||||
<img src="graphics/logos/jupyter.svg" height="500px">
|
<img src="graphics/logos/jupyter.svg" height="500px">
|
||||||
<img src="graphics/2022-04-02/jupyter.png" height="500px">
|
<img src="graphics/2022-04-02/jupyter.png" height="500px">
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
|
||||||
<img src="graphics/2022-04-02/jupyter.png" height="500px">
|
|
||||||
</section>
|
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<pre><code class="python">
|
<pre><code class="python">
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
|
@ -307,20 +346,22 @@ title: "UB Hacking: Microkernel Notebooks"
|
||||||
<pre><code class="python">
|
<pre><code class="python">
|
||||||
df = pd.read_csv("really_big_dataset.csv")
|
df = pd.read_csv("really_big_dataset.csv")
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<pre><code class="python">
|
<pre style="box-shadow: 0px 0px 12px red; "><code class="python">
|
||||||
test = df.iloc[:500]
|
test = df.iloc[:500]
|
||||||
train = df.iloc[500:]
|
train = df.iloc[500:]
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<pre class="fragment red-shadow-current"><code class="python">
|
<pre class="fragment red-shadow-current" data-fragment-index="1"><code class="python">
|
||||||
model = train_linear_regression(train, "target")
|
model = train_linear_regression(train, "target")
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<pre class="fragment red-shadow-current"><code class="python">
|
<pre class="fragment red-shadow-current" data-fragment-index="1"><code class="python">
|
||||||
evaluate_linear_regresion(model, test, "target")
|
evaluate_linear_regresion(model, test, "target")
|
||||||
</code></pre>
|
</code></pre>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h3>In a script...</h3>
|
<h3>Q1: Which cells need to be re-evaluated?</h3>
|
||||||
|
|
||||||
|
<p style="margin-top: 100px; font-weight: bold;" class="fragment">Idea 1: All of them!</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
@ -343,21 +384,29 @@ title: "UB Hacking: Microkernel Notebooks"
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<p><tt>df</tt> is still around, and you can "re-use" it.</p>
|
<p>... but <tt>df</tt> is still around, and you can "re-use" it.</p>
|
||||||
|
|
||||||
<p style="margin-top: 100px; font-weight: bold;" class="fragment">... but <u>you</u> need to know that.</p>
|
<p style="margin-top: 100px; font-weight: bold;" class="fragment">... but <u class="fragment highlight-red">you</u> need to know that.</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|
||||||
|
<section>
|
||||||
|
<p>Idea 2: Pull out your CSE 443 Textbooks</p>
|
||||||
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<svg data-src="graphics/2022-04-02/data-flow-simple.svg" height="500px" />
|
<svg data-src="graphics/2022-04-02/data-flow-simple.svg" height="500px" />
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
<h2>Data Flow Graph</h2>
|
<h2>Data Flow Graph</h2>
|
||||||
|
|
||||||
|
<p>Cell 3 changed, so re-evaluate only cells 4 and 5</p>
|
||||||
|
|
||||||
|
<p style="margin-top: 100px; font-weight: bold;" class="fragment">... but</p>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section>
|
<section>
|
||||||
|
|
Before Width: | Height: | Size: 68 KiB After Width: | Height: | Size: 70 KiB |
|
@ -25,9 +25,9 @@
|
||||||
inkscape:document-units="mm"
|
inkscape:document-units="mm"
|
||||||
showgrid="false"
|
showgrid="false"
|
||||||
inkscape:zoom="1.4948513"
|
inkscape:zoom="1.4948513"
|
||||||
inkscape:cx="264.24033"
|
inkscape:cx="113.05472"
|
||||||
inkscape:cy="358.5641"
|
inkscape:cy="465.59815"
|
||||||
inkscape:window-width="1920"
|
inkscape:window-width="1090"
|
||||||
inkscape:window-height="1011"
|
inkscape:window-height="1011"
|
||||||
inkscape:window-x="1080"
|
inkscape:window-x="1080"
|
||||||
inkscape:window-y="306"
|
inkscape:window-y="306"
|
||||||
|
@ -486,5 +486,60 @@
|
||||||
rx="49.2808"
|
rx="49.2808"
|
||||||
ry="3.8364925" />
|
ry="3.8364925" />
|
||||||
</g>
|
</g>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:5.29167px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;stroke-width:0.264583"
|
||||||
|
x="0.55351955"
|
||||||
|
y="5.0688901"
|
||||||
|
id="text5106"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan5104"
|
||||||
|
style="font-weight:bold;font-size:5.29167px;stroke-width:0.264583"
|
||||||
|
x="0.55351955"
|
||||||
|
y="5.0688901">[1]</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:5.29167px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;stroke-width:0.264583"
|
||||||
|
x="0.55351955"
|
||||||
|
y="42.110558"
|
||||||
|
id="text8688"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan8686"
|
||||||
|
style="font-weight:bold;font-size:5.29167px;stroke-width:0.264583"
|
||||||
|
x="0.55351955"
|
||||||
|
y="42.110558">[2]</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:5.29167px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;stroke-width:0.264583"
|
||||||
|
x="0.55351955"
|
||||||
|
y="76.506393"
|
||||||
|
id="text8794"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan8792"
|
||||||
|
style="font-weight:bold;font-size:5.29167px;stroke-width:0.264583"
|
||||||
|
x="0.55351955"
|
||||||
|
y="76.506393">[3]</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:5.29167px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;stroke-width:0.264583"
|
||||||
|
x="0.55351955"
|
||||||
|
y="114.60635"
|
||||||
|
id="text8900"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan8898"
|
||||||
|
style="font-weight:bold;font-size:5.29167px;stroke-width:0.264583"
|
||||||
|
x="0.55351955"
|
||||||
|
y="114.60635">[4]</tspan></text>
|
||||||
|
<text
|
||||||
|
xml:space="preserve"
|
||||||
|
style="font-size:5.29167px;line-height:1.25;font-family:Ubuntu;-inkscape-font-specification:Ubuntu;letter-spacing:0px;stroke-width:0.264583;word-spacing:0px"
|
||||||
|
x="0.55351955"
|
||||||
|
y="150.58965"
|
||||||
|
id="text9006"><tspan
|
||||||
|
sodipodi:role="line"
|
||||||
|
id="tspan9004"
|
||||||
|
style="font-weight:bold;font-size:5.29167px;stroke-width:0.264583"
|
||||||
|
x="0.55351955"
|
||||||
|
y="150.58965">[5]</tspan></text>
|
||||||
</g>
|
</g>
|
||||||
</svg>
|
</svg>
|
||||||
|
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 143 KiB After Width: | Height: | Size: 141 KiB |
Before Width: | Height: | Size: 86 KiB After Width: | Height: | Size: 143 KiB |