machine-learning - Fastai 预测协作学习模型
问题描述
我有一个 Fast ai 协同过滤模型。我想在这个模型上预测一个新的元组。我在使用预测功能时遇到问题
从他们的文档中,
Signature: learn.predict(item, rm_type_tfms=None, with_input=False)
Docstring: Prediction on `item`, fully decoded, loss function decoded and probabilities
File: ~/playground/virtualenv/lib/python3.8/site-packages/fastai/learner.py
Type: method
我如何定义我需要通过的项目。假设对于一个movielens数据集,对于已经在数据集中的用户,我们想推荐一组电影,我们如何传递用户ID?
我试图在这里遵循一些答案 - https://forums.fast.ai/t/making-predictions-with-collaborative-filtering/3900
学习预测([np.array([3])])
我似乎收到一个错误:TypeError: list indices must be integers or slices, not list
解决方案
我认为这会有所帮助:
https ://medium.com/@igorirailean/a-recommender-system-using-fastai-in-google-colab-110d363d422f
该文档还包含以下信息:
dl = learn.dls.test_dl(test_df)
learn.get_preds(dl=dl)
它帮助了我。
推荐阅读
- c++ - 具有不同实例化的多个实例化点?
- c# - Problem with per-triangle collision detection when geometry is rotated
- python - 使用 Python 过滤或省略 .txt 文件中的多个相似数据行 ::Updated with my answer::
- amazon-web-services - 无法在具有无服务器和 DynamoDB/Cognito/API 网关的 lambda 策略中使用 ${cognito-identity.amazonaws.com:sub}
- javascript - 需要在 Google Script 中放置一个超链接,但它显示错误 Unexpected Identifier where tag is used
- python - 使用 Jinja2 Flask 渲染带有可编辑 WTForms 字段列表和不可编辑值的 HTML 表
- javascript - 地图内的Javascript地图直到条件满足
- c++ - const char 指针模板特化
- python - 如何从字典中提取提取特定键?
- angular - Ionic 中的条纹结帐