一个非常灵活的解决方案,适用于任何编程语言(包括Python),就是
Abracadabra 推荐 API。
基本上它是一个“推荐算法即服务”的库。设置非常简单:您只需要发送HTTP调用(可以使用Django)到API端点URL来训练您的模型并接收推荐。
查看文档如何操作。
使用Abracadabra推荐API时,如果使用
Python
,您首先需要向模型添加数据:
# These code snippets use an open-source library. http:
response = unirest.post("https://noodlio-abracadabra-recommender-systems-v1.p.mashape.com/add/subjects?recommenderId=rec1&subjectId=See+docs",
headers={
"X-Mashape-Key": "<required>",
"Accept": "application/json",
"Content-Type": "application/json"
}
)
然后您可以通过对主题(例如电影)进行评分或喜欢来训练模型:
response = unirest.post("https://noodlio-abracadabra-recommender-systems-v1.p.mashape.com/rate/subject?recommenderId=rec1&subjectId=gameofthrones&subjectWeight=10&userId=user1",
headers={
"X-Mashape-Key": "<required>",
"Accept": "application/json",
"Content-Type": "application/json"
}
)
完成后,您将根据基于内容、协作或混合过滤的推荐收到以下建议:
# These code snippets use an open-source library. http:
response = unirest.post("https://noodlio-abracadabra-recommender-systems-v1.p.mashape.com/recommend?method=content&recommenderId=rec1&userId=user1",
headers={
"X-Mashape-Key": "<required>",
"Accept": "application/json",
"Content-Type": "application/json"
}
)
您可以在其他语言中查看更多示例,包括Angular
,React
,Javascript
,NodeJS
,Curl
,Java
,Python
,Objective-C
,Ruby
,.NET
等。请访问API主页。