8000 GitHub - dealcrane/PyGorse: Python SDK for gorse recommender system
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

dealcrane/PyGorse

 
 

Repository files navigation

PyGorse

CI

Python SDK for gorse recommender system.

Install

  • Install from PyPI:
pip install PyGorse
  • Install from source:
git clone https://github.com/gorse-io/PyGorse.git
cd PyGorse
pip install .

Usage

Create a client by the entrypoint and api key.

from gorse import Gorse

client = 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:

from gorse import AsyncGorse

client = 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)

About

Python SDK for gorse recommender system

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%
0