Skip to main content

This package will create recommendations based on content as well as user ratings and finally providing top recommendations based on both data points

Project description

Hybrid Recommender

This package usage multiple algorithms and parameters to accomodate different set of use cases.


  • item_clusters: int The number of clusters for item matrix generation. This parameter can be tuned
  • top_results: int Number of recommendations needed. Default value is 10
  • ratings_weightage: int Weightage for user ratings score. Default is 1
  • content_weightage: int Weightage for content score. Default is 1
  • null_rating_replace: str Value to be used as replacement for missing ratings. Default is 'mean', other acceptable values are 'zero','one', and 'min'


DataFrame having top recommended results for the list of users


  1. Create an instance of the hybrid recommender class mr = hybrid_recommender()

  2. Call fit method on the defined object by passing on ratings and content data,content_df)

  3. Call the predict method recommended_df = mr.predict()


Create Ratings DataFrame

item_id = [1,7,9,10,12,2,4,6,8,10,12,3,6,9,12,14,10,13,12,14,11,2,5,7,8,9,10,12]
user_id = [1,1,1,1,1,2,2,2,2,2,2,3,3,3,3,3,4,4,4,4,4,5,5,5,5,5,5,5]
rating = [4,5,2,3,5,2,3,2,3,4,4,5,1,2,3,1,2,4,5,3,5,3,1,3,5,3,5,3]
ratings = pd.DataFrame({'user_id':user_id,'item_id':item_id,'rating':rating})

Create Content DataFrame

items = [1,2,3,4,5,6,7,8,9,10,11,12,13,14]
cols = ['col1','col2','col3','col4','col5']
feats =[[1,0,0,1,1],
item_df = pd.DataFrame(feats,index=items,columns=cols)

Ratings DataFrame


Content DataFrame


Fitting and prediction

Creating the recommender object

my_recommender = hybrid_recommenders(item_clusters=4,top_results=5)

Fitting the data,item_df)

Recommend for few users


Recommendations for All users


Project details

Download files

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

Source Distribution

hybrid_recommender-0.4.tar.gz (4.1 kB view hashes)

Uploaded source

Built Distribution

hybrid_recommender-0.4-py3-none-any.whl (5.0 kB view hashes)

Uploaded py3

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