Created
April 22, 2021 14:06
-
-
Save damontallen/a612acaed7449295f0282b584a446e0f to your computer and use it in GitHub Desktop.
Testing nbviewer
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
{ | |
"cells": [ | |
{ | |
"cell_type": "code", | |
"execution_count": 3, | |
"id": "difficult-palestinian", | |
"metadata": {}, | |
"outputs": [ | |
{ | |
"name": "stdout", | |
"output_type": "stream", | |
"text": [ | |
"### 2.3 Vectorized and Regularized Logistic Gradient\n", | |
"Since $ \\frac{\\partial}{\\partial θ} θ_j^2 = 2θ_j $, using the result\n", | |
"above we can write the vectorized logistic gradient with regularization as:\n", | |
"$$ \\frac{\\partial}{\\partial θ} J(θ) \n", | |
"= \\frac{1}{m} \\sum_{i=1}^{m} \\left[ h_θ(x^{(i)}) - y^{(i)} \\right] \\, x^{(i)}\n", | |
"+ \\frac{λ}{m} \\sum_{j=1}^{n} θ_j\n", | |
"$$\n" | |
] | |
} | |
], | |
"source": [ | |
"txt = (\"### 2.3 Vectorized and Regularized Logistic Gradient\\n\",\n", | |
"\n", | |
" \"Since $ \\\\frac{\\\\partial}{\\\\partial θ} θ_j^2 = 2θ_j $, using the result\\n\",\n", | |
"\n", | |
" \"above we can write the vectorized logistic gradient with regularization as:\\n\",\n", | |
"\n", | |
" \"$$ \\\\frac{\\\\partial}{\\\\partial θ} J(θ) \\n\",\n", | |
"\n", | |
" \"= \\\\frac{1}{m} \\\\sum_{i=1}^{m} \\\\left[ h_θ(x^{(i)}) - y^{(i)} \\\\right] \\\\, x^{(i)}\\n\",\n", | |
"\n", | |
" \"+ \\\\frac{λ}{m} \\\\sum_{j=1}^{n} θ_j\\n\",\n", | |
"\n", | |
" \"$$\")\n", | |
"print(''.join(txt))\n" | |
] | |
}, | |
{ | |
"cell_type": "markdown", | |
"id": "latest-greek", | |
"metadata": {}, | |
"source": [ | |
"### 2.3 Vectorized and Regularized Logistic Gradient\n", | |
"Since $ \\frac{\\partial}{\\partial θ} θ_j^2 = 2θ_j $, using the result\n", | |
"above we can write the vectorized logistic gradient with regularization as:\n", | |
"\\begin{equation}\n", | |
"\\frac{\\partial}{\\partial θ} J(θ) \n", | |
"= \\frac{1}{m} \\sum_{i=1}^{m} \\left[ h_θ(x^{(i)}) - y^{(i)} \\right] \\, x^{(i)}\n", | |
"+ \\frac{λ}{m} \\sum_{j=1}^{n} θ_j\n", | |
"\\end{equation}\n" | |
] | |
}, | |
{ | |
"cell_type": "code", | |
"execution_count": null, | |
"id": "conservative-northwest", | |
"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.8.2" | |
} | |
}, | |
"nbformat": 4, | |
"nbformat_minor": 5 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment