2024-09-29 12:14:44 +00:00
|
|
|
{
|
|
|
|
"cells": [
|
|
|
|
{
|
2024-09-30 20:41:48 +00:00
|
|
|
"cell_type": "markdown",
|
2024-09-29 12:14:44 +00:00
|
|
|
"metadata": {},
|
|
|
|
"source": [
|
2024-09-30 20:41:48 +00:00
|
|
|
"# Regressions\n",
|
2024-09-29 12:14:44 +00:00
|
|
|
"\n",
|
2024-09-30 20:41:48 +00:00
|
|
|
"$X = (0,1)$\n",
|
2024-09-29 12:14:44 +00:00
|
|
|
"\n",
|
2024-09-30 20:41:48 +00:00
|
|
|
"$Y = sin(2\\pi X)$"
|
2024-09-29 12:14:44 +00:00
|
|
|
]
|
2024-09-29 18:27:50 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-09-30 20:41:48 +00:00
|
|
|
"execution_count": 24,
|
2024-09-29 18:27:50 +00:00
|
|
|
"metadata": {},
|
|
|
|
"outputs": [
|
|
|
|
{
|
|
|
|
"data": {
|
|
|
|
"text/markdown": [
|
2024-09-30 20:41:48 +00:00
|
|
|
"![name](data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAqAAAAGACAIAAAD9Gkc5AABXGElEQVR4nOzdB3RUddo/8Gd6S5vJzKT30AIJ3YTQRYRVREUsgIorLui6suwuun91dZFd993XtrbXLeoCghJEpAsooKAQmkAIKZSUSS+TPkmmz/9MhgwQQkiZmTvl+zlzOHPv3Ln3SbiZZ36da7FYCAAAALwLl+kAAHyORqPx8/O7do/JZOJwOC64dLcX2rt374EDByQSyapVq1wQAwC4BpvpAAB8RVVV1cKFC++5557f/e5399xzz/Dhw8+ePWt7afLkycuWLXN2ACqVKjAwcNeuXV32z549OzQ0dNOmTV32f/vttw8++KBIJJo0adJdd901ocOiRYt+/vlnZ4cKAAOHBA/gIo899lhiYuLOnTs//vjjnTt3Llq0qLGx0fbS008//eCDDzo7gNDQ0JUrV44ePbqXx995553PPvusVqv961//+s0332RmZu7bty8kJCQ1NfXPf/5zz+/dvXu30Wh0RNQA0E+oogdwBYvFcvjw4UWLFtn3LFiwgM/n254//vjjN3sXi8Xq5flvPLLLToFAcGMlvO0YNpvdbXcc29vtJwkICHjnnXeMRuNf//rX2bNnT5gwodtgdDrdU089VVxczOXiEwaAMSjBA7gCi8WKi4t79dVXDx8+bNsTFxcXERFBRPv3758zZ85vf/tbIrp06dIjjzxy3333vfDCCyNGjBCLxbaUfOLEiblz5z777LNEVFRU9Lvf/S45Obm9vZ2Ivvzyy/T09CeeeGLatGk7d+605ex333139uzZtp0ffvih7YoffvjhmDFjtm/fbtu8ePHizJkz77777ieffPLLL7/s9puELet3yf2rV682m82fffYZETU0NEyZMmXBggW33377Pffc09raWl1d/cQTT1RVVT322GNvvPEGEf3nP/+ZOXPmY489lpycvHbtWuf/sgGggwUAXGLfvn22vnXDhw9/++23W1pa7C8tWbLk3nvvtT1ftWpVSkqKVqs1m82rVq1is9kajcZisTz99NNz5syxHfPTTz/ZOusZDAaxWHzq1CmLxVJYWLhjxw6LxfLFF19ERkba3lVbWxsUFPTVV1/Z3hgcHLxmzRqLxaLX62NjY1etWmXb/9Zbbw0dOvTGmH/44Qci+uGHH7rsj4yMnD59usViqamp+eijjywWi8FgkEgkn376qcVi2b9/PxFptVr7yW3BfPTRRwEBAU741QJAN1CCB3CRO++8My8v75VXXmlra/vDH/6QnJxcXl7e7ZF8Pl8gELBYrPvuu89sNqvV6pud02w2m0ymLVu2GI3GuLi4e+65h4g+/fTTWbNmSSQSIpLL5bNmzVqzZk2XN+7bt6+4uLjfPftkMllDQwMRKRSKZ555hoi4XG5sbGxNTc2NB//hD3+wBTNo0KDm5matVtu/iwJAnyDBA7hOZGTk6tWrCwoK1q5dW1FR8Ze//KXn42/Zhs3n89966633338/JibmxRdfbGtrI6Li4mKlUmk/JiwsrLi4uMsbCwsLhUJhSEhI/36QioqKxMREImpra3v11VeXLl26cuXKqqqqbuv5jx079qtf/eq3v/3tf/7zn/5dDgD6AV1gAFzBYrHk5+cPGzbM1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znRMAADO8eabbxYWFv7lL3/R6XTPPPPMU0891fPxHA4nKSnJtuLizSgUiq+//jojI8NoNM6ePZuIDh482N7ent75YTpjxoxLHbq8cevWrXfffTeLxRrwj9Vb7tLJDlzGz49++UumgwAAcImYmJg//elPf/zjH5966qk1a9a88cYbcrm8h+NvmYCXLl1qNBp/+ctfLl++/
|
2024-09-29 18:27:50 +00:00
|
|
|
]
|
|
|
|
},
|
2024-09-30 20:41:48 +00:00
|
|
|
"execution_count": 24,
|
2024-09-29 18:27:50 +00:00
|
|
|
"metadata": {},
|
|
|
|
"output_type": "execute_result"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"source": [
|
2024-09-30 20:41:48 +00:00
|
|
|
"// deno-lint-ignore-file\n",
|
|
|
|
"\n",
|
|
|
|
"import { display } from \"https://deno.land/x/display@v0.1.1/mod.ts\";\n",
|
|
|
|
"import pl from \"npm:nodejs-polars\";\n",
|
|
|
|
"import plot from \"../plot/mod.ts\";\n",
|
|
|
|
"\n",
|
|
|
|
"const data = await Deno.readTextFile(\"assets/X_Y_Sinusoid_Data.csv\");\n",
|
|
|
|
"const df = pl.readCSV(data, { sep: \",\" });\n",
|
|
|
|
"\n",
|
|
|
|
"const real = pl.DataFrame({ x: new Array(100).fill(0).map((_, i) => i / 100)}).select(\n",
|
|
|
|
" pl.col('x'),\n",
|
|
|
|
" pl.col('x').mul(2).mul(3.14).sin().alias('y')\n",
|
|
|
|
");\n",
|
|
|
|
"\n",
|
|
|
|
"const draw = (x, y, title = \"Sinusoid Data\") => \n",
|
|
|
|
" plot.DrawPlot(\n",
|
|
|
|
" { \n",
|
|
|
|
" title,\n",
|
|
|
|
" width: 7,\n",
|
|
|
|
" height: 4,\n",
|
|
|
|
" XLabel: \"X\", \n",
|
|
|
|
" YLabel: \"Y\", \n",
|
|
|
|
" }, \n",
|
|
|
|
" { type: \"line\", data: [real.x, real.y], legend: \"Sinusoid\", lineDashes: [3, 4], lineColor: \"#ff8888\", lineWidth: 1 },\n",
|
|
|
|
" { type: \"scatter\", data: [x, y], legend: \"Data\", lineDashes: [3, 4], lineWidth: 2, glyphColor: \"#4444ff\", glyphShape: \"circle\" },\n",
|
|
|
|
" { type: \"trend\", data: [x, y], legend: \"Trend\", lineDashes: [4, 2], lineColor: '#aacccc', lineWidth: .5 },\n",
|
|
|
|
" );\n",
|
|
|
|
"\n",
|
2024-09-29 18:27:50 +00:00
|
|
|
"\n",
|
2024-09-30 20:41:48 +00:00
|
|
|
"draw(df.x, df.y);"
|
2024-09-30 17:12:28 +00:00
|
|
|
]
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"cell_type": "code",
|
2024-09-30 20:41:48 +00:00
|
|
|
"execution_count": null,
|
2024-09-30 17:12:28 +00:00
|
|
|
"metadata": {},
|
2024-09-30 20:41:48 +00:00
|
|
|
"outputs": [],
|
|
|
|
"source": []
|
2024-09-29 12:14:44 +00:00
|
|
|
}
|
|
|
|
],
|
|
|
|
"metadata": {
|
|
|
|
"kernelspec": {
|
|
|
|
"display_name": "Deno",
|
|
|
|
"language": "typescript",
|
|
|
|
"name": "deno"
|
|
|
|
},
|
|
|
|
"language_info": {
|
|
|
|
"codemirror_mode": "typescript",
|
|
|
|
"file_extension": ".ts",
|
|
|
|
"mimetype": "text/x.typescript",
|
|
|
|
"name": "typescript",
|
|
|
|
"nbconvert_exporter": "script",
|
|
|
|
"pygments_lexer": "typescript",
|
|
|
|
"version": "5.6.2"
|
|
|
|
}
|
|
|
|
},
|
|
|
|
"nbformat": 4,
|
|
|
|
"nbformat_minor": 2
|
|
|
|
}
|