C S Shravan KumarContact
Projects

Tourist Places Recommendation System

A travel recommendation platform that suggests tourist places to each person by combining collaborative and content-based filtering.

Placeholder for a screenshot of the Tourist Places Recommendation System.

What I built

  • InterfaceDjango templates with JavaScript and Bootstrap for browsing places, saving favourites and viewing recommendations.
  • APIA Django application with a hybrid recommender written with scikit-learn and pandas.
  • DataMySQL for application data, with place and rating datasets feeding the recommender.
  • InfraDeployed on Render.

What it does

The platform recommends tourist places that fit each person, whether they want a beach, a city or a historical site. People can save their favourite places and read the details of each recommended location.

How the recommender works

It is a hybrid of two approaches, and the final score for a place blends both.

  • Content-based filtering: each place is described by its category and city. Those descriptions are turned into TF-IDF vectors, and a person's stated preferences are compared against them with cosine similarity.
  • Collaborative filtering: ratings are arranged in a sparse matrix of people and places. For a given person, the system finds the most similar people and averages their ratings.

The collaborative part looks like this:

def get_cf_scores(user_item_matrix, user_id_map, user_id, n_similar=10):
    if user_id not in user_id_map:
        return np.zeros(user_item_matrix.shape[1])

    user_index = user_id_map[user_id]
    user_vector = user_item_matrix[user_index].toarray().flatten()
    similarities = cosine_similarity(user_vector.reshape(1, -1), user_item_matrix.toarray())[0]
    similar_users = np.argsort(similarities)[::-1][1:n_similar+1]
    return user_item_matrix[similar_users].mean(axis=0).A1

A person with no ratings yet gets zero from this function, so their first recommendations come from the content-based side alone.

I improved the accuracy of the recommendations by refining the models over several iterations. The data loading and the TF-IDF matrix are cached with joblib so that repeated requests do not recompute them.