楼主: wdtention
3339 4

[问答] 做关联分析前数据预处理的问题 [推广有奖]

  • 0关注
  • 0粉丝

小学生

35%

还不是VIP/贵宾

-

威望
0
论坛币
0 个
通用积分
0
学术水平
0 点
热心指数
0 点
信用等级
0 点
经验
52 点
帖子
5
精华
0
在线时间
7 小时
注册时间
2010-1-12
最后登录
2019-5-6

楼主
wdtention 发表于 2016-5-10 21:28:47 |AI写论文

+2 论坛币
k人 参与回答

经管之家送您一份

应届毕业生专属福利!

求职就业群
赵安豆老师微信:zhaoandou666

经管之家联合CDA

送您一个全额奖学金名额~ !

感谢您参与论坛问题回答

经管之家送您两个论坛币!

+2 论坛币
各位大神们,小弟R语言 初学者 在做AR的时候遇到了个问题,想请教下各位。比如我手上有的数据中部分如下
AutomotiveComputersPersonal ElectronicsGardenClothingHealthJewelryHousewares

0

0

0

1

0

0

0

1

1

0

1

1

0

1

0

0

1

1

0

0

0

0

0

1

第一行是项目,下面1代表购买,0代表没有购买,我想要根据这个数据导入R 中做关联分析,可是直接用read.transactions导入的话数据没法做分析会出现以下问题我是需要先把0-1型的数据变成character型的吗?怎么变呢? 在线求,请大神们帮帮我。。。
  1. > catalog<- read.transactions("CatalogCrossSell.csv")
  2. > summary(catalog)
  3. transactions as itemMatrix in sparse format with
  4. 201 rows (elements/itemsets/transactions) and
  5. 88 columns (items) and a density of 0.01142017

  6. most frequent items:
  7. 1,1,1,0,0,1,0,0, 1,1,1,0,0,0,0,1, 0,0,0,1,0,1,0,1, 1,0,0,0,0,1,0,0, 1,1,1,0,0,1,0,1,          (Other)
  8.               16                9                7                7                7              156

  9. element (itemset/transaction) length distribution:
  10. sizes
  11.   1   2
  12. 200   1

  13.    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  14.   1.000   1.000   1.000   1.005   1.000   2.000

  15. includes extended item information - examples:
  16.             labels
  17. 1 0,0,0,0,0,1,0,0,
  18. 2 0,0,0,0,1,0,1,0,
  19. 3 0,0,0,0,1,0,1,1,
复制代码


二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

关键词:数据预处理 关联分析 预处理 Transactions distribution Automotive Health 初学者 项目

沙发
wdtention 发表于 2016-5-10 21:30:44
不好意思 代码没显示出来。。

  1. > catalog<- read.transactions("CatalogCrossSell.csv")
  2. > summary(catalog)
  3. transactions as itemMatrix in sparse format with
  4. 201 rows (elements/itemsets/transactions) and
  5. 88 columns (items) and a density of 0.01142017

  6. most frequent items:
  7. 1,1,1,0,0,1,0,0, 1,1,1,0,0,0,0,1, 0,0,0,1,0,1,0,1, 1,0,0,0,0,1,0,0, 1,1,1,0,0,1,0,1,          (Other)
  8.               16                9                7                7                7              156

  9. element (itemset/transaction) length distribution:
  10. sizes
  11.   1   2
  12. 200   1

  13.    Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  14.   1.000   1.000   1.000   1.005   1.000   2.000

  15. includes extended item information - examples:
  16.             labels
  17. 1 0,0,0,0,0,1,0,0,
  18. 2 0,0,0,0,1,0,1,0,
  19. 3 0,0,0,0,1,0,1,1,
  20. > str(catalog)
  21. Formal class 'transactions' [package "arules"] with 3 slots
  22.   ..@ data       :Formal class 'ngCMatrix' [package "Matrix"] with 5 slots
  23.   .. .. ..@ i       : int [1:202] 86 87 7 56 60 54 40 10 69 66 ...
  24.   .. .. ..@ p       : int [1:202] 0 2 3 4 5 6 7 8 9 10 ...
  25.   .. .. ..@ Dim     : int [1:2] 88 201
  26.   .. .. ..@ Dimnames:List of 2
  27.   .. .. .. ..$ : NULL
  28.   .. .. .. ..$ : NULL
  29.   .. .. ..@ factors : list()
  30.   ..@ itemInfo   :'data.frame':        88 obs. of  1 variable:
  31.   .. ..$ labels: chr [1:88] "0,0,0,0,0,1,0,0," "0,0,0,0,1,0,1,0," "0,0,0,0,1,0,1,1," "0,0,0,0,1,1,0,1," ...
  32.   ..@ itemsetInfo:'data.frame':        0 obs. of  0 variables
复制代码

藤椅
wdtention 发表于 2016-5-10 21:31:59
不好意思,代码没显示出来,这里补上

> catalog<- read.transactions("CatalogCrossSell.csv")
> summary(catalog)
transactions as itemMatrix in sparse format with
201 rows (elements/itemsets/transactions) and
88 columns (items) and a density of 0.01142017

most frequent items:
1,1,1,0,0,1,0,0, 1,1,1,0,0,0,0,1, 0,0,0,1,0,1,0,1, 1,0,0,0,0,1,0,0, 1,1,1,0,0,1,0,1,          (Other)
              16                9                7                7                7              156

element (itemset/transaction) length distribution:
sizes
  1   2
200   1

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  1.000   1.000   1.000   1.005   1.000   2.000

includes extended item information - examples:
            labels
1 0,0,0,0,0,1,0,0,
2 0,0,0,0,1,0,1,0,
3 0,0,0,0,1,0,1,1,
> str(catalog)
Formal class 'transactions' [package "arules"] with 3 slots
  ..@ data       :Formal class 'ngCMatrix' [package "Matrix"] with 5 slots
  .. .. ..@ i       : int [1:202] 86 87 7 56 60 54 40 10 69 66 ...
  .. .. ..@ p       : int [1:202] 0 2 3 4 5 6 7 8 9 10 ...
  .. .. ..@ Dim     : int [1:2] 88 201
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : NULL
  .. .. .. ..$ : NULL
  .. .. ..@ factors : list()
  ..@ itemInfo   :'data.frame':        88 obs. of  1 variable:
  .. ..$ labels: chr [1:88] "0,0,0,0,0,1,0,0," "0,0,0,0,1,0,1,0," "0,0,0,0,1,0,1,1," "0,0,0,0,1,1,0,1," ...
  ..@ itemsetInfo:'data.frame':        0 obs. of  0 variables

板凳
wdtention 发表于 2016-5-10 21:33:03
不好意思 代码没显示出来 ,这里补上

> catalog<- read.transactions("CatalogCrossSell.csv")
> summary(catalog)
transactions as itemMatrix in sparse format with
201 rows (elements/itemsets/transactions) and
88 columns (items) and a density of 0.01142017

most frequent items:
1,1,1,0,0,1,0,0, 1,1,1,0,0,0,0,1, 0,0,0,1,0,1,0,1, 1,0,0,0,0,1,0,0, 1,1,1,0,0,1,0,1,          (Other)
              16                9                7                7                7              156

element (itemset/transaction) length distribution:
sizes
  1   2
200   1

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  1.000   1.000   1.000   1.005   1.000   2.000

includes extended item information - examples:
            labels
1 0,0,0,0,0,1,0,0,
2 0,0,0,0,1,0,1,0,
3 0,0,0,0,1,0,1,1,
> str(catalog)
Formal class 'transactions' [package "arules"] with 3 slots
  ..@ data       :Formal class 'ngCMatrix' [package "Matrix"] with 5 slots
  .. .. ..@ i       : int [1:202] 86 87 7 56 60 54 40 10 69 66 ...
  .. .. ..@ p       : int [1:202] 0 2 3 4 5 6 7 8 9 10 ...
  .. .. ..@ Dim     : int [1:2] 88 201
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : NULL
  .. .. .. ..$ : NULL
  .. .. ..@ factors : list()
  ..@ itemInfo   :'data.frame':        88 obs. of  1 variable:
  .. ..$ labels: chr [1:88] "0,0,0,0,0,1,0,0," "0,0,0,0,1,0,1,0," "0,0,0,0,1,0,1,1," "0,0,0,0,1,1,0,1," ...
  ..@ itemsetInfo:'data.frame':        0 obs. of  0 variables

报纸
wdtention 发表于 2016-5-10 21:34:28
不好意思 代码没显示出来 ,这里补上

> catalog<- read.transactions("CatalogCrossSell.csv")
> summary(catalog)
transactions as itemMatrix in sparse format with
201 rows (elements/itemsets/transactions) and
88 columns (items) and a density of 0.01142017

most frequent items:
1,1,1,0,0,1,0,0, 1,1,1,0,0,0,0,1, 0,0,0,1,0,1,0,1, 1,0,0,0,0,1,0,0, 1,1,1,0,0,1,0,1,          (Other)
              16                9                7                7                7              156

element (itemset/transaction) length distribution:
sizes
  1   2
200   1

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
  1.000   1.000   1.000   1.005   1.000   2.000

includes extended item information - examples:
            labels
1 0,0,0,0,0,1,0,0,
2 0,0,0,0,1,0,1,0,
3 0,0,0,0,1,0,1,1,
> str(catalog)
Formal class 'transactions' [package "arules"] with 3 slots
  ..@ data       :Formal class 'ngCMatrix' [package "Matrix"] with 5 slots
  .. .. ..@ i       : int [1:202] 86 87 7 56 60 54 40 10 69 66 ...
  .. .. ..@ p       : int [1:202] 0 2 3 4 5 6 7 8 9 10 ...
  .. .. ..@ Dim     : int [1:2] 88 201
  .. .. ..@ Dimnames:List of 2
  .. .. .. ..$ : NULL
  .. .. .. ..$ : NULL
  .. .. ..@ factors : list()
  ..@ itemInfo   :'data.frame':        88 obs. of  1 variable:
  .. ..$ labels: chr [1:88] "0,0,0,0,0,1,0,0," "0,0,0,0,1,0,1,0," "0,0,0,0,1,0,1,1," "0,0,0,0,1,1,0,1," ...
  ..@ itemsetInfo:'data.frame':        0 obs. of  0 variables

您需要登录后才可以回帖 登录 | 我要注册

本版微信群
加好友,备注cda
拉您进交流群
GMT+8, 2026-1-20 06:06