Posts

Word 2 vec

Image
 In the word 2 vec, we have two types CBOW and Skip-gram      In Cbow we try to predict the target word by using neighbor context words. In Skip Gram, we try to predict context words from the target. Cbow working: Word 2 vec is trained on Wikipedia data but to demonstrate the working on Cbow, lets take simple sentence - "Hope can set you free". let's consider a window size of 3. So here input will be "hope" and "set", and the output is "can". since this is cbow, here we try to predict the target word by using context words. so here in this sentence, we will try to predict the word "can" by using context words "hope" and "set". in the input, we pass the one-hot encoding of words "hope" and "set" and by using a neural network, we will try to predict the target word "can". here in between the input and hidden layer, we have a 3X5 matrix as weight. here our neural network updates weights...

Sentiment analysis

Tools for sentiment analysis:  Textblob:  textblob is the python library for processing text data. PatternAnalyzer and NaiveBayesAnalyzer. Pattern analyzer is the default. Naive bayes gives name with tuple (p_pos, p_neg) where p_pos is the probability of pos emotion and p_neg is the probability of negative emotions Vader: it is rule based sentiment analysis and suitable for predicting sentiments on social media. it uses dictionary that maps lexical features (word frequency, word neighborhood count, word association) to intensity of emotions known as sentiment scores. we can use it using NLTK library. it returns positive, neg, neutral, and compounds which represent emotional intensity.