{"id":179060,"date":"2024-04-10T18:41:46","date_gmt":"2024-04-10T17:41:46","guid":{"rendered":"https:\/\/liora.io\/en\/?p=179060"},"modified":"2026-02-06T08:10:54","modified_gmt":"2026-02-06T07:10:54","slug":"sentiment-analysis-harnessing-the-power-of-machine-learning","status":"publish","type":"post","link":"https:\/\/liora.io\/en\/sentiment-analysis-harnessing-the-power-of-machine-learning","title":{"rendered":"Sentiment Analysis: Harnessing the Power of Machine Learning"},"content":{"rendered":"<p><strong>Sentiment analysis is a technique that has developed strongly in tandem with social networking, where users can express themselves on a massive scale and constantly share their feelings. Sentiment analysis aims to determine the emotional tone of a speech by classifying it in different categories, such as positive, negative or neutral.<\/strong><\/p><p>It is popular with a wide range of players, from politicians in the middle of an election campaign to companies ready to<strong> launch a new product, to name but a few.<\/strong><\/p><p>The politician will want to test his popularity rating with the electorate, while the company will want to assess how well its product is received by the public.<\/p>\t\t\n\t\t\t<style>\n.elementor-widget-image{text-align:center}.elementor-widget-image a{display:inline-block}.elementor-widget-image a img[src$=\".svg\"]{width:48px}.elementor-widget-image img{vertical-align:middle;display:inline-block}<\/style>\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"400\" height=\"200\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2020\/09\/data_geniale_Plan-de-travail-1.png\" alt=\"sentiments Liora\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2020\/09\/data_geniale_Plan-de-travail-1.png 400w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2020\/09\/data_geniale_Plan-de-travail-1-300x150.png 300w\" sizes=\"(max-width: 400px) 100vw, 400px\">\t\t\t\t\t\t\t\t\t\t\t<figcaption>fig: example of a sentence to be analysed<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Discover our courses<\/a><\/div><\/div>\n\n\t\t<h2>But what does Sentiment Analysis actually involve and how do Data Scientists use Machine Learning techniques to decipher the emotional tone of a speech?<\/h2><p><strong>Sentiment analysis<\/strong> is used when communicating, whether in writing or verbally. Data Scientists can use audio or text data. It is the format of the data that determines the <a href=\"https:\/\/liora.io\/en\/machine-learning-engineer-bootcamp-why-is-it-interesting\">Machine Learning technique to be used.<\/a><\/p>\t\t\n\t\t\t<style>\n.elementor-heading-title{padding:0;margin:0;line-height:1}.elementor-widget-heading .elementor-heading-title[class*=elementor-size-]>a{color:inherit;font-size:inherit;line-height:inherit}.elementor-widget-heading .elementor-heading-title.elementor-size-small{font-size:15px}.elementor-widget-heading .elementor-heading-title.elementor-size-medium{font-size:19px}.elementor-widget-heading .elementor-heading-title.elementor-size-large{font-size:29px}.elementor-widget-heading .elementor-heading-title.elementor-size-xl{font-size:39px}.elementor-widget-heading .elementor-heading-title.elementor-size-xxl{font-size:59px}<\/style><h3>How do you analyse a spoken sentence?<\/h3>\t\t\n\t\t<p>In this case, the data to be analysed is an electrical signal generated by the brain called an <strong>electroencephalogram (or EEG)<\/strong>. Overall, it looks like this:<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"512\" height=\"113\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2020\/09\/image_SA_2.png\" alt=\"sentiments analysis\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2020\/09\/image_SA_2.png 512w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2020\/09\/image_SA_2-300x66.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\">\t\t\t\t\t\t\t\t\t\t\t<figcaption>fig: example of an electrical signal produced by the brain [1].<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t<p>To <a href=\"https:\/\/liora.io\/en\/how-to-choose-a-data-governance-course\">collect this data,<\/a> which is then analysed, electrodes are placed on the skull. If we carry out the experiment on you, you will look something like this:<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"512\" height=\"384\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2020\/09\/image_sa.png\" alt=\"sentiments analysis\" loading=\"lazy\" srcset=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2020\/09\/image_sa.png 512w, https:\/\/liora.io\/app\/uploads\/sites\/9\/2020\/09\/image_sa-300x225.png 300w\" sizes=\"(max-width: 512px) 100vw, 512px\">\t\t\t\t\t\t\t\t\t\t\t<figcaption><\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t<p>Once the signals have been collected, the features representing the information contained in the signal need to be extracted. These features are a more readable format for the <a href=\"https:\/\/liora.io\/en\/boosting-business-with-3-essential-machine-learning-algorithms\">Machine Learning algorithm<\/a> that will <a href=\"https:\/\/liora.io\/en\/classification-algorithms-definition-and-main-models\">classify the signals<\/a>. Features are extracted by applying various transformations, such as filters, to the electrical signal.<\/p><p>Once the features have been extracted, we give them as input to our algorithm, such as a <a href=\"https:\/\/liora.io\/en\/deep-neural-network-what-is-it-and-how-is-it-working\">Neural Network,<\/a> so that it can classify the signals into different categories: positive\/negative\/neutral.<\/p><p>In reality, this technique of recovering a cerebral signal and then analysing it to deduce a polarity (positive\/negative\/neutral) is rarely used in everyday life and is mainly exploited in the field of research, particularly by researchers interested in issues <a href=\"https:\/\/liora.io\/en\/xai-or-explainable-artificial-intelligence-what-is-it-about\">combining Artificial Intelligence and neuroscience.<\/a><\/p>\t\t\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Discover our courses<\/a><\/div><\/div>\n\n\t\t\t<h3>How is a comment written on Facebook classified?\n<\/h3>\t\t\n\t\t<p>To solve this problem, Data Scientists use classic Natural Language Processing methods (for more details, please refer to the Introduction to <a href=\"https:\/\/liora.io\/en\/natural-language-processing-definition-and-principles\">NLP &#8211; Natural Language Processing article on the site).<\/a><\/p><p>These methods analyse words directly and must take into account the contextual and linguistic aspects of the data.<\/p><p>In short, the sentence to be analysed will be treated as a sequence that defines a context and whose words are dependent on each other, i.e. they will be analysed in relation to the words that precede them in the sentence.<\/p><p>To process these sentences, <strong>Data Scientists will use Recurrent Neural Networks (RNN),<\/strong> which are neural networks specialised in sequence processing.<\/p><p>A <strong>(highly simplified) RNN architecture<\/strong> for sentiment analysis would therefore look something like this pipeline:<\/p>\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t<figure>\n\t\t\t\t\t\t\t\t\t\t<img decoding=\"async\" width=\"696\" height=\"540\" src=\"https:\/\/liora.io\/app\/uploads\/sites\/9\/2020\/09\/Capture-de\u0301cran-2020-09-07-a\u0300-09.53.32.png\" alt=\"sentiments analysis\" loading=\"lazy\">\t\t\t\t\t\t\t\t\t\t\t<figcaption>fig: architecture of an RNN for sentiment analysis<\/figcaption>\n\t\t\t\t\t\t\t\t\t\t<\/figure>\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Discover our courses<\/a><\/div><\/div>\n\n\t\t<p>If we <strong>take the sentence &#8220;You&#8217;re polite&#8221;<\/strong>, we can see that the word &#8220;polite&#8221;, once analysed by the algorithm, will return one of the two classes (in this case, positive) and that this word &#8220;polite&#8221; was analysed after the word &#8220;es&#8221; (in other words, in the context of the word &#8220;es&#8221;) which was itself analysed after the word &#8220;tu&#8221; (in other words, in the context of the word &#8220;tu&#8221;).<\/p><p>This recurrence makes it possible to define a context, which is essential for analysing sentiment.<\/p><p>Of course, there are sentences that are subtle and complex for machines to analyse. &#8220;This perfume smells extremely good, it&#8217;s addictive&#8221;. The word &#8220;extremely&#8221; can have either positive or negative connotations, while &#8220;addictive&#8221; is generally associated with a negative feeling.<\/p><p>Although <strong>recurrent neural network (RNN)<\/strong> technology has been around for a number of years, it is only recently that scientists have been able to obtain some very promising results, thanks in particular to constantly improving computing capacities. As a result, this technology is being used more and more regularly by companies wishing to obtain feedback from their users on a product or any other person with access to a large quantity of messages in order to derive a general feeling.<\/p>\t\t\n\t\t\t<p>Did you like this article?<\/p>\t\t\n\t\t<p>Wondering how to retrieve website<a href=\"https:\/\/liora.io\/en\/analysis-of-variance-anova-a-basic-tool-for-data-analysis\"> data to analyse user sentiment?<\/a><\/p><p><a href=\"https:\/\/liora.io\/en\/web-scraping-unveiled-your-comprehensive-guide-to-data-extraction\">Read our article on webscraping.<\/a><\/p>\t\t\n\t\t\t<h3>Bibliography:<\/h3>\t\t\n\t\t<p style=\"padding-left: 40px;\">[1] <a href=\"https:\/\/medium.com\/@justlv\/using-ai-to-read-your-thoughts-with-keras-and-an-eeg-sensor-167ace32e84a\">https:\/\/medium.com\/@justlv\/using-ai-to-read-your-thoughts-with-keras-and-an-eeg-sensor-167ace32e84a<\/a><\/p><p style=\"padding-left: 40px;\">[2] <a href=\"https:\/\/www.researchgate.net\/publication\/264977616_Using_Brain_Data_for_Sentiment_Analysis\" target=\"_blank\" rel=\"noopener\">Using Brain Data for Sentiment Analysis by Yuqiao Gu, Fabio Celli, Josef Steinberger<\/a><\/p>\t\t\n\t\t\t\n<div class=\"wp-block-buttons is-layout-flex wp-block-buttons-is-layout-flex is-content-justification-center\"><div class=\"wp-block-button \"><a class=\"wp-block-button__link wp-element-button \" href=\"\/en\/courses\/data-ai\/\">Discover our courses<\/a><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>Sentiment analysis is a technique that has developed strongly in tandem with social networking, where users can express themselves on a massive scale and constantly share their feelings. Sentiment analysis aims to determine the emotional tone of a speech by classifying it in different categories, such as positive, negative or neutral. It is popular with [&hellip;]<\/p>\n","protected":false},"author":76,"featured_media":179063,"comment_status":"open","ping_status":"open","sticky":false,"template":"elementor_theme","format":"standard","meta":{"_acf_changed":false,"editor_notices":[],"footnotes":""},"categories":[2433],"class_list":["post-179060","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-data-ai"],"acf":[],"_links":{"self":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/179060","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/users\/76"}],"replies":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/comments?post=179060"}],"version-history":[{"count":1,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/179060\/revisions"}],"predecessor-version":[{"id":205840,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/posts\/179060\/revisions\/205840"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media\/179063"}],"wp:attachment":[{"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/media?parent=179060"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/liora.io\/en\/wp-json\/wp\/v2\/categories?post=179060"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}