SlideShare una empresa de Scribd logo
1 de 15
WORD EMBEDDINGS
Presented By:
Shruti kar
“You shall know the word by the company it keeps.”
- John Rupert Firth
• Machine Learning algorithms are incapable of processing strings.
• They require numbers as inputs.
• Huge amount of text data to be converted.
• A Word Embedding format generally tries to map a word using a dictionary to a vector.
sentence= “Word Embeddings are Word converted into numbers ”
• Words: “Embeddings” or “numbers ” etc.
• Dictionary: List of all unique words in the sentence.
[‘Word’,’Embeddings’,’are’,’Converted’,’into’,’numbers’]
• A vector representation of a word may be a one-hot encoded vector where 1 stands for the position where the word
exists and 0 everywhere else.
“numbers” - [0,0,0,0,0,1]
“converted” - [0,0,0,1,0,0].
Why do we need WORD EMBEDDINGS?
CONTEXT CLUES- meaning of unknown word by the words that surround it in some CONTEXT.
CONTEXT may be : “WINDOW “surrounding words.
“SENTENCE” it occurs in.
“PARAGRAPH” that contains it.
“ENTIRE DOCUMENT”.
BIGGER GOAL: How to generalize the knowledge obtained from one particular word to other words that are somehow
similar?
• Semantic space -> latent semantic space.
• Map individual words in latent semantic space.
• Obtain vector representation for each word.
• Dimension -> vocabulary of words.
• Semantically similar words are closer in vector space.  “WORD EMBEDDING”
WORD EMBEDDING: Embed the words into some vector space.
WORD EMBEDDINGS DEFINITION
1. Frequency based Embedding
• Count Vectors
• TF-IDF
• Co-Occurrence
• Matrix Factorization
• Co-occurrence probability ratio
WORD EMBEDDINGS TYPES:
Count vector representation:
TF = (Number of times term t appears in a
document)/(Number of terms in the document)
IDF = log(N/n), where, N is the number of
documents and n is the number of documents a
term t has appeared in.
TF(This,Document1) = 1/8
TF(This, Document2)=1/5
IDF(This) = log(2/2) = 0
IDF(Messi) = log(2/1) = 0.301.
TF-IDF(This,Document1) = (1/8) * (0) = 0
TF-IDF(This, Document2) = (1/5) * (0) = 0
TF-IDF(Messi, Document1) = (4/8)*0.301 = 0.15
https://www.analyticsvidhya.com/blog/2017/06/word-embeddings-count-word2veec/
Matrix Factorization of Word Embeddings (co-
occurrence matrix)
Similar words tend to occur together and will have similar context for example – Apple is a fruit. Mango is a fruit.
Apple and mango tend to have a similar context i.e. fruit.
Co-occurrence – For a given corpus, the co-occurrence of a pair of words say w1 and w2 is the number of times they have
appeared together in a Context Window.
Context Window – Context window is specified by a number and the direction.
Corpus =“The quick brown fox jumps over the lazy dog.”
Corpus = “He is not lazy. He is intelligent. He is smart”.
https://www.analyticsvidhya.com/blog/2017/06/word-embeddings-count-word2veec/
PMI = Pointwise Mutual Information.
Matrix Factorization of Word Embeddings (co-
occurrence matrix)
Larger PMI  Higher correlation
ISSUES: Many entries with PMI (w,c) = log 0
SOLUTION:
• Set PMI(w,c) = 0 for all unobserved pairs.
• Drop all entries of PMI< 0 [POSITIVE POINTWISE MUTUAL INFORMATION]
Where, w= word, c= context word
Produces 2 different vectors for each word:
• Describes word when it is the ‘target word’ in the window
• Describes word when it is the ‘context word’ in window
Glove captures relationship between two words by CO-OCCURRENCE PROBABILITY RATIO:
Co-occurrence Probability Ratio:
P( k | i )  probability of observing ‘k’ word in ‘i’ word context.
Example, P (solid | ice) / P ( solid | steam) = large
P (gas | ice) / P ( gas | steam) = less
Produces 2 different vectors for each word:
• wi  target word of word i
• ῶ i  context word of word i
Learns the function:
After addition of bias terms, Weighting for rare and frequent occurrences:
Final Loss:
Prediction based Embedding:
2. Prediction based Embedding
• CBOW
• Skip-Gram
CBOW and Skip-Gram model for neural network differs in the terms of input and output of the neural network.
• CBOW: Input to neural network is set of context words within a certain window surrounding a ‘target’ word. And
output predicts the ‘target’ word i.e., what word should belong to the target position.
• Skip-Gram: Input is similar to a CBOW model. Output predicts each ‘context’ based on the ‘target’ word appearing
at the center of the window.
Both the times we learn wi and context vector ῶ i for each word in the vocabulary.
Prediction based Embedding:
Architecture of neural network:
https://blog.acolyer.org/2016/04/21/the-amazing-power-of-word-vectors/
Prediction based Embedding:
• Goal is to supply training samples and learn the weights.
• Use the weights to predict probabilities for new input word.
The network is going to tell us the probability for every word in our vocabulary of being the context (window) that we
choose.
Example: “Soviet”-“Union” vs “Soviet”-“Russia” vs “Soviet”-“Kangaroo”
Corpus =“The quick brown fox jumps over the lazy dog.” Context window = 2
http://mccormickml.com/2016/04/19/word2vec-tutorial-the-skip-gram-model/
Prediction based Embedding:
Architecture of neural network:
http://mccormickml.com/2016/04/19/word2vec-tutorial-the-skip-gram-model/
Prediction based Embedding:
Output:
Issue: Expensive to compute the normalizing constant for softmax output layer which involves a sum of entire
vocabulary.
Mikolov introduced  NEGATIVE SAMPLING – related to skip-gram model.
• Treating common word pairs or phrases as single “words” in their model.
Example: “Boston” “Globe” vs “Boston Globe”
• Subsampling frequent words to decrease the number of training examples.
• Modifying the optimization objective with a technique they called “Negative Sampling”, which causes each
training sample to update only a small percentage of the model’s weights.
http://mccormickml.com/2016/04/19/word2vec-tutorial-the-skip-gram-model/
Document Representation from Word
Embeddings
• What can be the space representation for “documents” rather than “words”?
• Embed a document at the centroid of all word vectors by taking average.
• Take minimum value in each vector dimension.
• Take maximum value in each vector dimension.
• This works well for small documents eg. tweets.
• For longer documents, represent a document as a bag of word vectors.
 Word Mover’s Distance.
But still no proper representation of a document.  Le & Mikolov : “Paragraph vector”
• Paragraph vectors with distributed memory  modifies CBOW
• Paragraph vectors with distributed bag of words  modifies skip-gram.
Resources
• http://mccormickml.com/2016/04/19/word2vec-tutorial-the-skip-gram-model/
• https://www.analyticsvidhya.com/blog/2017/06/word-embeddings-count-word2veec/
• https://blog.acolyer.org/2016/04/21/the-amazing-power-of-word-vectors/
• https://mubaris.com/2017/12/14/word2vec/
Thank You

Más contenido relacionado

La actualidad más candente

Word2Vec: Vector presentation of words - Mohammad Mahdavi
Word2Vec: Vector presentation of words - Mohammad MahdaviWord2Vec: Vector presentation of words - Mohammad Mahdavi
Word2Vec: Vector presentation of words - Mohammad Mahdaviirpycon
 
Natural language processing and transformer models
Natural language processing and transformer modelsNatural language processing and transformer models
Natural language processing and transformer modelsDing Li
 
Introduction to Natural Language Processing
Introduction to Natural Language ProcessingIntroduction to Natural Language Processing
Introduction to Natural Language Processingrohitnayak
 
Natural language procssing
Natural language procssing Natural language procssing
Natural language procssing Rajnish Raj
 
Natural language processing
Natural language processing Natural language processing
Natural language processing Md.Sumon Sarder
 
Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)VenkateshMurugadas
 
Recurrent Neural Networks for Text Analysis
Recurrent Neural Networks for Text AnalysisRecurrent Neural Networks for Text Analysis
Recurrent Neural Networks for Text Analysisodsc
 
Fine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsFine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsOVHcloud
 
Word_Embedding.pptx
Word_Embedding.pptxWord_Embedding.pptx
Word_Embedding.pptxNameetDaga1
 
Natural language processing
Natural language processingNatural language processing
Natural language processingKarenVacca
 
Natural lanaguage processing
Natural lanaguage processingNatural lanaguage processing
Natural lanaguage processinggulshan kumar
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language ProcessingIla Group
 
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...Databricks
 
Document Summarization
Document SummarizationDocument Summarization
Document SummarizationPratik Kumar
 
Natural Language Processing (NLP) - Introduction
Natural Language Processing (NLP) - IntroductionNatural Language Processing (NLP) - Introduction
Natural Language Processing (NLP) - IntroductionAritra Mukherjee
 

La actualidad más candente (20)

Word embeddings
Word embeddingsWord embeddings
Word embeddings
 
Tutorial on word2vec
Tutorial on word2vecTutorial on word2vec
Tutorial on word2vec
 
Word2Vec: Vector presentation of words - Mohammad Mahdavi
Word2Vec: Vector presentation of words - Mohammad MahdaviWord2Vec: Vector presentation of words - Mohammad Mahdavi
Word2Vec: Vector presentation of words - Mohammad Mahdavi
 
Nlp ambiguity presentation
Nlp ambiguity presentationNlp ambiguity presentation
Nlp ambiguity presentation
 
Natural language processing and transformer models
Natural language processing and transformer modelsNatural language processing and transformer models
Natural language processing and transformer models
 
Introduction to Natural Language Processing
Introduction to Natural Language ProcessingIntroduction to Natural Language Processing
Introduction to Natural Language Processing
 
Natural language procssing
Natural language procssing Natural language procssing
Natural language procssing
 
Natural language processing
Natural language processing Natural language processing
Natural language processing
 
Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)Introduction to Natural Language Processing (NLP)
Introduction to Natural Language Processing (NLP)
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Recurrent Neural Networks for Text Analysis
Recurrent Neural Networks for Text AnalysisRecurrent Neural Networks for Text Analysis
Recurrent Neural Networks for Text Analysis
 
Fine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP modelsFine tune and deploy Hugging Face NLP models
Fine tune and deploy Hugging Face NLP models
 
Word_Embedding.pptx
Word_Embedding.pptxWord_Embedding.pptx
Word_Embedding.pptx
 
Natural language processing
Natural language processingNatural language processing
Natural language processing
 
Natural lanaguage processing
Natural lanaguage processingNatural lanaguage processing
Natural lanaguage processing
 
Natural Language Processing
Natural Language ProcessingNatural Language Processing
Natural Language Processing
 
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...
Building a Pipeline for State-of-the-Art Natural Language Processing Using Hu...
 
Document Summarization
Document SummarizationDocument Summarization
Document Summarization
 
Language models
Language modelsLanguage models
Language models
 
Natural Language Processing (NLP) - Introduction
Natural Language Processing (NLP) - IntroductionNatural Language Processing (NLP) - Introduction
Natural Language Processing (NLP) - Introduction
 

Similar a Word embeddings

MACHINE-DRIVEN TEXT ANALYSIS
MACHINE-DRIVEN TEXT ANALYSISMACHINE-DRIVEN TEXT ANALYSIS
MACHINE-DRIVEN TEXT ANALYSISMassimo Schenone
 
ورشة تضمين الكلمات في التعلم العميق Word embeddings workshop
ورشة تضمين الكلمات في التعلم العميق Word embeddings workshopورشة تضمين الكلمات في التعلم العميق Word embeddings workshop
ورشة تضمين الكلمات في التعلم العميق Word embeddings workshopiwan_rg
 
Vectorization In NLP.pptx
Vectorization In NLP.pptxVectorization In NLP.pptx
Vectorization In NLP.pptxChode Amarnath
 
Designing, Visualizing and Understanding Deep Neural Networks
Designing, Visualizing and Understanding Deep Neural NetworksDesigning, Visualizing and Understanding Deep Neural Networks
Designing, Visualizing and Understanding Deep Neural Networksconnectbeubax
 
Pycon ke word vectors
Pycon ke   word vectorsPycon ke   word vectors
Pycon ke word vectorsOsebe Sammi
 
A Panorama of Natural Language Processing
A Panorama of Natural Language ProcessingA Panorama of Natural Language Processing
A Panorama of Natural Language ProcessingTed Xiao
 
Introduction to Ontology Engineering with Fluent Editor 2014
Introduction to Ontology Engineering with Fluent Editor 2014Introduction to Ontology Engineering with Fluent Editor 2014
Introduction to Ontology Engineering with Fluent Editor 2014Cognitum
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory buildingClarkTony
 
Constructing dataset based_on_concept_hierarchy_for_evaluating_word_vectors_l...
Constructing dataset based_on_concept_hierarchy_for_evaluating_word_vectors_l...Constructing dataset based_on_concept_hierarchy_for_evaluating_word_vectors_l...
Constructing dataset based_on_concept_hierarchy_for_evaluating_word_vectors_l...禎晃 山崎
 
Word_Embeddings.pptx
Word_Embeddings.pptxWord_Embeddings.pptx
Word_Embeddings.pptxGowrySailaja
 
Moore_slides.ppt
Moore_slides.pptMoore_slides.ppt
Moore_slides.pptbutest
 
Atlanta MLconf Machine Learning Conference 09-23-2016
Atlanta MLconf Machine Learning Conference 09-23-2016Atlanta MLconf Machine Learning Conference 09-23-2016
Atlanta MLconf Machine Learning Conference 09-23-2016Chris Fregly
 
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016MLconf
 
L6.pptxsdv dfbdfjftj hgjythgfvfhjyggunghb fghtffn
L6.pptxsdv dfbdfjftj hgjythgfvfhjyggunghb fghtffnL6.pptxsdv dfbdfjftj hgjythgfvfhjyggunghb fghtffn
L6.pptxsdv dfbdfjftj hgjythgfvfhjyggunghb fghtffnRwanEnan
 
Deep learning Malaysia presentation 12/4/2017
Deep learning Malaysia presentation 12/4/2017Deep learning Malaysia presentation 12/4/2017
Deep learning Malaysia presentation 12/4/2017Brian Ho
 
Subword tokenizers
Subword tokenizersSubword tokenizers
Subword tokenizersHa Loc Do
 

Similar a Word embeddings (20)

MACHINE-DRIVEN TEXT ANALYSIS
MACHINE-DRIVEN TEXT ANALYSISMACHINE-DRIVEN TEXT ANALYSIS
MACHINE-DRIVEN TEXT ANALYSIS
 
ورشة تضمين الكلمات في التعلم العميق Word embeddings workshop
ورشة تضمين الكلمات في التعلم العميق Word embeddings workshopورشة تضمين الكلمات في التعلم العميق Word embeddings workshop
ورشة تضمين الكلمات في التعلم العميق Word embeddings workshop
 
Vectorization In NLP.pptx
Vectorization In NLP.pptxVectorization In NLP.pptx
Vectorization In NLP.pptx
 
wordembedding.pptx
wordembedding.pptxwordembedding.pptx
wordembedding.pptx
 
Designing, Visualizing and Understanding Deep Neural Networks
Designing, Visualizing and Understanding Deep Neural NetworksDesigning, Visualizing and Understanding Deep Neural Networks
Designing, Visualizing and Understanding Deep Neural Networks
 
Lecture1.pptx
Lecture1.pptxLecture1.pptx
Lecture1.pptx
 
Pycon ke word vectors
Pycon ke   word vectorsPycon ke   word vectors
Pycon ke word vectors
 
A-Study_TopicModeling
A-Study_TopicModelingA-Study_TopicModeling
A-Study_TopicModeling
 
A Panorama of Natural Language Processing
A Panorama of Natural Language ProcessingA Panorama of Natural Language Processing
A Panorama of Natural Language Processing
 
Text features
Text featuresText features
Text features
 
Introduction to Ontology Engineering with Fluent Editor 2014
Introduction to Ontology Engineering with Fluent Editor 2014Introduction to Ontology Engineering with Fluent Editor 2014
Introduction to Ontology Engineering with Fluent Editor 2014
 
Dsm as theory building
Dsm as theory buildingDsm as theory building
Dsm as theory building
 
Constructing dataset based_on_concept_hierarchy_for_evaluating_word_vectors_l...
Constructing dataset based_on_concept_hierarchy_for_evaluating_word_vectors_l...Constructing dataset based_on_concept_hierarchy_for_evaluating_word_vectors_l...
Constructing dataset based_on_concept_hierarchy_for_evaluating_word_vectors_l...
 
