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, let's continue the problem
from the last lecture.
As you can see, we had one other piece of information
that we did not use, language.
In order to make use of it,
we must first encode it in some way.
The simplest way to do that is by using numbers.
I'll create a new variable called data_mapped
equal to data.copy.
Next, I'll map the languages using the usual method.
Data_mapped language equals data_mapped language.map.
And I'll set English to zero,
French to one, and German to two.
Note that this is not the optimal way to encode them
but it will work for now.
Here's the result, cool.
Next, let's choose the features
that we want to use for clustering.
Did you know that we can use a single feature?
Well, we certainly can.
Let x be equal to data_mapped.iloc:,3:4.
I am basically slicing all rows, but only the last column.
What we are left with is this.
Now we can perform clustering.
I have the same code ready, so I'll just use it.
We are running k means clustering
with three clusters.
Run, run, run, run and we are done.
The plot is unequivocal.
The three clusters are USA, Canada, UK and Australia
in the first one, France in the second
and Germany in the third.
That's precisely what we expected, right?
English, French and German.
Great.
By the way, we are still using the longitude
and latitude as axis of the plot.
Unlike regression, when doing clustering
you can plot the data as you wish.
The cluster information is contained
in the cluster column in the data frame
and is the color of the points on the plot.
Can we use both numerical
and categorical data in clustering?
Sure, Let's go back to our input data, x,
and take the last three series instead of just one.
Run, run, run, run.
Okay, this time the three clusters turned out
to be based simply on geographical location
instead of language and location.
Hmm, what if we use two clusters?
We've seen that solution too, haven't we?
We will have to work on figuring out
what's going on in the following lesson.
Thanks for watching.
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.