Social media moderation has always been a problem. Up until now this poorly valued task has needed human intervention requiring the moderator to: erase any crude posts, videos and monitor the global activity on social media. With the emergence of Data Science however, we at SocialWall.me have decided to tackle the problem using text and image analysis performed with Machine Learning. The aim of this post is to help you to understand how we create a global monitoring solution requiring human interaction and presence only when absolutely necessary.
Text Analysis On Social Media Messages
We have all seen haters on Twitter or Facebook, spitting out all the insults they know against companies or brands. This problem has long been a reason for the absence of social walls during events. Indeed until now social walls had to be monitored and this had a certain cost. At SocialWall.me we have created a fully automated machine learning algorithm capable of analyzing an unlimited amount of text posts and classifying them into two categories: ‘insulting’ and ‘not insulting’.
We use natural language processing to train a model which is able to predict if a text is insulting or not with an accuracy of more than 82%. Our model is based on statistical wizardry such as word-n-grams, chi-squared distribution and logistic regression. Basically the idea is to classify words found in the text either as ‘insulting’ or ‘not insulting’ and use the word-n-gram model to identify word series which are problematic and classify them. We train our algorithm thanks to public datasets found on Kaggle. Our algorithm is largely inspired by the work of A. Mueller available in this specific Kaggle Competition.
Alongside insult detection, sentiment analysis is just as important when treating any text. Indeed you don’t want to organize an event in which you streamed posts expressing negative emotions on an all display screen, this could be a mood spoiler.
To tackle this problem we decided to use a Naïve Bayesian Classifier, trained on a dataset composed of 1,578,627 tweets. We achieved a global accuracy of more than 75%. Thanks to this model we are able to survey the global mood of an event and highlight any important moments having occured.
Thanks to these two models we are able to manage social wall around the world with minimal human intervention.
Image Analysis On Social Media Posts
Another problem you encounter when monitoring a social wall is moderating the image content. No organizer is guaranteed safety against people posting pictures of their genitals or other graphic content on the dedicated Twitter feeds. These sorts of posts need to be monitored.
In response to this we have developed an algorithm capable of detecting pornographic content on a dedicated image dataset of +2M images. The model is a ResNet neural network consisting of 50 ResNet ensemble stack upon each other. The model achieved a 0.35 top 1 error on center crop image.
The model outputs a probability score which can be used to filter the image with a certain degree of acceptance. For example if you work with Victoria’s Secret you have to be able to move the cursor in order to accept a certain degree of nudity on the picture.
Thanks to this new model we are able to monitor images on all our social walls in a centralized manner.
The Future Of Social Media Moderation
For the moment we are perfectly capable of auto-moderating a major part of problematic content but we continue to explore and train new models to face new issues and complete our moderation tools. Detection of sarcastic language, and character specific detection on an image, are both works in progress
We are excited about what the future holds and will continue to let you know about the next improvements of SocialWall.me.
On A More Technical Note
• Logistic Regression for text classification
In the case of text classification we tokenize all the text from our train, test and validation datasets. Each word is considered as a feature. Then we explore the redundancy of the terms associated to each output.
In our problem we have two possible classes: ‘insulting’ or ‘not insulting’ text. With this classification we can finally associate terms accordingly. You can see on the picture below the coefficient associated to n-grams or word-n-grams. Blue coefficients are associated to ‘insulting’, red ones to ‘not insulting’.
• Naïve Bayes Classifier
The naïve Bayes classifier is based on the Bayes theorem :
P(c|x) is the posterior probability of class (c, target) given predictor (x, attributes).
P(c) is the prior probability of class.
P(x|c) is the likelihood which is the probability of predictor given class.
P(x) is the prior probability of predictor.
Let’s take an example…
Now, use Naive Bayesian equation to calculate the posterior probability for each class. The class with the highest posterior probability is the outcome of prediction.
• ResNet Image Classifier
The goal of our image analysis algorithm is to decompose the image and extract features from it and associates these features to labeled data. This is how an image classifier works. ResNet neural network is one of the latest and most performing image classifiers created by Microsoft.
The aim is still to extract features and classify pictures based on these features but the real progress resides in the depth of the model.
In the classical model we use consecutive Convolutional Layer to extract shapes, colors etc from the image. However the number of layers is limited because of the complexity induced by each new layer being exponential. The ResNet reduces the complexity per layer but multiplies the number of layers.
To show you the degree of complexity we have reached with ResNet consider the Google LeNet model which was the state of the art model a few years ago:
Each square is a layer or an operation on the layer.
Now consider the ResNet with only 34 layer residual block:
And imagine that our model is about a 50 layer block.
Conclusion
At ELISE Technologies we are at the very first stage of our research pushing the goal of a fully automatic moderation system for our social wall. But this is not our only objective. Our vision for a perfect social wall is what keeps us innovating and fuels other improvements of our social walls that need to be considered, such as the scoring of every user, alongside with the relevancy of their posts.
We are intimately convinced that your community will lead the future of advertising. That’s why we’ll continue to write articles such as this one to help you better leverage and engage with them.
—
Contact us to use the first intelligent Social Wall for your companies or ask for a free demo here.