Word_Embeddings.pptx
Word_Embeddings.pptxWord_Embeddings.pptx
Word_Embeddings.pptx
 
Moore_slides.ppt
Moore_slides.pptMoore_slides.ppt
Moore_slides.ppt
 
Atlanta MLconf Machine Learning Conference 09-23-2016
Atlanta MLconf Machine Learning Conference 09-23-2016Atlanta MLconf Machine Learning Conference 09-23-2016
Atlanta MLconf Machine Learning Conference 09-23-2016
 
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016
Chris Fregly, Research Scientist, PipelineIO at MLconf ATL 2016
 
L6.pptxsdv dfbdfjftj hgjythgfvfhjyggunghb fghtffn
L6.pptxsdv dfbdfjftj hgjythgfvfhjyggunghb fghtffnL6.pptxsdv dfbdfjftj hgjythgfvfhjyggunghb fghtffn
L6.pptxsdv dfbdfjftj hgjythgfvfhjyggunghb fghtffn
 
Deep learning Malaysia presentation 12/4/2017
Deep learning Malaysia presentation 12/4/2017Deep learning Malaysia presentation 12/4/2017
Deep learning Malaysia presentation 12/4/2017
 
Subword tokenizers
Subword tokenizersSubword tokenizers
Subword tokenizers
 

Último

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdfKamal Acharya
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 

Último (20)

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
University management System project report..pdf
University management System project report..pdfUniversity management System project report..pdf
University management System project report..pdf
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 

