如何解决产品推荐问题,例如:用户 __bought__ XXX 也 __viewed__ YYY

发布于 2024-10-27 17:01:48 字数 257 浏览 7 评论 0原文

我目前正在学习推荐系统,学习了一些关于协同过滤、User CF、Item CF的知识,很明显使用这些算法来解决如下问题: 1) 用户购买了 XXX 也购买了 YYY 2)用户查看了 XXX 也查看了 YYY

我的问题是:如何解决问题,例如: 1) 用户购买了 XXX 也浏览了 YYY 2) 用户浏览了 XXX 也购买了 YYY ?

更新:刚刚将标题更正为:“用户购买了 XXX 还查看了 YYY”

I am currently learning recommender system, learned something about collaborative filtering, User CF, Item CF, it is obvious to use these algorithm to solve problem like:
1) User bought XXX also bought YYY
2) User viewed XXX also viewed YYY

My question is: how to solve problem like:
1) User bought XXX also viewed YYY
2) User viewed XXX also bought YYY ?

Update: Just corrected the title to: " User bought XXX also viewed YYY"

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

请帮我爱他 2024-11-03 17:01:48

虽然我不确定这是否真的是“推荐”,但我可以告诉您如何在 Mahout 中跨域处理推荐。您将构建两个 DataModel,一个基于用户项目购买构建,另一个基于用户项目视图构建。您可以使用购买数据作为 UserSimilarityItemSimilarity 实现的输入,然后将视图数据作为输入 DataModel 提供给推荐器实施。然后你会计算出更像你建议的东西。

While I am not sure this is really "recommendation", I can tell you how you'd approach recommendations across domains in Mahout. You would build two DataModels, one built on user-item purchases and one built on user-item views. You would use the purchase data as the input to a UserSimilarity or ItemSimilarity implementation, but, then feed the view data as the input DataModel to the Recommender implementation. You would then be computing something more like what you suggest.

俏︾媚 2024-11-03 17:01:48

假设您有两个表 products 和 sell_products。每次销售产品时,它都会添加到 sell_products 表中。我们会说这两个表通过product_id关联,order_id用于将sold_products中的订单分组在一起。

我们假设您正在查看的产品的product_id为1234。

  1. 从包含该产品的最后25个订单中获取order_ids列表。

SELECT DISTINCT sell_products.order_id FROM sell_products WHERE Product_id=1234 LIMIT 25

  1. 从那里我们将所有 id 放入由角分隔的字符串中,

例如PO1234、PO435、PO3456 ....

  1. 从这些订单中选择产品 ID,我喜欢按频率排名

SELECT DISTINCT products.* FROM sell_products LEFT JOIN products on products.product_id=sold_products.product_id WHERE sell_products.order_id IN (PO1234,PO435 ,PO3456 ....)而不是 sell_products.product_id=1234 GROUP BY sell_products.product_id ORDER BY COUNT(1) DESC

Say you have two tables products and sold_products. Each time you sell a product it gets added to the sold_products table. We will say the two tables are related by product_id, order_id is used to group orders together in sold_products.

We will assume the product you are looking at has a product_id of 1234.

  1. Get a list of order_ids from the last 25 orders which contain the product.

SELECT DISTINCT sold_products.order_id FROM sold_products WHERE product_id=1234 LIMIT 25

  1. From there we will put all the ids into a string separated by comers

e.g. PO1234,PO435,PO3456....

  1. Select the product ids from those orders and I like to rank by frequency

SELECT DISTINCT products.* FROM sold_products LEFT JOIN products on products.product_id=sold_products.product_id WHERE sold_products.order_id IN (PO1234,PO435,PO3456....) AND NOT sold_products.product_id=1234 GROUP BY sold_products.product_id ORDER BY COUNT(1) DESC

临走之时 2024-11-03 17:01:48

您需要参考OReilly 的《Programming Collective Intelligence》一书的第 2 章。要找到匹配的产品,即“购买此商品的客户也购买了...”部分,您需要

  • 首先收集各个用户的偏好
  • ,然后找到相似的用户
  • ,然后查看他们购买或喜欢的其他商品。

上述步骤涉及到算法。该书中提供了更多详细信息以及这些算法的 Python 代码。

You need to refer Chapter 2 of OReilly's 'Programming Collective Intelligence' book. To come up with matching products ie., 'Customer who bought this item also bought...' section, you need to

  • first collect preferences of various users
  • Then find similar users
  • Then see other items they purchased or liked.

There are algorithms involved in above steps. More details are given in that book along with python code for those algorithms.

才能让你更想念 2024-11-03 17:01:48

您通常需要两个数据集。 I.e 交易 ID &产品作为第一&访客 ID 和被视为第二个达到将任意两种产品一起销售(或查看)的置信度百分比的产品。您可以使用R(统计软件)&安装一个名为“arules”的包来轻松生成这些建议。

以下是您可能需要在 R 中查看的示例代码

setwd(“C:/Documents and Settings/rp/Desktop/output”);
install.packages(“arules”);
图书馆(“规则”);
txn = read.transactions(file=”Transactions_sample.csv”, rm.duplicates= FALSE, format=”single”,sep=”,”,cols =c(1,2));
basket_rules <- apriori(txn,parameter = list(sup = 0.5, conf = 0.9,target=”rules”));
检查(篮子规则);

如果您确实想了解其工作原理,您可能需要查看 http://www.tatvic.com/resources 上的白皮书。 tatvic.com/resources 称为产品购买模式分析,它指示您如何简单地使用网络数据来做到这一点。

此外,如果您想使用现成的 API,可以在 http: //www.liftsuggest.com/how-lift-product-recommendation-works

You would generally need two dataset. I .e transaction id & product as first & visitorID & productsviewed as second to arrive at a % of confidence of having any two products being sold(or viewed) together. You can use R (statistic software) & install a package called "arules" to generate these recommendations easily.

Here is a sample code that you may want to check out in R

setwd(“C:/Documents and Settings/rp/Desktop/output”);
install.packages(“arules”);
library(“arules”);
txn = read.transactions(file=”Transactions_sample.csv”, rm.duplicates= FALSE, format=”single”,sep=”,”,cols =c(1,2));
basket_rules <- apriori(txn,parameter = list(sup = 0.5, conf = 0.9,target=”rules”));
inspect(basket_rules);

If you would really want to understand how it works, you may want to check out the white paper at http://www.tatvic.com/resources named as product purchase pattern analysis which indicates how you can do it simply with your web data.

Further, if you want to use a readymade API for it, it is available at http://www.liftsuggest.com/how-lift-product-recommendation-works

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文