AI in the Dating World

Originally written on:- 8th June, 2019.







In 2017, when a journalist asked the co-founder of Tinder how he imagined his dating app in five years’ time, Sean Rad pulled out his smartphone and pretended to have a conversation with the device.
“The Tinder voice might pop up and say, ‘There’s someone down the street that we think you’re going to be attracted to, and she’s also attracted to you, and guess what, she’s free tomorrow night! And we know you both like this indie band, and it’s playing, so would you like us to buy your tickets?’”
And now in 2019 — a little more than 2 years later, the prospect of algorithms finding your perfect match by compiling enormous amounts of data — from age, gender, location, preferences to online purchasing history and even Spotify playlists — has become very real.
And AI is progressively redefining love and making it brutally effective in various ways.
“Algorithms can end up knowing a person better than friends, family or even themselves, and that’s revolutionizing matchmaking”, says Michal Kosinski, a computational psychologist and assistant professor at Stanford University’s Graduate School of Business. “Algorithms can learn from experiences of billions of others, while a typical person can only learn from their own experience and the experience of a relatively small number of friends.”
In this blog post, we are going to be talking about a few opportunities that can be used to build an optimal dating experience and a substantial relationship in between humans down the road.  (A little tbbt reference...!!)

The Full Jupyter Notebook  
here

The Github Repository is here


The pipeline

