-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
3,627 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
_freeze/schedule/slides/00-quiz-0-wrap/execute-results/html.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"hash": "00096b6cfd1ad274a2aab231017fbef6", | ||
"result": { | ||
"markdown": "---\nlecture: \"00 Quiz 0 fun\"\nformat: revealjs\nmetadata-files: \n - _metadata.yml\n---\n---\n---\n\n## {{< meta lecture >}} {.large background-image=\"gfx/smooths.svg\" background-opacity=\"0.3\"}\n\n[Stat 406]{.secondary}\n\n[{{< meta author >}}]{.secondary}\n\nLast modified -- 13 September 2023\n\n\n\n$$\n\\DeclareMathOperator*{\\argmin}{argmin}\n\\DeclareMathOperator*{\\argmax}{argmax}\n\\DeclareMathOperator*{\\minimize}{minimize}\n\\DeclareMathOperator*{\\maximize}{maximize}\n\\DeclareMathOperator*{\\find}{find}\n\\DeclareMathOperator{\\st}{subject\\,\\,to}\n\\newcommand{\\E}{E}\n\\newcommand{\\Expect}[1]{\\E\\left[ #1 \\right]}\n\\newcommand{\\Var}[1]{\\mathrm{Var}\\left[ #1 \\right]}\n\\newcommand{\\Cov}[2]{\\mathrm{Cov}\\left[#1,\\ #2\\right]}\n\\newcommand{\\given}{\\ \\vert\\ }\n\\newcommand{\\X}{\\mathbf{X}}\n\\newcommand{\\x}{\\mathbf{x}}\n\\newcommand{\\y}{\\mathbf{y}}\n\\newcommand{\\P}{\\mathcal{P}}\n\\newcommand{\\R}{\\mathbb{R}}\n\\newcommand{\\norm}[1]{\\left\\lVert #1 \\right\\rVert}\n\\newcommand{\\snorm}[1]{\\lVert #1 \\rVert}\n$$\n\n\n\n\n\n## Why this class?\n\n* Most say requirements.\n* Interest in ML/Stat learning\n* Expressions of love/affection for Stats/CS/ML\n* Enjoyment of past similar classes\n\n## Why this class?\n\nMore idiosyncratic:\n\n::: incremental\n\n- \"Professor received Phd from CMU, must be an awesome researcher.\"\n- \"Learn strategies.\"\n- (paraphrase) \"Course structure with less weight on exam helps with anxiety\"\n- (paraphrase) \"I love coding in R and want more of it\"\n- \"Emmmmmmmmmmmmmmmm, to learn some skills from Machine Learning and finish my minor🙃.\"\n- \"destiny\"\n- \"challenges from ChatGPT\"\n- \"I thought Daniel Mcdonald is a cool prof...\"\n- \"I have heard this is the most useful stat course in UBC.\"\n\n:::\n\n\n## Syllabus Q\n\n\n\n\n::: {.cell layout-align=\"center\"}\n::: {.cell-output-display}\n![](00-quiz-0-wrap_files/figure-revealjs/unnamed-chunk-1-1.svg){fig-align='center'}\n:::\n:::\n\n\n\n## Programming languages\n\n\n::: {.cell layout-align=\"center\"}\n::: {.cell-output-display}\n![](00-quiz-0-wrap_files/figure-revealjs/unnamed-chunk-2-1.svg){fig-align='center'}\n:::\n:::\n\n\n---\n\n## Matrix inversion\n\n\n::: {.cell layout-align=\"center\"}\n\n```{.r .cell-code}\nlibrary(MASS)\nX <- matrix(c(5, 3, 1, -1), nrow = 2)\nX\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n [,1] [,2]\n[1,] 5 1\n[2,] 3 -1\n```\n:::\n\n```{.r .cell-code}\nsolve(X)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n [,1] [,2]\n[1,] 0.125 0.125\n[2,] 0.375 -0.625\n```\n:::\n\n```{.r .cell-code}\nginv(X)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n [,1] [,2]\n[1,] 0.125 0.125\n[2,] 0.375 -0.625\n```\n:::\n\n```{.r .cell-code}\nX^(-1)\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n [,1] [,2]\n[1,] 0.2000000 1\n[2,] 0.3333333 -1\n```\n:::\n:::\n\n\n\n\n## Linear models\n\n\n::: {.cell layout-align=\"center\"}\n\n```{.r .cell-code}\ny <- X %*% c(2, -1) + rnorm(2)\ncoefficients(lm(y ~ X))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n(Intercept) X1 X2 \n 4.8953718 0.9380314 NA \n```\n:::\n\n```{.r .cell-code}\ncoef(lm(y ~ X))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n(Intercept) X1 X2 \n 4.8953718 0.9380314 NA \n```\n:::\n\n```{.r .cell-code}\nsolve(t(X) %*% X) %*% t(X) %*% y\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n [,1]\n[1,] 2.161874\n[2,] -1.223843\n```\n:::\n\n```{.r .cell-code}\nsolve(crossprod(X), crossprod(X, y))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n [,1]\n[1,] 2.161874\n[2,] -1.223843\n```\n:::\n:::\n\n::: {.cell layout-align=\"center\"}\n\n```{.r .cell-code}\nX \\ y # this is Matlab\n```\n\n::: {.cell-output .cell-output-error}\n```\nError: <text>:1:3: unexpected '\\\\'\n1: X \\\n ^\n```\n:::\n:::\n\n\n\n## Pets and plans\n\n\n::: {.cell layout-align=\"center\"}\n::: {.cell-output-display}\n![](00-quiz-0-wrap_files/figure-revealjs/unnamed-chunk-6-1.svg){fig-align='center'}\n:::\n:::\n\n\n---\n\n## Grade predictions\n\n\n::: {.cell layout-align=\"center\"}\n::: {.cell-output-display}\n![](00-quiz-0-wrap_files/figure-revealjs/unnamed-chunk-7-1.svg){fig-align='center'}\n:::\n:::\n\n\n* 4 people say 100%\n* 24 say 90%\n* 25 say 85%\n* 27 say 80%\n* Lots of clumping\n\n\n. . .\n\n1 said 35, and 1 said 50. Woof!\n\n## Prediction accuracy (last year)\n\n\n::: {.cell layout-align=\"center\"}\n::: {.cell-output-display}\n![](00-quiz-0-wrap_files/figure-revealjs/unnamed-chunk-8-1.svg){fig-align='center'}\n:::\n:::\n\n\n## Prediction accuracy (last year)\n\n\n::: {.cell layout-align=\"center\"}\n\n```{.r .cell-code}\nsummary(lm(actual ~ predicted - 1, data = acc))\n```\n\n::: {.cell-output .cell-output-stdout}\n```\n\nCall:\nlm(formula = actual ~ predicted - 1, data = acc)\n\nResiduals:\n Min 1Q Median 3Q Max \n-63.931 -2.931 1.916 6.052 21.217 \n\nCoefficients:\n Estimate Std. Error t value Pr(>|t|) \npredicted 0.96590 0.01025 94.23 <2e-16 ***\n---\nSignif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1\n\nResidual standard error: 10.2 on 137 degrees of freedom\n (8 observations deleted due to missingness)\nMultiple R-squared: 0.9848,\tAdjusted R-squared: 0.9847 \nF-statistic: 8880 on 1 and 137 DF, p-value: < 2.2e-16\n```\n:::\n:::\n", | ||
"supporting": [ | ||
"00-quiz-0-wrap_files" | ||
], | ||
"filters": [ | ||
"rmarkdown/pagebreak.lua" | ||
], | ||
"includes": { | ||
"include-after-body": [ | ||
"\n<script>\n // htmlwidgets need to know to resize themselves when slides are shown/hidden.\n // Fire the \"slideenter\" event (handled by htmlwidgets.js) when the current\n // slide changes (different for each slide format).\n (function () {\n // dispatch for htmlwidgets\n function fireSlideEnter() {\n const event = window.document.createEvent(\"Event\");\n event.initEvent(\"slideenter\", true, true);\n window.document.dispatchEvent(event);\n }\n\n function fireSlideChanged(previousSlide, currentSlide) {\n fireSlideEnter();\n\n // dispatch for shiny\n if (window.jQuery) {\n if (previousSlide) {\n window.jQuery(previousSlide).trigger(\"hidden\");\n }\n if (currentSlide) {\n window.jQuery(currentSlide).trigger(\"shown\");\n }\n }\n }\n\n // hookup for slidy\n if (window.w3c_slidy) {\n window.w3c_slidy.add_observer(function (slide_num) {\n // slide_num starts at position 1\n fireSlideChanged(null, w3c_slidy.slides[slide_num - 1]);\n });\n }\n\n })();\n</script>\n\n" | ||
] | ||
}, | ||
"engineDependencies": {}, | ||
"preserve": {}, | ||
"postProcess": true | ||
} | ||
} |
Oops, something went wrong.