Giter VIP home page Giter VIP logo

recommender_system's Introduction

Recommender System

This is a python project for Data Mining class 2020 summer, which implements a recommender system via user-based collaborative filtering. You can refer to the paper of Herlocker et al. and the paper of Breese et al. for a comprehensive review on collaborative filtering.

Install

This project uses python 3.7.3 and a virtual environment is recommended. The required packages are listed in the requirements.txt. Your can use the following command to install them automatically.

pip install -r requirements.txt

Usage

The implementation of collaborative filter is encapsulated in a python class named collabFilter. The parameters required for instantiating the class are the path of data, number of users and number of items, respectively. Two optional parameters decide the neighbor users to select. The dataset to be loaded must be an ASCII text file where each row is a non-zero element of rating matrix with three entries: the user ID number, the item ID number and the rating value.

The similarity matrix is calculated while instantiating. Using model_evaluation method gives the mean absolute error (MAE) of the filter. Finally, predict_all method fills all the unrated entry with 1.000-5.000 or nan if prediction is unavailable. Using save_prediction method with a filename to save the prediction result in the format as the input.

Run main.py to get an evaluation of filter and the prediction with name submit_result.txt.

Details

User-based collaborative method can be separated into three steps.

  1. Weight all users with respect to similarity with the active user. Many metric can be used such Pearson Correlation, Spearman Correlation, and Vector Similarity. In this project we use the Pearson Correlation. The Pearson correlation is defined as

  2. Select a subset of users to use as a set of predictors. This project combines weight thresholding with best-n neighbors, which can provide available predictions as much as possible.

  3. Normalize ratings and compute a prediction from a weighted combination of selected neighbors' ratings. In this project, the prediction is made using

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.