Associate tab - show rules problem

瀏覽次數:589 次
跳到第一則未讀訊息

fan zhang

未讀,
2015年1月31日 晚上11:31:332015/1/31
收件者:rattle...@googlegroups.com
Hi everyone:

I am using Rattle version 3.1.2, when I tried to do some association analysis on dvdtrans.csv dataset.

I go to associate tab, when I click show rules button, I get below error:

Error in inspect(sort(crs$apriori, by = "support")) : 
  error in evaluating the argument 'x' in selecting a method for function 'inspect': Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) : 
  unused argument (by = "support")

And the rules are not shown, however, when I click other buttons (e.g. plot, freq plot...), I am able to get the graph and stats...

Then, I tried inspect(crs$transactions), I get below error:

Error in (function (classes, fdef, mtable)  : 
  unable to find an inherited method for function ‘inspect’ for signature ‘"NULL"’

Another problem I encountered is I am not able to load groceries: arules: groceries data set from library, I get below error:

Error in names(crs$dataset) <- gsub("-", ".", names(crs$dataset)) : 
  class 'transactions' has no 'names' slot

I have tried re-installed R, I also tried to copy the code generated from log tab and execute it, still no luck...

Any advise and help is appreciated.

best regards,

Fan

Andreas Wissing

未讀,
2015年2月2日 下午3:50:442015/2/2
收件者:rattle...@googlegroups.com
Hello Fan,
I think, our problem is the same. By using rattle, you get the code of R by using the tab "log".
If you do so, and run the generated R-code by itself, it will work correct. That means, the mistake can just only be in the window of rattle.
Please tell me about the result, when you try it.
Good luck,
Andreas

Graham Williams

未讀,
2015年2月8日 清晨5:50:382015/2/8
收件者:rattle-users
Thanks for the bug reports - could you try the latest Rattle version (3.4.2):

> install.packages("rattle", repos="http://rattle.togaware.com", type="source")

The inspect() problem should be fixed.

The loading of the groceries dataset is another issue - rattle only loads data frames and Groceries is already a transactions dataset, hence Rattle fails to load it into the data tab.

A possible (though a little backward) solution would be to convert the Groceries dataset into a data.frame and then load the data frame into Rattle (R Dataset option of the Data tab). This works:

library(arules)
library(dplyr)
library(tidyr)

data(Groceries)

ds <- as(Groceries, "matrix")             %>% # Convert to a matrix
  as.data.frame()                         %>% # Convert to a data frame
  mutate(basket=1:length(Groceries))      %>% # Add a basket ID column
  gather(item, present, frankfurter:bags) %>% # Pivot the table
  filter(present==1)                      %>% # Keep only the items present
  select(-present)                        %>% # Remove the present column
  arrange(basket)                             # Sort by basket ID

library(rattle)
rattle()

Then select the R Dataset option and then choose "ds" and Execute. Choose basket as the ident and item as the target then Execute (click Yes on the warning about the number of distinct values). Then on the Associate tab tick Baskets and set support to 0.0010 and Min Length to 3 to get some rules. I get 3504 rules including:

     lhs                           rhs                            support confidence       lift
1    {root vegetables,                                                                        
      other vegetables}         => {whole milk}               0.009027081  0.3698630  1.8697357
2    {root vegetables,                                                                        
      whole milk}               => {other vegetables}         0.009027081  0.3253012  2.3001794
3    {other vegetables,                                                                       
      whole milk}               => {root vegetables}          0.009027081  0.2320917  2.7081388
 
...

Graham Williams

--
You received this message because you are subscribed to the Google Groups "rattle-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rattle-users...@googlegroups.com.
To post to this group, send email to rattle...@googlegroups.com.
Visit this group at http://groups.google.com/group/rattle-users.
For more options, visit https://groups.google.com/d/optout.

fan zhang

未讀,
2015年2月10日 清晨6:55:052015/2/10
收件者:rattle...@googlegroups.com
Hi Graham,

Thank you for your reply, I installed Rattle 3.4.2, however the "show rule" issue is still there, when I click show rules I got below error message, as I mentioned I tried to copied the code from log tab and then ran if again still have no luck to get it. I then installed a win xp 32 virtual machine, the issue can not be reproduced on the xp 32 bit vm...my pc is win 7 64 bit os...I have attached the csv file I tried to load...any advice?



 > rattle()

Attaching package: ‘arules’

The following objects are masked from ‘package:base’:

    %in%, write

Error in inspect(sort(crs$apriori, by = "support")) : 
  error in evaluating the argument 'x' in selecting a method for function 'inspect': Error in sort.int(x, na.last = na.last, decreasing = decreasing, ...) : 
  unused argument (by = "support")



best regards,

fan
dvdtrans.csv

fan zhang

未讀,
2015年2月10日 清晨7:02:052015/2/10
收件者:rattle...@googlegroups.com
HI Andreas,

Thank you for your reply, sadly I still have no luck with running the r code on log tab ... T-T...

best regards,

fan 

Graham Williams

未讀,
2015年2月20日 下午4:33:332015/2/20
收件者:rattle-users
Hi Fan,

I've been trying to replicate without success.

Can you tell me the steps you follow to get this error?

Could you make sure all packages are up-to-date:

> update.packages()

Thanks,

Graham Williams

fan zhang

未讀,
2015年3月18日 清晨6:36:132015/3/18
收件者:rattle...@googlegroups.com
Hi Andreas,

I re installed R again yesterday, now I am able to get the rules by running the code generated in "log" tab only, but life will be easier if I can get the rules by just clicking the show rules button on the GUI...thanks a lot anyway, mate :)

best regards,

fan 
回覆所有人
回覆作者
轉寄
0 則新訊息