Fake Instagram profile detector with Artificial neural networks (ANN)
- Navya V
- Nov 5, 2021
- 3 min read
How are human beings able to see things and classify them according to some criteria? Suppose you see a person, you can easily identify if he is wearing a mask or not. We have also seen captcha and some image recognition puzzles to verify if u are not a robot in many sites. What is that we manage to outshine ahead of a computer? The answer is intelligence. We possess intelligence whereas machines do not. They simply do the work which its owner asks to do.
In order to give machines some part of this intelligence is where the concept of artificial intelligence comes in. It is a branch concerned to build the smart machines which possess some human intelligence. Machine learning and deep learning are the subfields of AI, they are on-demand topics these days. Machine learning is the set of algorithms which helps the machine learn on its own as it is exposed to large number of data sets. Deep learning is a part of machine learning which focuses on artificial neural networks. Let us take a view at deep learning by building a simple model to predict if the Instagram account is fake or real by proving inputs like username length, name of account, profile picture presence, posts, followers and so on.
The basic concept of such deep learning models is that we provide some data to the model so that it learns as to what the output will be if the given input is made. So, when a new input is given it can intelligently give the expected output.
To build a deep learning model we need to go through the following steps:
1.Understand the problem statement and business case.
The model has to take input constraints of an Instagram account and should say if it is fake or not. To accomplish this task we input previously analyzed data and train it.
2.Import Datasets and libraries.
In anaconda Jupyter notebooks, we need to import tensorflow, keras, pandas, matplotlib, numpy, Seaborn and some important directories from tensorflow and keras.
The test and train data sets for the model are visited.

Fig 1: Train data set.
3.Perform the data analysis of test and train sets.
For any artificial neural network model we need test, train and validate data sets. Train allows you to train the model, by which model learns after which we have to test some cases and then validate.

Fig 2: Statistics related to train data set. The same can be checked for test data sets.
4.Perform data visualisation
We use matplot libraries to do this task for us.

Fig 3: Graph visualization.
5.Prepare the data to feed the model
Test and train data is fed to the model. The train data is in turn divided into validate and train data. Validate sets ensure no overfitting taking place.
6.Build and train the deep learning model.
It comes under sequential API, we have a series of layers like dense and dropout consisting of artificial neurons which work similar to the neurons in human nervous system, like single neuron cells come together and work to achieve the required identification task.. These artificial neurons are called Perceptrons. There is also activation required which helps in getting to know values of inputs and weights to achieve required output. Examples are relu and softmax for the output layer. Then the model can be run for as many epochs as needed according to the efficiency required (usually maximum). Each layer makes predictions and learns, thus when the output layer is reached giving an accuracy of above 80 percent.

(x represents inputs, w represents weights to achieve the output y)
Fig 4 (a): Visualization of a single Perceptron.
(b): Many Perceptrons are connected to form a deep learning model.
7.Assess the performance of the trained model
We look into the training accuracy and loss, validation accuracy and loss and thus judge if the model is best suited for our work.
Thus, a simple model can be built. The detailed code is given in the link at the last. The concept of Artificial intelligence and artificial neural networks is as if ocean, nice that you have taken an initiative to dive into this ocean. Keep exploring and learn more!
The datasets and Jupyter notebook code to this project can be accessed through below link:
github.com/navyaav/Fake-instagram-profile-detection
Comments