You are on page 1of 17

MACHINE

LEARNING

WORD EMBEDDINGS-2

1 Hammad Afzal
Department of CSE
hammad.afzal@mcs.edu.pk
2
CNN
 A multilayered neural network with a special architecture de
signed to extract increasingly complex features of the data a
t each layer to determine the output

 Has one or more convolutional layers and are used mainly


for image processing, classification, segmentation and also
for other auto-correlated data

Artificial Intelligence - Online Workshop 3


1D VS. 2D CONVOLUTIONS

4
CONVOLUTIONS IN TEXT

5
CONVOLUTIONS IN TEXT

6
CONVOLUTIONS IN TEXT

7
CONVOLUTIONS IN TEXT

8
CONVOLUTIONS IN TEXT

Artificial Intelligence - Online Workshop 9


CONVOLUTIONS IN TEXT

Artificial Intelligence - Online Workshop 10


CONVOLUTIONS IN TEXT

Artificial Intelligence - Online Workshop 11


CONVOLUTIONS IN TEXT
A sliding window function applied to an input matrix. 

Word Vectors

¿
I 0.1 -0.7 0.5 1 0 0
Like

This
0.2

-0.1
-0.5

0.3
0.4

0.7
× 1 1 0
-
0.2
Weight Matrix
Feature Map
Movie 0.5 0.6 -0.1

Input Sentence Matrix

0.1*1 + -0.7*0 + 0.5*0 + 0.2*1 + -0.5*1 + 0.4*0 = -0.2

12
CONVOLUTIONS IN TEXT

Word Vectors

¿
I 0.1 -0.7 0.5 1 0 0
Like

This
0.2

-0.1
-0.5

0.3
0.4

0.7
× 1 1 0
0.2
0.4
Weight Matrix
Movie 0.5 0.6 -0.1 Feature Map

Input Sentence Matrix

0.2*1 + -0.5*0 + 0.4*0 + -0.1*1 + 0.3*1 + 0.7*0 = 0.4


CNN ON TEXTUAL DATA

Word Vectors

¿
I 0.1 -0.7 0.5 1 0 0
Like

This
0.2

-0.1
-0.5

0.3
0.4

0.7
× 1 1 0
-
0.2
Weight Matrix
0.4
Movie 0.5 0.6 -0.1
1

Input Sentence Matrix Feature Map

-0.1*1 + 0.3*0 + 0.7*0 + 0.5*1 + 0.6*1 + -0.1*0 = 1


CONVOLUTIONS IN TEXT

Pooling
• Pooling layer subsamples the input.
• Applies a max operation to the result of each filter.
• Reduces the output dimensionality but (hopefully) keeps
the most salient information.

0.2
1 max pooling
0.4
1
1
CONVOLUTIONS IN TEXT
ACKNOWLEDGEMENTS
 Prof Dr. Imran Siddiqi (Bahria University)
 Machine Intelligence, Dr M. Hanif, UET, Lahore

17

You might also like