We're doing pairwise similarity computation for some real estate properties. Our data goes something like this:
import pandas as pd
import numpy as np
from sklearn.metrics.pairwise import cosine_similarity
df = pd.DataFrame({
'Square Footage': np.random.randint(500, 600, 4),
'Year Renovated': np.random.randint(1992, 2019, 4),
'Year Built': [1990, 2000, 1995, 2005],
'Rent': [1000, 800, 1200, 1500],
'ameneties': [4, 6, 8, 10]
})
User enters similar information about the a property of interest and then we do cosine similarity between the two vectors.
My questions are:
How do we use data other than numbers such as text data and other categorical variables to compute similarity?
How can we modify the algorithm to specify weights?
Any other algorithms that would be appropriate for this problem?