Making the Artificial Neural Network
After hours of “swiping”, I was finally able to collect a sizable dataset with roughly 200 rows of which would be sufficient enough to train my model. For this section of the project, I would be making use of the Numpy, Pandas and Sklearn libraries so as to create and train my data models.
From my data, I would only use the age, number of photos, bio length, distance, job and school information to train my model since those are the data values most likely to affect the swipe value.
The idea was to create an Artificial Neural Network that would predict how likely I am to like or dislike a user once presented with that user’s profile data. It would then like or dislike their profile on my behalf.
After importing the Excel spreadsheet with our data into the Python file, we needed to replace every unique text value in our model with numbers by using a label encoder. Changing these text values into numbers allows for the Artificial Intelligence to process them faster and more easily. In our case, only the school, job and swipe columns contained text values and so we encoded them using Sklearn.
Next, we split the dataset into two sections; a test set and a training set. The training set is used to create the model that will be used by our AI and the test set is used to check how accurate the predictions made by the models are. For this project, we split the dataset into a standard 20% test data and 80% training data.
At this point, our model was ready to be created. Our Artificial Neural Network would have two hidden layers. These hidden layers take in the raw data in our dataset, pass it through an activator function and then returns an output. For the first hidden layer, we would use a Rectifier function since it is the most commonly used and returns the most accurate data for this kind of model. We would then pass the output from the first hidden layer through another hidden layer that would use a Sigmoid function. The Sigmoid function returns an output that reflects a probability since the output ranges between 0 and 1.
After passing our dataset through these layers, we can now compile the results, compare our Artificial Neural Network’s predictions to the results in the test set and then see how accurately it predicts whether I would have liked or disliked a profile. We’ll run through 1000 epochs because our dataset isn’t very big and this also allows the model become as accurate as possible.
Finally, function that would be imported into the ‘data_getter’ Python file was created. It would primarily receive data related to a user and then would return a swipe value i.e like or dislike. This would be the function that would reference the model we trained and decided to either like or dislike a user.
Within the ‘data_getter’ Python file, a new function that would pass data values into the ‘TinderAI’ function was created. Based on the swipe value it received from the Artificial Neural Network, it would send a response back to Tinder.
Now it was time to let the AI have full reign over my Tinder account. Feeling like a father teaching their child how to drive in the family’s only car, I anxiously ran the code and sat back in the passenger seat watching. I had set a delay of two seconds per swipe so as to prevent the code from sending too many requests to Tinder and thus causing the connection to get terminated.
Every minute, the AI received data and liked or disliked thirty profiles. Thirty potential wives or life long partners in the hands of the model I had trained and it was honestly an exhilarating experience. As I sat there, I wondered if Charles Babbage, the father of computing, would have ever imagined that his invention would one day lead to a 24 year old guy in Kenya creating an Artificial Intelligence for his online dating profile.
I let the Artificial Neural Network run for a while so as to collect a sizable dataset. I then used this data to compare how my ANN performed in relation to me by graphing the data points and seeing how they differed.
In the end, I was able to collect very interesting data in relation to how I swipe and the interactions I generate with users on online dating applications. I guess it takes an algorithm centered around your personal data to truly know yourself.
Right now, we are a few years or decades away from creating Artificial Intelligence with the capacity to understand and help decide upon complex human matters such as love and dating. However, as long as a young student of science like myself is able to learn and implement the fundamentals of AI by themselves, we will surely meet that goal soon enough.