To build a relationship between human beings using technology, was never as easy as it has become. So, let’s take advantage of AI methodologies that is at our disposal. But first, we need to come up with a pipeline based on which these methodologies can be deployed one after the other.




 The Description





  • For any kind of data analysis , first we need to collect data. Data from dating apps will be particularly helpful. We need to be Looking for image information on which we can perform image processing, swipe information, Bio information . Fortunately, we have resources.
  • Finding an optimal match is crucial to find a suitable partner. If it is not right, it is not right..!!. Dating apps that are currently using AI, use information such as bio description, pictures etc very precisely to provide the user with the best possible result/match.
  • The next step to building a relationship is communication. We need to have meaningful conversations in order to develop an emotional connection with the selected person. AI can help us here as well. Humans need less time swiping and more time interacting.
  • And finally, the one ingredient without which a proper relationship will be unsustainable is intimacy. Without intimacy, all the above points will fall flat and we will be needing to start from square one.
  • Now, granted that all the above points in the pipeline vary immensely from user to user, it is also important to realize the fact that this is the exact situation where AI can be helpful.


    The Technique

    For this blog post, we are going to be using Machine learning, Deep Learning as well as Natural Language Processing.
    More Specifically, we are going to be using
    1) Recommender Systems for Dating Apps.
    2) Image Processing to find optimal matches
    3) Natural Language Processing for Connection as well as Intimacy
    We will be fitting the above in the pipeline that we have mentioned Previously.


    Recommender System and Collaborative Filtering

    We will start with a definition. A recommender system is a technology that is deployed in the environment where items (in our case other users on a dating site) are to be recommended to users or the opposite. Typically, there are many items and many users present in the environment making the problem hard and expensive to solve. This is why we have the recommender system in place.
    Now, before beginning with the types of recommender systems out here, we would like to consider here the possibility of hidden preferences that the users share. Users may share one or more such hidden preferences.
    1) One such preference is swiping the same user. Here, the hidden preference that we are considering is where users are interacting with events. By events here, I mean Bio information, Profile Pictures, Description etc.
    2) Another hidden preference that we can consider is that users are more likely to respond in the same way to similar events.

    Knowledge based Recommender Systems

    Both users and events have attributes. The more you know about your users and events, the better results can be expected.

    Content based Recommender systems

    Such systems are recommending items similar to those a given user has liked in the past, regardless of the preferences of other users. Basically, there are two different types of feedback.
    1) Explicit feedback is provided by users in form of clicking the “like”/”dislike” buttons etc. In many cases, it is hard to obtain explicit feedback data, simply because the users are not willing to provide it. Instead of clicking “dislike” for an event which the user does not consider interesting, he/she will rather leave the web page .
    2) Implicit feedback data, such as “user viewed an event”, “user swiped another user” etc , however, are often much easier to collect and can also help us to compute good recommendations. Types of implicit feedback may include:
    Interactions (implicit feedback):
    • user viewed an event
    • user viewed event’s details
    • user has reached the end of suggestions.
    And we can expect better performance if the feedback is good. Content based recommenders work with the past interactions of a given user and do not take other users into consideration.


    Collaborative Filtering

    We are going to be talking about a method known as collaborative filtering. Thus, here we are relying only on observed user behavior to make recommendations. Let us try to understand how collaborative filtering actually works:
    • We need to calculate the implicit or explicit rating of the user to provide a better performing recommender system .
    • So, every entry in our matrix captures a user's reaction to a given event. If a user has never rated an event, the matrix entry is zero. Often, in these type of matrices, the majority of the entries are zero. We're assuming that there's a set of features common to all of these events and events differ in how they express these features.
    • Each user has their own reaction to each feature, independent of the events. These features are hidden factors. Now, these features will transform the matrix to represent the hidden factors.
    • This process is called low-rank approximation. It's the process of compressing the Sparsity of a matrix (sparse information) into a much lower dimensional space. Then, we can calculate the rating of a given user for a given event by taking the dot product of two vectors which can be done by means of a neural network.
    • The expectation is that unknown user-to-event ratings can be approximated by dot products of corresponding feature vectors, as well. The simplest form of objective function, which we want to minimize, is:



    Here, r are known user-to-event ratings, and x and y are the user and event feature vectors that we are trying to find. As there are many free parameters, we need the regularization part to prevent overfitting and numerical problems, with gamma being the regularization factor.


    Deep Learning based Recommender System

    Now, with the output of the dot product of the vectors, we can represent it by the means of a neural network. We can use a weight matrix to optimize these hidden preferences and their predictions over time. We can also introduce a loss function that will determine the accuracy of our prediction. Lastly we can use gradient descent which would update our weights and minimize our loss(loss function can be implemented in many ways- least square method or MSE) and improve the prediction which in turn would update the user’s rating resulting in a highly improved recommender system. This is one of the methods and many more methods are applicable.
    This is one of the methods, of course there can be several more.



    Computer Vision to Find Optimal Matches


    On dating apps, men & women who have a competitive advantage in photos & texting skills will reap the highest Return Of Investment from the app. As a result, I've broken down the reward system from dating apps down to a formula, assuming we normalize message quality from a 0 to 1 scale.


    The better photos/good looking you are you have, the less you need to write a quality message. If you have bad photos, it doesn't matter how good your message is, nobody will respond. If you have great photos, a witty message will significantly boost your ROI. If you don't do any swiping, you'll have zero ROI. The main bottleneck here is the swipe volume and time. To solve this we can build an AI that automates tinder. We can use the Tinder API to collect data.
    Steps:-
    • We will create a huge volume of labeled dataset by swiping ourselves. As we manually swipe each profile, we will save each image to a "like" or a "dislike" profile.
    • After a few hours of swiping, we would have collected about 10,000 images, that the model can train on. This is now a Classification problem.
    • Convolutional Neural Networks have been proven to be supremely useful in handling such problems. In order to distinguish betwwn features that is "likes" or "dislikes" in our case.
    • A simple CNN built with Keras will do the trick.
    • And because our dataset is relatively small, we can train an existing model or VGG-19, trained on millions of images to leverage what it has learned previously on our own dataset and therefore improve our own predicting capability.
    • Once the CNN has learned, it can track what pipeline that we wan't and what we don't.
    • Now, all that is left to write the script that automates the entire procedure. After a few hours of running, it will send us matches after optimization of swipe volume(The compatible user discovery that is) and time more importantly.

    The Code on how to prepare the data is here

     The Script In action




    Communication



    The Next part of our pipeline is communication. We need to make a very good first impression with our match in order to build a relationship. For this, we will be needing Natural Language Processing:-

    • Dating apps are superficial in the sense that it asks users to judge based on profile pictures, Bio description etc. This makes it a little difficult to take in dating history, personality into account.
    • Thankfully, there have been studies that have been performed by various instituitions on how to incorporate optimal profiles to our own profiles. For example:- To realize if there is more than one person in the profile picture or not, user is wearing sunglasses or not, a short but wordy bio, avoid using the term "lit" etc.
    • Tinder has been using a service called Smart Photos here to create a database of the most swipe-worthy photographs so that it can create a ranking/scoring system of the photographs based off on individual user's swiping pattern.




    Link to the paper is here
    • As far as the conversation is concerned , we can use Language models to generate more human like texts. There are language models such as BERT and OpenAI's GPT-2 model that can help us with it.
    • If we perform exploratory data analysis on tinder data:- such as swipe time, number of users active etc, it can be found that on 9PM on a Sunday, is the best time to swipe.




    (Sunday 9pm has the most number of swipes)

     Here I have generated some text using Open AI's GPT-2 model (Pytorch implementation) in order to carry out some conversation after you have been matched. Since, it is a text generator, it can generate some cool lines for you...!!!


    Intimacy

    We are now in the Final step of the Pipeline which is Intimacy. AI can help users in communicating with their loved ones keeping in mind things like preferences.


    A British dating app called LoveFlutter helps us in doing just that. LoveFlutter uses AI that does real time analysis on messages. If it feels right, it will nudge the users to continue/meet each other if there exists signs of compatibility.
    There is also a dating Service called AI Matchmaker or AIMM. Visit here




    • This Dating Service uses AI right from the first Phone call to the date. It uses AI to provide personal assistance as well.
    • It talks to you directly to know who you are and collects data points based on that.
    • AIMM then uses Collaborative Filtering to make recommendations as you move towards your first date.
    • Then after the date is over, it will collect feedback and use those data points to give you advice on whether you should continue to see each other or not.

    Conclusion

    So, you can see that AI can really transform the dating world one step at a time. The question here should be whether AI should be used to provide a better, personalized experience and the answer is yes. The one thing that human beings still do better than AI is being conscious . The idea is to allow AI into that consciousness, so that it can help us make better choices and decisions. Humans are capable of love and being loved, so why not try and enhance this power and make the world a better place to live in.

    Credits Go to:-
    2) Siraj raval for the video and Tutorial
    3) Paper:- A first Look at user activity on Tinder.

    Comments