Giter Club home page Giter Club logo

yelp's Introduction

Objective

The Yelp dataset contains data on businesses, users, as well as user reviews of businesses. This project builds a simple recommender system for recommending new businesses to users, using data on user ratings and business location, and other characteristics.

In src/recommender.py, we implement two types of recommender systems

  • Content-based filtering
  • Collaborative filtering

Content-based filtering

Content-based filtering recommends new businesses based on the similarity of a business' characteristics to a user's profile. Each business is characterized by its

  • Average review score
  • Location (city)
  • Category (e.g. restaurant, dentist)
  • Attributes (e.g. non-smoking, accepts credit card)

The city, category and attribute features were represented by one-hot encoding using a custom class One_Hot_Encoder in src/transformers.py, thereafter the feature vector was formed using FeatureUnion in the sklearn.pipeline module.

A user's profile is a weighted average of the features of the businesses she reviewed, weighted by her rating of the business. Finally, the algorithm recommends the business(es) that are closest in cosine distance to the user's profile.

Collaborative filtering

Collaborative filtering recommends new businesses that appeal to similar users. Each user's rating of each business is recorded as an entry in a utility matrix. For each business, the vector of user ratings represents how much the business appeals to subgroups of users. The algorithm recommends the businesses whose vector of user ratings are closest (in cosine similarity) to that of the user's favorite business.

The utility matrix is represented as a pandas.Series of scipy.sparse vectors of user ratings for each business. Ratings are centered to zero so that each businesses' average rating is zero, and missing values are set to zero.

Custom Classes

The module src/transformers.py contains two transformer for transforming data.

  • Column_Selector(colnames) selects the specified column(s) given in the list colnames.
  • One_Hot_Encoder(colnames, value_type = 'list', sparse = True) turns the specified column in colnames with values of value_type into a sparse one-hot encoding. value_type must either be list or dict. The features of the transformed matrix are all distinct entries or keys in colnames.
    Dependencies: sklearn.feature_extraction.DictVectorizer.

yelp's People

Contributors

lchiaying avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.