Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gorse-io/pygorse
Python SDK for gorse recommender system
https://github.com/gorse-io/pygorse
gorse python
Last synced: about 2 months ago
JSON representation
Python SDK for gorse recommender system
- Host: GitHub
- URL: https://github.com/gorse-io/pygorse
- Owner: gorse-io
- License: apache-2.0
- Created: 2022-04-09T01:11:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-01T13:17:15.000Z (over 1 year ago)
- Last Synced: 2024-11-07T18:53:59.945Z (about 2 months ago)
- Topics: gorse, python
- Language: Python
- Homepage:
- Size: 36.1 KB
- Stars: 8
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# PyGorse
[![CI](https://github.com/gorse-io/PyGorse/actions/workflows/ci.yml/badge.svg)](https://github.com/gorse-io/PyGorse/actions/workflows/ci.yml)
[![](https://img.shields.io/pypi/v/pygorse)](https://pypi.org/project/PyGorse/)
![](https://img.shields.io/pypi/dm/pygorse)Python SDK for gorse recommender system.
## Install
- Install from PyPI:
```bash
pip install PyGorse
```- Install from source:
```bash
git clone https://github.com/gorse-io/PyGorse.git
cd PyGorse
pip install .
```## Usage
Create a client by the entrypoint and api key.
```python
from gorse import Gorseclient = Gorse('http://127.0.0.1:8087', 'api_key')
client.insert_feedbacks([
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'vuejs:vue', 'Timestamp': '2022-02-24' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'd3:d3', 'Timestamp': '2022-02-25' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'dogfalo:materialize', 'Timestamp': '2022-02-26' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'mozilla:pdf.js', 'Timestamp': '2022-02-27' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'moment:moment', 'Timestamp': '2022-02-28' }
])client.get_recommend('bob', n=10)
```The Python SDK implements the async client as well:
```python
from gorse import AsyncGorseclient = AsyncGorse('http://127.0.0.1:8087', 'api_key')
await client.insert_feedbacks([
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'vuejs:vue', 'Timestamp': '2022-02-24' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'd3:d3', 'Timestamp': '2022-02-25' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'dogfalo:materialize', 'Timestamp': '2022-02-26' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'mozilla:pdf.js', 'Timestamp': '2022-02-27' },
{ 'FeedbackType': 'star', 'UserId': 'bob', 'ItemId': 'moment:moment', 'Timestamp': '2022-02-28' }
])await client.get_recommend('bob', n=10)
```