问题标签 [arules]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
5585 浏览

r - R arules - 匹配规则的事务子集

我正在使用 R 包arules。我有一些交易和规则(见下文)。我想要违反规则的交易子集。我怎样才能做到这一点?

这是设置:

r我想要包含规则左侧但不包含右侧的事务子集。arules 文档没有这样的示例。我已经尝试过%in%matchsubset我无法正确使用语法。

subset函数的文档有子集规则的示例,但没有子集事务的示例。

http://rss.acs.unt.edu/Rdoc/library/arules/html/subset.html

0 投票
1 回答
1317 浏览

r - 根据交易长度的子集规则交易对象

任何人都知道如何arules根据事务长度对对象进行子集化和事务处理?

例如:

我想根据每个事务的长度将 Adult 分成不同的事务对象。

0 投票
6 回答
5491 浏览

r - Arules Sequence Mining in R

I am looking to use the arulesSequences package in R. However, I have no idea as to how to coerce my data frame into an object that can leverage this package.

Here is a toy dataset that replicates my data structure:

Any help will be greatly appreciated.

0 投票
1 回答
1650 浏览

r - Arules 包--Trio 错误

我正在使用 4547 x 5415 的大型二进制数据矩阵进行关联规则挖掘。通常,每一行都是一个事务,每一列都是一个项目。每当我调用 arules 包时,它都会产生一些引用 trio 库的神秘错误消息。有没有人遇到过这种类型的错误?

可重现的例子:

0 投票
1 回答
2569 浏览

r - 从 R 中的关联规则输出创建数据框

任何人都可以帮助我如何为 arules 包获得的关联规则创建数据框。我尝试了不同形式的“强制签名(从=“规则”,到=“data.frame”);” 但我没有从中得到任何东西。

0 投票
3 回答
2324 浏览

r - 准备一个规则交易清单

arules需要交易清单。列表中的每一行都将包含一个产品数组。并非每笔交易都有相同数量的产品。这听起来像支点,但事实并非如此。一个例子可以在这里找到

我想要 aggregate(dvd , by=list("ID"), FUN=c) 失败的东西arguments must have same length

这是我的数据

我需要一个看起来像这样的列表

0 投票
5 回答
5245 浏览

r - 无法将数据框转换为事务对象

我想用这个arules包来练习用R挖掘关联规则。数据是

通过做

出现此错误:

我该怎么做才能将我的对象转换为“交易”对象?

0 投票
2 回答
1921 浏览

r - 可以导入稀疏矩阵在 R 中做关联规则吗?

我从来没有使用过 R ,但现在我需要导入一个稀疏矩阵来在 R 中做关联规则

我的导入数据是一个像这样的稀疏矩阵:

       i    j    x
1 2 3 1
2 3 5 1
3 3 1 1
4 2 5 1
。. . .
. . . .
200000000 . . .

稀疏矩阵大小为200,000,000 X 3,矩阵为200000 X 100000(大数据?)

我想用这些数据在 R 中做关联规则,
是使用 ' Package arules ' itemMatrix-class & tidLists-class()吗?还是其他人?

以及怎么做?

我喜欢这个但不工作:

可以在先验函数中使用稀疏矩阵吗?
也许我使用了错误的包?
我需要稀疏矩阵-> 矩阵-> 关联规则吗?
还是稀疏矩阵->关联规则

0 投票
1 回答
794 浏览

r - 我们如何知道规则中生成的项目的列名/属性

使用 arules 包,'apriori' 返回一个 'rules' 对象。

我们如何进行查询 - 规则 {lhs, rhs} 中的项目来自哪个确切列?

示例:

我在文件“input.csv”中有一些表格形式的数据,并希望将返回的规则项集与文件中的列标题关联/解释。我怎么可能做到这一点?

任何指针表示赞赏。谢谢,



一个可重现的例子:
input.csv

致电 Apriori:

返回结果:

现在,我想对规则 13 的项目进行区分

13 {0} => {1} 0.6153846 0.6666667 1.083333

{0} => {1}意味着,0in 维度"GHI"的值意味着 in 的值,1反之亦然"JKL"

那么,有没有一种方法可以获取规则对象中返回的项集值的列名/ID?

0 投票
2 回答
11136 浏览

r - R Basket Analysis using arules package with unique order number but duplicate order combinations

R Basket analysis using arules package with unique order number but duplicate order combinations

Just learning R. I'm trying to do a basket analysis using the arules package (but I'm totally open to any other package suggestions!) to compare all possible combinations of 6 different item types being purchased.

My original data set looked like this:

. . .

the list goes on and has about 3,000 observations.

I collapsed the data into a matrix that contains one row for each unique order containing counts of specific ItemType:

Every time I try to read in the transactions using the following command (and a million attempted variations of it):

I get the error message: Error in asMethod(object): can not coerce list with transactions with duplicated items.

I'm assuming this is because I have 3,000 observations and inevitably certain combinations are going to show up more than once (i.e., more than one person is purchasing only one piece of Clothing and nothing else: OrderNo, 0, 1, 0, 0, 0, 0). I know I could collapse the data set on counts of unique combinations, but I'm worried that if I do that, there will be no weights to show the most frequent combinations.

I thought that using format="basket" would account for different orders containing the same item combinations, but apparently that's not the case. I'm so lost. All the documentation I've read implies that this is possible but I can't find any examples or advice on how to approach the problem.

Any advice would be so appreciated! My head is spinning on this one.

Extra info: For my end result, I'm looking to get the top five most significant combinations of purchase combinations. I don't know if that helps.