Skip to content

Instantly share code, notes, and snippets.

@baogorek
Last active February 12, 2019 13:48
Show Gist options
  • Save baogorek/e8009ab4d441bb1fccb9c67c35648332 to your computer and use it in GitHub Desktop.
Save baogorek/e8009ab4d441bb1fccb9c67c35648332 to your computer and use it in GitHub Desktop.
Display the source blob
Display the rendered blob
Raw
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In Part I, we had *fitness* and *fatigue* features of the form:\n",
"$$\n",
"\\sum_{i=1}^{n-1} w_i \\exp \\left(\\frac{-(n-i)}{\\tau} \\right),\n",
"$$\n",
"where the exponential decay of both fitness and fatige from initial levels arose from a first order linear dynamic system. But what if that model is not right? Suppose instead that the true \"decay function,\" which I'll hereby refer to as a \"lag distribution\" (See [Sims 1971](https://www.jstor.org/stable/1913265?seq=1#page_scan_tab_contents)) since it might be strictly decreasing, is an arbitrary smooth, continuous function $f(x)$. As a smooth, continuous function, $f(x)$ is a good candidate for approximation via basis functions taking the form\n",
"$$\n",
"\\eta(t) = \\theta_1 + \\sum_{j=2}^p \\theta_j g_j(t),\n",
"$$\n",
"and in this article we'll consider parametric cubic splines for the job. \n",
"\n",
"Consider our general purpose convolution-based feature\n",
"$$r_s = \\sum_{i = 0} ^ {s-1} w_i \\eta(s - i), s = 1, \\ldots n$$.\n",
"\n",
"Expanding $\\eta(t)$ leads to\n",
"$$\n",
"r_s = \\theta_1 \\sum_{i=1}^{s-1} w_i + \\sum_{j=2}^p \\theta_j \\sum_{i = 1}^{s-1} w_i g_j(s-i).\n",
"$$\n",
"\n",
"Thus, implementing this convolution based feature amounts to a linear regression with the following $p$ covariates:\n",
"\n",
"\\begin{align*}\n",
"z_1 &= \\sum_{i=1}^{s-1} w_i, \\\\\n",
"z_j &= \\sum_{i = 1}^{s-1} w_i g_j(s-i), \\; j = 2, \\ldots, p.\n",
"\\end{align*}\n",
"\n",
"Having multiple convolution based covariates based on training intensity is reminiscent of *fitness* and *fatigue*, which were exponentials with different decay time constants convolved with training intensity. However, even if the fitness fatigue model holds exactly, we'd only need one spline function to convolve with training input. This is because use of the two separate fitness and fatigue convolutions is equivalent to convolving training intensity with function\n",
"$$\n",
"r_n = 0.07 \\exp (-n / 60) - 0.27 \\exp(-n / 13),\n",
"$$\n",
"which involves rearranging terms in the original regression and using linearity of the summation. This function is *not* exponential decay:"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment