π Sensitivity analysis is a method used to judge someone’s feelings relative to a particular thing or to make sense of their feelings. It is basically a text processing process that aims to identify the class that the given text wants to express emotionally. Emotion analysis is also the name given to Idea mining over the frequency of words such as word number, noun, adjective, adverb or verb while inferring ideas on the texts. (Word2vec, TF/ IDF) In frequency-based idea mining, primarily noun word groups are found, and these are classified according to their length, their requirements in use, and their positive negative polarity.

[gdlr_core_space height=”30px”] [gdlr_core_space height=”30px”]π It is possible to analyze emotions according to the content of any document, document or text. This is actually called Text Mining. Through text mining, the class that the given text wants to express emotionally is determined. The text given by emotional polarity in emotion analysis is simplified and classified as positive and negative.

[gdlr_core_space height=”30px”]π The type of classifier in which the classification will be made is the Bayesian classifier based on the probability-based Naive Bayes Theorem, which can achieve very successful results in machine learning. So what is this **Naive Bayes** Theorem? The Bayesian theorem is an important subject studied within probability theory. This theorem shows the relationship between conditional probabilities and marginal probabilities in a probability distribution for a random variable. Naive Bayes is a family of probabilistic algorithms that make use of probability theory and the Bayes Theorem to estimate the class *(category or label)* of a text. This classifier, working on the basis of the Naive Bayes Theorem, calculates the probability of each state for a word or component it examines. This is the most common type of probability distribution.

π Let’s try to get a better understanding of the classifier on a sample. As I said before, the Naive Bayes Classifier can categorize different documents. For example, the BOW (bag-of-words) method categorizes the meaning of words according to their frequency by categories such as science, politics, or sport. In emotion analysis, it classifies any document, text or product in its possession as positive or negative.

[gdlr_core_space height=”30px”]Sentiment Classification Example

β¬οΈ The sentences given above are classified as **positive **or **negative **by the Bayesian classifier. For example, in the sentenceβ I like him very much’, each probability value is calculated and classified, and the class is selected as **positive** because the positive value outweighs it.

**Inference Of Text Properties**

Unfortunately, it is impossible for machines like us to understand raw text. However, in order to detect images and sounds, such as raw text, they need to be converted into numerical data.

[gdlr_core_space height=”30px”] [gdlr_core_space height=”30px”]π§· Therefore, we need to represent the data as a number so that we can extract the properties of the text we work with and calculate on these properties.

[gdlr_core_space height=”30px”] *Word Frequencies Table *

π§· For the values to be calculated according to Bayes Theorem, the probability of words belonging to a particular class and then the probability of the class given to the words will be calculated by using the following formula:

[gdlr_core_space height=”30px”] [gdlr_core_space height=”30px”]π§· This formula gives us the concept of conditional probability and **reads as the probability that event A occurs when event B occurs.** In this way, text mining can be performed using Naive Bayes to analyze data in any document. Let’s examine the following example.

π(+|πΌ πππ£π π‘βππ πππππ’ππ‘) = (π (πΌ πππ£π π‘βππ πππππ’ππ‘ | +).π(+))/(π(πΌ πππ£π π‘βππ πππππ’ππ‘)) = π (πΌ πππ£π π‘βππ πππππ’ππ‘ | +).π(+)

π(β|πΌ πππ£π π‘βππ πππππ’ππ‘) = (π (πΌ πππ£π π‘βππ πππππ’ππ‘ | β).π(β))/(π(πΌ πππ£π π‘βππ πππππ’ππ‘)) = π (πΌ πππ£π π‘βππ πππππ’ππ‘ | β).π(β)

[gdlr_core_space height=”30px”]In order to calculate the probabilities in the formula above, the probability value of each case must be known first. For this reason, the probability of π (πΌ πππ£π π‘βππ πππππ’ππ‘) + and β should be analyzed first.

[gdlr_core_space height=”30px”]π (πΌ πππ£π π‘βππ πππππ’ππ‘ | +) = π (πΌ | +). π (πππ£π | +). π (π‘βππ | +). π (πππππ’ππ‘ | +)

π (πΌ πππ£π π‘βππ πππππ’ππ‘ | β) = π (πΌ | β). π (πππ£π | β). π (π‘βππ | β). π (πππππ’ππ‘ | β)

[gdlr_core_space height=”30px”]As we can see in this example, when the bayessian formula is written instead of the probability values, the text is inferred according to which value is greater in the results. For example, when all calculations are finished, the results are as follows.

π(+|πΌ πππ£π π‘βππ πππππ’ππ‘) =* P(+).P(this|+).P(product|+).P(I|+).P(love|+) = (0.6 x 0.1053 x 0.1579 x 0.1053 x 0.1053) = 0.000110616 = 1.1 x 10-4*

π(β|πΌ πππ£π π‘βππ πππππ’ππ‘) =* P(-).P(this|-).P(product|-).P(I|-).P(love|-) = (0.4 x 0.0667 x0.1333 x 0.1333 x 0.0667) = 0.00003162 = 3.1 x 10-5*

When we look at the values, we see that the positive condition of I love this product is higher. For this reason, it can be said that the sentence is a positive sentence π

[gdlr_core_space height=”30px”]π(+|πΌ πππ£π π‘βππ πππππ’ππ‘) > π(β|πΌ πππ£π π‘βππ πππππ’ππ‘)

Hope to see you in another article. Have a nice day π€

[gdlr_core_space height=”60px”]**REFERENCES**

- Sadi Evren SEKER, Sentimental Analysis, Smith College, Department of Computer Science, MA, US.
- Buse Yaren Tekin, Sentiment analysis by logistic regression is taken from Medium.
- Retrieved from http://textdecipher.com/category/duygu-analizi/.
- Onur
DayΔ±basΔ±,
*What is Bag of Words*is taken from Medium.

From Wikipedia, Retrived fromhttps://tr.wikipedia.org/wiki/Bayes_teoremi