Data Modelling
In data modeling, we will first use TfidfVectorizer from the sklearn package to convert bio-categorical object Dtype into the numerical column. Note that output from the tfidVectorizer is a sparse matrix so here we will use SVD (Singular Value Decomposition) to reduce the dimensionality of the matrix.
For the purpose of finding a similarity between the user and our current present profile, we will use cosine similarity between the user and stored profile.
This is a content-based filtering algorithm in which we are using the user’s profile information to recommend other profiles with similar characteristics. This algorithm recommends the profiles which have the highest cosine similarity score with the user.
Python3
# Initialize TfidfVectorizer object tfidf = TfidfVectorizer(stop_words = 'english' ) # Fit and transform the text data tfidf_matrix = tfidf.fit_transform(tinder_df[ 'bio' ]) # Get the feature names from the TfidfVectorizer object feature_names = tfidf.vocabulary_ # Convert tfidf matrix to DataFrame tfidf_df = pd.DataFrame(tfidf_matrix.toarray(), columns = feature_names) # Add non-text features to the tfidf_df dataframe tinder_dfs = tinder_df.drop([ "bio" , "user_id" , "username" ], axis = 1 ) tinder_dfs = pd.concat([tinder_dfs, tfidf_df], axis = 1 ) # Apply SVD to the feature matrix svd = TruncatedSVD(n_components = 100 ) svd_matrix = svd.fit_transform(tinder_dfs) # Calculate the cosine similarity # between all pairs of users cosine_sim = cosine_similarity(svd_matrix) |
Predict Tinder Matches with Machine Learning
In this article, we are going to make a project on the Tinder Match-Making Recommender system. Most social media platform have their own recommender system algorithms. In our project, which works like Tinder, we are going to make a recommender algorithm that recommends profiles to people based on their similar interests so we will aim to predict the profiles to the user such that the user finds it most interesting out of all and tries to connect with them. We are going to make this project from basic and the steps we are going to follow are as:
Contact Us