Word embeddings

  • 1. WORD EMBEDDINGS Presented By: Shruti kar “You shall know the word by the company it keeps.” - John Rupert Firth
  • 2. • Machine Learning algorithms are incapable of processing strings. • They require numbers as inputs. • Huge amount of text data to be converted. • A Word Embedding format generally tries to map a word using a dictionary to a vector. sentence= “Word Embeddings are Word converted into numbers ” • Words: “Embeddings” or “numbers ” etc. • Dictionary: List of all unique words in the sentence. [‘Word’,’Embeddings’,’are’,’Converted’,’into’,’numbers’] • A vector representation of a word may be a one-hot encoded vector where 1 stands for the position where the word exists and 0 everywhere else. “numbers” - [0,0,0,0,0,1] “converted” - [0,0,0,1,0,0]. Why do we need WORD EMBEDDINGS?
  • 3. CONTEXT CLUES- meaning of unknown word by the words that surround it in some CONTEXT. CONTEXT may be : “WINDOW “surrounding words. “SENTENCE” it occurs in. “PARAGRAPH” that contains it. “ENTIRE DOCUMENT”. BIGGER GOAL: How to generalize the knowledge obtained from one particular word to other words that are somehow similar? • Semantic space -> latent semantic space. • Map individual words in latent semantic space. • Obtain vector representation for each word. • Dimension -> vocabulary of words. • Semantically similar words are closer in vector space.  “WORD EMBEDDING” WORD EMBEDDING: Embed the words into some vector space. WORD EMBEDDINGS DEFINITION
  • 4. 1. Frequency based Embedding • Count Vectors • TF-IDF • Co-Occurrence • Matrix Factorization • Co-occurrence probability ratio WORD EMBEDDINGS TYPES: Count vector representation: TF = (Number of times term t appears in a document)/(Number of terms in the document) IDF = log(N/n), where, N is the number of documents and n is the number of documents a term t has appeared in. TF(This,Document1) = 1/8 TF(This, Document2)=1/5 IDF(This) = log(2/2) = 0 IDF(Messi) = log(2/1) = 0.301. TF-IDF(This,Document1) = (1/8) * (0) = 0 TF-IDF(This, Document2) = (1/5) * (0) = 0 TF-IDF(Messi, Document1) = (4/8)*0.301 = 0.15 https://www.analyticsvidhya.com/blog/2017/06/word-embeddings-count-word2veec/
  • 5. Matrix Factorization of Word Embeddings (co- occurrence matrix) Similar words tend to occur together and will have similar context for example – Apple is a fruit. Mango is a fruit. Apple and mango tend to have a similar context i.e. fruit. Co-occurrence – For a given corpus, the co-occurrence of a pair of words say w1 and w2 is the number of times they have appeared together in a Context Window. Context Window – Context window is specified by a number and the direction. Corpus =“The quick brown fox jumps over the lazy dog.” Corpus = “He is not lazy. He is intelligent. He is smart”. https://www.analyticsvidhya.com/blog/2017/06/word-embeddings-count-word2veec/
  • 6. PMI = Pointwise Mutual Information. Matrix Factorization of Word Embeddings (co- occurrence matrix) Larger PMI  Higher correlation ISSUES: Many entries with PMI (w,c) = log 0 SOLUTION: • Set PMI(w,c) = 0 for all unobserved pairs. • Drop all entries of PMI< 0 [POSITIVE POINTWISE MUTUAL INFORMATION] Where, w= word, c= context word Produces 2 different vectors for each word: • Describes word when it is the ‘target word’ in the window • Describes word when it is the ‘context word’ in window
  • 7. Glove captures relationship between two words by CO-OCCURRENCE PROBABILITY RATIO: Co-occurrence Probability Ratio: P( k | i )  probability of observing ‘k’ word in ‘i’ word context. Example, P (solid | ice) / P ( solid | steam) = large P (gas | ice) / P ( gas | steam) = less Produces 2 different vectors for each word: • wi  target word of word i • ῶ i  context word of word i Learns the function: After addition of bias terms, Weighting for rare and frequent occurrences: Final Loss:
  • 8. Prediction based Embedding: 2. Prediction based Embedding • CBOW • Skip-Gram CBOW and Skip-Gram model for neural network differs in the terms of input and output of the neural network. • CBOW: Input to neural network is set of context words within a certain window surrounding a ‘target’ word. And output predicts the ‘target’ word i.e., what word should belong to the target position. • Skip-Gram: Input is similar to a CBOW model. Output predicts each ‘context’ based on the ‘target’ word appearing at the center of the window. Both the times we learn wi and context vector ῶ i for each word in the vocabulary.
  • 9. Prediction based Embedding: Architecture of neural network: https://blog.acolyer.org/2016/04/21/the-amazing-power-of-word-vectors/
  • 10. Prediction based Embedding: • Goal is to supply training samples and learn the weights. • Use the weights to predict probabilities for new input word. The network is going to tell us the probability for every word in our vocabulary of being the context (window) that we choose. Example: “Soviet”-“Union” vs “Soviet”-“Russia” vs “Soviet”-“Kangaroo” Corpus =“The quick brown fox jumps over the lazy dog.” Context window = 2 http://mccormickml.com/2016/04/19/word2vec-tutorial-the-skip-gram-model/
  • 11. Prediction based Embedding: Architecture of neural network: http://mccormickml.com/2016/04/19/word2vec-tutorial-the-skip-gram-model/
  • 12. Prediction based Embedding: Output: Issue: Expensive to compute the normalizing constant for softmax output layer which involves a sum of entire vocabulary. Mikolov introduced  NEGATIVE SAMPLING – related to skip-gram model. • Treating common word pairs or phrases as single “words” in their model. Example: “Boston” “Globe” vs “Boston Globe” • Subsampling frequent words to decrease the number of training examples. • Modifying the optimization objective with a technique they called “Negative Sampling”, which causes each training sample to update only a small percentage of the model’s weights. http://mccormickml.com/2016/04/19/word2vec-tutorial-the-skip-gram-model/
  • 13. Document Representation from Word Embeddings • What can be the space representation for “documents” rather than “words”? • Embed a document at the centroid of all word vectors by taking average. • Take minimum value in each vector dimension. • Take maximum value in each vector dimension. • This works well for small documents eg. tweets. • For longer documents, represent a document as a bag of word vectors.  Word Mover’s Distance. But still no proper representation of a document.  Le & Mikolov : “Paragraph vector” • Paragraph vectors with distributed memory  modifies CBOW • Paragraph vectors with distributed bag of words  modifies skip-gram.
  • 14. Resources • http://mccormickml.com/2016/04/19/word2vec-tutorial-the-skip-gram-model/ • https://www.analyticsvidhya.com/blog/2017/06/word-embeddings-count-word2veec/ • https://blog.acolyer.org/2016/04/21/the-amazing-power-of-word-vectors/ • https://mubaris.com/2017/12/14/word2vec/