Skip to main content

recommender system using machine learning

Project description

logo

ReSyPE: Recommender System in Python Environment

Introduction

ReSyPE (pronounced recipe) is a Python library built for both practitioners and researchers that wish to quickly develop and deploy ML-based recommender systems.

The library provides an end-to-end pipeline that includes:

  1. Loading transaction, user feature, and item feature datasets
  2. Interchangable methods for user and item clustering
  3. Modular framework for machine learning models
  4. Iterative and decomposition-based techniques

Installation

pip install resype

Setup

The package uses Python 3 and virtualenv to manage the environment. Once you've cloned this repo run this from the root of the repo to create the environment:

conda env create -f environment.yml
source activate resype

Getting Started

import pandas as pd
import numpy as np
from resype.collab_filtering import CollabFilteringModel

# load transaction list
transaction_list = pd.read_csv("sample_data/ratings.csv")
transaction_list = transaction_list[['userId', 'movieId', 'rating']]
transaction_list = transaction_list.sample(20)
transaction_list.columns = ["user_id", 'item_id', 'rating']

re = CollabFilteringModel(transaction_list)

# construct utlity matrix
re.construct_utility_matrix()

# import sklearn Model
from sklearn.neural_network import MLPClassifier, MLPRegressor
mlp1 = MLPRegressor(hidden_layer_sizes=(50, 50))

# fit and predict
re.fit(mlp1, method='iterative')

# recommend
user_list = [0, 1, 2] # indices
top_n = 10
re.get_rec(user_list, top_n)

Comparison with Surprise

Features Surprise ReSyPE
Handles explicit rating data ✔️ ✔️
Cross validation ✔️ ✔️
Recommendation evaluation ✔️ ✔️
Collaborative filtering ✔️ ✔️
Content-based filtering ✔️
Customizable ML models ✔️

Performance

Prediction Algorithm MSE MAE
NormalPredictor 2.051080 1.135742
BaselineOnly 0.858667 0.735921
KNNBasic 1.362782 0.906558
KNNWithMeans 1.173480 0.850230
KNNWithZScore 1.185011 0.842193
KNNBaseline 1.057957 0.796983
SVD 0.862225 0.730675
NMF 1.360950 0.921752
SlopeOne 1.222082 0.869121
CoClustering 1.299210 0.900984
ReSyPE (SVD-based Collaborative Filtering using Random Forest) 1.343327 0.907147
ReSyPE (Content-based; Random Forest) 0.955075 0.757576

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

resype-0.1.tar.gz (21.1 kB view details)

Uploaded Source

File details

Details for the file resype-0.1.tar.gz.

File metadata

  • Download URL: resype-0.1.tar.gz
  • Upload date:
  • Size: 21.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.9

File hashes

Hashes for resype-0.1.tar.gz
Algorithm Hash digest
SHA256 ad6f374057eccf4c87cb27ed1df6e4b1cb2211416183f9f2cb062bd87b15dc1f
MD5 8d9f7dce5233259ae26d081f33e9d6f0
BLAKE2b-256 ef8f7da282d19cff4f07e3a2c4f62b25e7a727c040f52d0885eb8ce25ac540fb

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page