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
Close
Hashes for very_easy_recommendation_engine-0.0.2.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | aedacb6805867cfff4daf60fb4a15bb328694aae98e4626c714cd4213a509d4c |
|
MD5 | 300331af2750b44c5e40a60384f32707 |
|
BLAKE2b-256 | bc51f1d06a54e0af073712af685b1303ecb196d5158ffd96e49a4267242f3bd5 |
Close
Hashes for very_easy_recommendation_engine-0.0.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3de1e2c37522ad8953ea6522119488319b53ac3807ae38f11da248e91d70bb62 |
|
MD5 | 57f32184087ab8eb168044b4278c859b |
|
BLAKE2b-256 | 37865354291cbc2034f5a0470bd5e18c1dd45c35f797245d79c1c67f05034faa |