Afrikaans
Akan
Albanian
Amharic
Arabic
Armenian
Azerbaijani
Basque
Belarusian
Bemba
Bengali
Bihari
Bosnian
Breton
Bulgarian
Cambodian
Catalan
Cebuano
Cherokee
Chichewa
Chinese (Simplified)
Chinese (Traditional)
Corsican
Croatian
Czech
Danish
Dutch
English
Esperanto
Estonian
Ewe
Faroese
Filipino
Finnish
French
Frisian
Ga
Galician
Georgian
German
Greek
Guarani
Gujarati
Haitian Creole
Hausa
Hawaiian
Hebrew
Hindi
Hmong
Hungarian
Icelandic
Igbo
Indonesian
Interlingua
Irish
Italian
Japanese
Javanese
Kannada
Kazakh
Kinyarwanda
Kirundi
Kongo
Korean
Krio (Sierra Leone)
Kurdish
Kurdish (Soranî)
Kyrgyz
Laothian
Latin
Latvian
Lingala
Lithuanian
Lozi
Luganda
Luo
Luxembourgish
Macedonian
Malagasy
Malay
Malayalam
Maltese
Maori
Marathi
Mauritian Creole
Moldavian
Mongolian
Myanmar (Burmese)
Montenegrin
Nepali
Nigerian Pidgin
Northern Sotho
Norwegian
Norwegian (Nynorsk)
Occitan
Oriya
Oromo
Pashto
Polish
Portuguese (Brazil)
Portuguese (Portugal)
Punjabi
Quechua
Romanian
Romansh
Runyakitara
Russian
Samoan
Scots Gaelic
Serbian
Serbo-Croatian
Sesotho
Setswana
Seychellois Creole
Shona
Sindhi
Sinhalese
Slovak
Slovenian
Somali
Spanish
Spanish (Latin American)
Sundanese
Swahili
Swedish
Tajik
Tamil
Tatar
Telugu
Thai
Tigrinya
Tonga
Tshiluba
Tumbuka
Turkish
Turkmen
Twi
Uighur
Ukrainian
Urdu
Uzbek
Vietnamese
Welsh
Wolof
Xhosa
Yiddish
Yoruba
Zulu
Instructor: Hey again.
We finished the last lecture with this graph.
It shows 1000 points and their centroid.
In cluster analysis,
that's how a cluster would look in two-dimensional space.
There are two dimensions or two features
based on which we are performing clustering.
For instance, the age and money spent
from our earlier example.
Certainly it makes no sense to have only one cluster,
so let me zoom out of this graph.
Here's a nice picture of clusters.
We can clearly see two clusters.
I'll also indicate their centroids.
If we want to identify three clusters,
this is the result we obtain,
and that's more or less how clustering works graphically.
Okay, how do we perform clustering in practice?
There are different methods we can apply
to identify clusters.
The most popular one is K-means,
so that's where we will start.
Let's simplify this scatter to 15 points,
so we can get a better grasp of what happens.
Cool.
Here's how K-means works.
First, we must choose how many clusters we'd like to have.
That's where this method gets its name from.
K stands for the number of clusters
we are trying to identify.
I'll start with two clusters.
The next step is to specify the cluster seeds.
A seed is basically a starting centroid.
It is chosen at random or is specified by the data scientist
based on prior knowledge about the data.
One of the clusters will be the green cluster.
The other one, the orange cluster, and these are the seeds.
The following step
is to assign each point on the graph to a seed,
which is done based on proximity.
For instance, this point is closer to the green seed
than to the orange one.
Therefore, it will belong to the green cluster.
This point, on the other hand, is closer to the orange seed.
Therefore, it will be a part of the orange cluster.
In this way, we can color all points on the graph
based on their Euclidean distance from the seeds.
Great.
The final step is to calculate the centroid
of the green points and the orange points.
The green seed will move closer to the green points
to become their centroid,
and the orange will do the same for the orange points.
From here, we would repeat the last two steps.
Let's recalculate the distances.
All the green points
are obviously closer to the green centroid,
and the orange points are closer to the orange centroid.
What about these two?
Both of them are closer to the green centroid,
so at this step, we will reassign them to the green cluster.
Finally, we must recalculate the centroids.
That's the new result.
Now, all the green points are closest to the green centroid
and all the orange ones to the orange.
We can no longer reassign points,
which completes the clustering process.
This is the two-cluster solution.
All right, so that's the whole idea behind clustering.
In order to solidify your understanding,
we will redo the process.
In the beginning, we said that with K-means clustering,
we must specify the number of clusters
prior to clustering, right?
What if we wanna obtain three clusters?
The first step involves selecting the seeds.
Let's have another seed.
We'll use red for this one.
Next, we must associate each of the points
with the closest seed.
Finally, we calculate the centroids of the colored points.
We already know that K-means is an iterative process,
so we go back to the step
where we associate each of the points with the closest seed.
All orange points are settled, so no movement there.
What about these two points?
Now they're closer to the red seed,
so they will go into the red cluster.
That's the only change in the whole graph.
In the end, we recalculate the centroids
and reach a situation
where no more adjustments are necessary
using the K-means algorithm.
We have reached a three-cluster solution.
This is the exact algorithm
which was used to find the solution
of the problem you saw at the beginning of the lesson.
Here's a Python-generated graph
with the three clusters colored.
I'm sorry they're not the same, but you get the point.
That's how we would usually
represent the clusters graphically.
Great.
I think we have a good basis to start coding.
See you in the next lecture.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.