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"
]
}
Metadata
Release files for very-easy-recommendation-engine 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| very_easy_recommendation_engine-0.0.2.tar.gz | 2.9 kB | Without provenance | Details for very_easy_recommendation_engine-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| very_easy_recommendation_engine-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for very_easy_recommendation_engine-0.0.2-py3-none-any.whl |
Total release size: 6.0 kB
Release files / very_easy_recommendation_engine-0.0.2.tar.gz
| Download URL | very_easy_recommendation_engine-0.0.2.tar.gz |
|---|---|
| Size | 2.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aedacb6805867cfff4daf60fb4a15bb328694aae98e4626c714cd4213a509d4c
|
|
BLAKE2b-256 checksum How to use checksums |
bc51f1d06a54e0af073712af685b1303ecb196d5158ffd96e49a4267242f3bd5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / very_easy_recommendation_engine-0.0.2-py3-none-any.whl
| Download URL | very_easy_recommendation_engine-0.0.2-py3-none-any.whl |
|---|---|
| Size | 3.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
3de1e2c37522ad8953ea6522119488319b53ac3807ae38f11da248e91d70bb62
|
|
BLAKE2b-256 checksum How to use checksums |
37865354291cbc2034f5a0470bd5e18c1dd45c35f797245d79c1c67f05034faa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for very-easy-recommendation-engine 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.