Update 'sec4.2.ipynb'

This commit is contained in:
TerenceLiu 2023-02-20 15:45:29 +08:00
parent c3e5e5e6eb
commit 6a49d61a4d
1 changed files with 295 additions and 20 deletions

View File

@ -2,7 +2,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 1,
"id": "011c5f34-be40-4f0b-8146-73f66ba18672", "id": "011c5f34-be40-4f0b-8146-73f66ba18672",
"metadata": { "metadata": {
"tags": [] "tags": []
@ -16,31 +16,172 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 2,
"id": "7a1ba495-73ac-4710-bab7-edb429ab9628", "id": "7a1ba495-73ac-4710-bab7-edb429ab9628",
"metadata": { "metadata": {
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"data": {
"text/html": [
"\n",
" <iframe\n",
" width=\"1080\"\n",
" height=\"800\"\n",
" src=\"https://ufal.mff.cuni.cz/~straka/courses/npfl129/2223/demos/mnist_web.html\"\n",
" frameborder=\"0\"\n",
" allowfullscreen\n",
" \n",
" ></iframe>\n",
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x7ff78cb8c7c0>"
]
},
"execution_count": 2,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"IFrame(\"https://ufal.mff.cuni.cz/~straka/courses/npfl129/2223/demos/mnist_web.html\", width=1080, height=800)" "IFrame(\"https://ufal.mff.cuni.cz/~straka/courses/npfl129/2223/demos/mnist_web.html\", width=1080, height=800)"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 3,
"id": "a4827f0c", "id": "a4827f0c",
"metadata": { "metadata": {
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "09273efb924743fe9166063fedbbdb01",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(VBox(children=(Text(value='sin(x) + sin((10.0 / 3.0) * x)', description='Express…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8fb9b9acda4645d68c9edce4f9f90327",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "8967e9daa8514d2bb5c1357d3eed43ef",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<algorithm.optimization.gradient.gd1d at 0x7ff78cb8c700>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"gd1d(environ=\"jupyterlab\")" "gd1d(environ=\"jupyterlab\")"
] ]
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 5,
"id": "bb36631d-cc88-4a66-b057-33b4355eb757",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "5e92624f2062434ca3acdb4ad697d220",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(Dropdown(options=(('(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a44ccfbc22e14a8e8c0448d2dd59910d",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "bf12052c62284e63bd556f279581d5dc",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<algorithm.optimization.gradient.gd2d_compete at 0x7ff78813e770>"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gd2d_compete(environ=\"jupyterlab\")"
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "f28bd167", "id": "f28bd167",
"metadata": { "metadata": {
"slideshow": { "slideshow": {
@ -48,7 +189,153 @@
}, },
"tags": [] "tags": []
}, },
"outputs": [], "outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "b79aad48bb9f4cfa992dcea0aa720e67",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(Dropdown(options=(('(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "a86144f7d0334c4cba8712372558d6bf",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "9808dc0661a745249011c3b46041d295",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "aaa14c821855466999a584708a88eae5",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<algorithm.optimization.gradient.gd2d at 0x7ff78c663910>"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"gd2d(environ=\"jupyterlab\")"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "d5651fc9-3fcd-4e91-8d3c-04897da1ea02",
"metadata": {
"tags": []
},
"outputs": [
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4fd3c62cc07f4d1096f71b945c85da49",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"VBox(children=(HBox(children=(Dropdown(options=(('(1 - 8 * x1 + 7 * x1**2 - (7/3) * x1**3 + (1/4) * x1**4) * x…"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "594ba59306d044f5a0465bbd16b66572",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "4395055562f84b6ba2f06b9f7212f761",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"application/vnd.jupyter.widget-view+json": {
"model_id": "94f9b8e9a80547f39f225c74dcbccadd",
"version_major": 2,
"version_minor": 0
},
"text/plain": [
"Output()"
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/plain": [
"<algorithm.optimization.gradient.gd2d at 0x7ff78813f850>"
]
},
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [ "source": [
"gd2d(environ=\"jupyterlab\")" "gd2d(environ=\"jupyterlab\")"
] ]
@ -56,19 +343,7 @@
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": null,
"id": "d5651fc9-3fcd-4e91-8d3c-04897da1ea02", "id": "318a7308-55ea-43f4-bdee-df614a22f40d",
"metadata": {
"tags": []
},
"outputs": [],
"source": [
"gd2d_compete(environ=\"jupyterlab\")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7defa790-4169-4e6e-8cb9-1ba867fcc08b",
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [] "source": []