Python Artificial Intelligence Projects for Beginners



Download 16,12 Mb.
Pdf ko'rish
bet43/65
Sana02.01.2022
Hajmi16,12 Mb.
#311589
1   ...   39   40   41   42   43   44   45   46   ...   65
Bog'liq
Python Artificial Intelligence Projects for Beginners - Get up and running with 8 smart and exciting AI applications by Joshua Eckroth (z-lib.org)

please
 and
plz
, they're not regarded as similar for the bag of words model. Word2Vec can figure out
that some words are similar to each other and we can exploit that fact to get better
performance when doing machine learning with text.


Applications for Comment Classification
Chapter 3
[ 64 ]
In Word2Vec, each word itself is a vector, with perhaps 300 dimensions. For example, in a
pre-trained Google Word2Vec model that examined millions or billions of pages of text, we
can see that cat, dog, and spatula are 300-dimensional vectors:
Cat = <0.012, 0.204, ..., -0.275, 0.056> (300 dimensions)
Dog = <0.051, -0.022, ..., -0.355, 0.227>
Spatula = <-0.191, -0.043, ..., -0.348, 0.398>
Similarity (distance) between cat and dog
c
0.761
Similarity between cat and spatula
c
0.124
If we compare the similarity of the dog and cat vectors, we will get 0.761 or 76% of
similarity. If we do the same with cat and spatula, we get 0.124. It's clear that Word2Vec
learned that dog and cat are similar words but cat and spatula are not. Word2Vec uses
neural networks to learn these word vectors. At a high level, a neural network is similar to
random forest or a decision tree and other machine learning techniques because they're
given a bunch of inputs and a bunch of outputs, and they learn how to predict the outputs
from the inputs.
For Word2Vec, the input is a single word, the word whose vector we want to learn, and the
output is its nearby words from the text. Word2Vec also supports the reverse of this input-
output configuration. Thus, Word2Vec learns the word vectors by remembering its context
words. So, dog and cat will have similar word vectors because these two words are used in
similar ways, like 
she pet the dog
 and 
she pet the cat
. Neural networking with Word2Vec can
take one of two forms because Word2Vec supports two different techniques for training.
The first technique is known as continuous bag of words, where the context words are the
input, leaving out the middle word and the word whose vector we're learning, the middle
word, is the output. In the following diagram, you can see three words before and after the
word 
channel
:


Applications for Comment Classification
Chapter 3
[ 65 ]
Those are the context words. The continuous bag of words model slides over the whole
sentence with every word acting as a center word in turn. The neural network learns the
300-dimensional vectors for each word so that the vector can predict the center word given
the context words. In other words, it can predict the output given its inputs.
In the second technique, we're going to flip this. This is known as 

Download 16,12 Mb.

Do'stlaringiz bilan baham:
1   ...   39   40   41   42   43   44   45   46   ...   65




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish