updated readme
This commit is contained in:
@@ -409,6 +409,7 @@ Recommended prereading: Chapters 1-2 (linear algebra) and chapter 3 (statistics)
|
||||
- Lecture Thursday: Support Vector Machines
|
||||
- Video of Lecture at https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h21/forelesningsvideoer/LectureNovember25.mp4?vrtx=view-as-webpage
|
||||
- Lecture Friday: Support Vector Machines and Summary of Course
|
||||
- Video of Lecture at https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h21/forelesningsvideoer/LectureNovember26.mp4?vrtx=view-as-webpage
|
||||
- Reading recommendations:
|
||||
- See lecture notes for week 47 at https://compphysics.github.io/MachineLearning/doc/web/course.html.
|
||||
- Geron's chapter 5.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d0a34092",
|
||||
"id": "c475c107",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<!-- HTML file automatically generated from DocOnce source (https://github.com/doconce/doconce/)\n",
|
||||
@@ -11,7 +11,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a4d8f404",
|
||||
"id": "424b8b49",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"# Clustering Analysis\n",
|
||||
@@ -37,7 +37,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ae95f76d",
|
||||
"id": "0530d5a8",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Basic Idea of the K-means Clustering Algorithm\n",
|
||||
@@ -68,7 +68,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "a919a12d",
|
||||
"id": "032b0982",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<!-- Equation labels as ordinary links -->\n",
|
||||
@@ -83,7 +83,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1afc1372",
|
||||
"id": "7741996c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"which we wish to group into $K < n$ clusters. For our dissimilarity measure we\n",
|
||||
@@ -92,7 +92,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c4332ba1",
|
||||
"id": "9fa36cba",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<!-- Equation labels as ordinary links -->\n",
|
||||
@@ -108,7 +108,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "7c6eca50",
|
||||
"id": "67c0c2fb",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Next we define the so called *within-cluster point scatter* which gives us a\n",
|
||||
@@ -118,7 +118,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d762d24f",
|
||||
"id": "9e06af7f",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<!-- Equation labels as ordinary links -->\n",
|
||||
@@ -135,7 +135,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "058e6d60",
|
||||
"id": "617b1871",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"where $\\boldsymbol{\\overline{x_k}}$ is the mean vector associated with the $k$-th\n",
|
||||
@@ -150,7 +150,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "191959b0",
|
||||
"id": "56283dc8",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<!-- Equation labels as ordinary links -->\n",
|
||||
@@ -169,7 +169,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "c170bd21",
|
||||
"id": "6995cce8",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Which is a quantity that is conserved throughout the $k$-means algorithm. It can\n",
|
||||
@@ -183,7 +183,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "d495c32e",
|
||||
"id": "2767eaea",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"<!-- Equation labels as ordinary links -->\n",
|
||||
@@ -198,7 +198,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "5835ab97",
|
||||
"id": "fe5dd65d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now we have all the pieces necessary to formally revisit the k-means algorithm.\n",
|
||||
@@ -209,7 +209,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "5804711e",
|
||||
"id": "3d051e1f",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## The K-means Clustering Algorithm\n",
|
||||
@@ -244,7 +244,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "bda4544a",
|
||||
"id": "a8d5180d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Writing Our Own Code\n",
|
||||
@@ -255,7 +255,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "0229351b",
|
||||
"id": "396b648e",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"### Basic Python\n",
|
||||
@@ -277,7 +277,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"id": "4d4cb587",
|
||||
"id": "d1266795",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -294,7 +294,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "adbf5dfb",
|
||||
"id": "04e0ae48",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Next we define functions, for ease of use later, to generate Gaussians and to\n",
|
||||
@@ -304,7 +304,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"id": "432afa10",
|
||||
"id": "c54add58",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -377,7 +377,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "5da6553d",
|
||||
"id": "359f17b2",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now that we are our, albeit very simple, dataset we are ready to start\n",
|
||||
@@ -387,7 +387,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 3,
|
||||
"id": "50fdce3a",
|
||||
"id": "07b9b0f8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -428,7 +428,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "4a192c1a",
|
||||
"id": "a4f06c0d",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Let's plot and see"
|
||||
@@ -437,7 +437,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 4,
|
||||
"id": "e3bd3ed5",
|
||||
"id": "75654aaf",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -474,7 +474,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "ca5cdbba",
|
||||
"id": "b600aeb7",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"So what do we have so far? We have 'picked' $k$ centroids at random from our\n",
|
||||
@@ -492,7 +492,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"id": "683d9e56",
|
||||
"id": "44faac12",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -500,7 +500,7 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Converged at iteration 5\n",
|
||||
"Runtime: 0.23237395286560059 seconds\n"
|
||||
"Runtime: 0.23453593254089355 seconds\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -557,7 +557,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "77d7b6c9",
|
||||
"id": "e9ad9ec8",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"And thats it! We now have an extremely barebones, un-optimized k-means\n",
|
||||
@@ -567,7 +567,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 6,
|
||||
"id": "de21744c",
|
||||
"id": "8d3e29d6",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -604,7 +604,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "1d3be7e4",
|
||||
"id": "adf41666",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Now there are a few glaring improvements to be done here. First of all is\n",
|
||||
@@ -617,7 +617,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "4d4b64fd",
|
||||
"id": "0bc703d2",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"## Towards a More Numpythonic Code"
|
||||
@@ -626,7 +626,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 7,
|
||||
"id": "4249aa95",
|
||||
"id": "667d9000",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -634,7 +634,7 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Converged at iteration: 5\n",
|
||||
"Runtime: 0.19273090362548828 seconds\n"
|
||||
"Runtime: 0.19642972946166992 seconds\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -748,7 +748,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "fdbad890",
|
||||
"id": "ab038b5c",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"**Note**: the start of the timing is after the random initialization, and first\n",
|
||||
@@ -769,7 +769,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"id": "0ffe5738",
|
||||
"id": "b610c6ef",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -777,7 +777,7 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Converged at iteration: 11\n",
|
||||
"Runtime: 0.386091947555542 seconds\n",
|
||||
"Runtime: 0.39145517349243164 seconds\n",
|
||||
" "
|
||||
]
|
||||
}
|
||||
@@ -789,7 +789,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "649e0d75",
|
||||
"id": "c3581c3a",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Here we can see the reason for profiling. We now know for certain a lot can be\n",
|
||||
@@ -801,7 +801,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"id": "f5b94362",
|
||||
"id": "56cc3361",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
@@ -892,7 +892,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"id": "65816e1e",
|
||||
"id": "0214a338",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"When working towards becoming a data scientist using Python this last step is\n",
|
||||
@@ -905,7 +905,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"id": "dab77d43",
|
||||
"id": "1d86e363",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
@@ -913,7 +913,7 @@
|
||||
"output_type": "stream",
|
||||
"text": [
|
||||
"Converged at iteration: 5\n",
|
||||
"Runtime: 0.002377033233642578 seconds\n"
|
||||
"Runtime: 0.0024149417877197266 seconds\n"
|
||||
]
|
||||
}
|
||||
],
|
||||
@@ -924,7 +924,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "6ac85377",
|
||||
"id": "5846cfe7",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
|
||||
@@ -175,6 +175,7 @@ For the reading assignments we use the following abbreviations:
|
||||
- Lecture Thursday: Support Vector Machines
|
||||
- Video of Lecture at https://www.uio.no/studier/emner/matnat/fys/FYS-STK4155/h21/forelesningsvideoer/LectureNovember25.mp4?vrtx=view-as-webpage
|
||||
- Lecture Friday: Support Vector Machines and Summary of course
|
||||
- Video of Lecture at https://www.uio.no/studier/emner/matnat/fys/FYS-STK3155/h21/forelesningsvideoer/LectureNovember26.mp4?vrtx=view-as-webpage
|
||||
- Reading recommendations:
|
||||
- See lecture notes for week 47 at https://compphysics.github.io/MachineLearning/doc/web/course.html.
|
||||
- Geron's chapter 5.
|
||||
|
||||
Reference in New Issue
Block a user