A Very Easy Recommendation Engine for Django
Project description
A Very Easy Recommendation Engine for Django
Installation
pip install very-easy-recommendation-engine-django
Configuration
Let's say you have a model for movies and ratings of movies like so:
"""
movies/models.py
"""
class Movie(models.Model):
title = models.CharField()
class Rating(models.Model):
created = models.DateTimeField(auto_now_add=True)
value = models.IntegerField(min=1, max=5)
movie = models.ForeignKey(Movie, on_delete=models.CASCADE)
user = models.ForeignKey(User, on_delete=models.CASCADE)
We will build a recommendation engine to show movies a user might like based on their ratings.
"""
settings.py
"""
VERY_EASY_RECOMMENDATION_ENGINE = {
"APPLICATION_ID": "{{ Your Application ID key here }}"
"API_KEY": "{{ Your secret key here }}"
"models": {
"user_movie_recommendations": {
"output_field": "books.Rating.value"
}
}
}
"""
urls.py
"""
urlpatterns = [
...,
path("very-easy-ai", "very_easy_recommendation_engine.urls")
]
That's it! Our servers will start building your recommendation engine and provide an API endpoint for your application to pull recommendations
Getting Recommendations
Request:
from very_easy_recommendation_engine import VeryEasyRecommendationEngine
rec_engine = VeryEasyRecommendationEngine(model_name="user_movie_recommendations")
# Get recommendations for user number five
recommendations = rec_engine.get_recommendations_for_user(user_id=5)
print(recommendations, limit=15)
Output:
{
"results": [
{
"objectId": "objectId1",
"value": 4.89
// ...
},
{
"objectId": "objectId2",
"value": 4.87
// ...
}
//...
],
"count": 15,
"queryId": "43b15df305339e827f0ac0bdc5ebcaa7"
]
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file very_easy_recommendation_engine-0.0.1.tar.gz
.
File metadata
- Download URL: very_easy_recommendation_engine-0.0.1.tar.gz
- Upload date:
- Size: 2.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9205c7e8481319b8bc54c5b17c986e7e78395ef73ed5db606a9958a1027ce75 |
|
MD5 | 8d66e74e8e4996d68d3bafcf1003f2d9 |
|
BLAKE2b-256 | 4842e7341df062afc2ab9762d86b4a08b79b86ac594a028774355d64488e1d33 |
File details
Details for the file very_easy_recommendation_engine-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: very_easy_recommendation_engine-0.0.1-py3-none-any.whl
- Upload date:
- Size: 2.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 730a8e82a46b9617c830e93a35f2363244aceb1878e8094d12793013ae01bb52 |
|
MD5 | 5f116b3e7967e9b228c7ee7f5be3466b |
|
BLAKE2b-256 | ff816b74bcc4220b3578639b9593befc57f18b33fc2719244eb75a32076f837a |