R output problem : undefined columns selected

UserBird
UserBird Dataiker, Alpha Tester Posts: 535 Dataiker
edited July 16 in Using Dataiku

Hello

I have a little problem to solve. I 'm not used to with programing with R in the Dataiku environment. I have this error message when I run my code. I tried numerous combination but nothing to do at the moment :

[2016/04/26-21:46:06.171] [Exec-29] [INFO] [dku.utils] - > #dkuWriteDataset(transactions, "rules", partition="produitsgood")

[2016/04/26-21:46:06.174] [Exec-30] [INFO] [dku.utils] - Error in `[.data.frame`(df, i) : undefined columns selected



Thx a lot

_____this is my actual code


install.packages("arules",repos="http://cran.rstudio.com/")
library(dataiku)
library(arules)

# Input datasets
transactions <- dkuReadDataset("produits")


# Transform data to make it suitable
transactions <- as(
split(as.vector(transactions$CodeProduit), as.vector(transactions$NumCli)),
"transactions"
)

# Analyze
rules <- apriori(
transactions,
parameter=list(supp=0.02, conf=0.8, target="rules", minlen=2, maxlen=2)
)

rules <- sort(rules, by ="lift")

# Output datasets


dkuWriteDataset(as(rules, "data.frame"), "produitsgood")


Answers

  • Thomas
    Thomas Dataiker Alumni Posts: 19 ✭✭✭✭✭

    Hi Loman,

    It looks like you may have 0 record in your "rules" dataset, meaning that the levels of support and confidence are too high to find rules. Try decreasing the values in:


    parameter=list(supp=0.02, conf=0.8, target="rules", minlen=2, maxlen=2)

    and this may work.

    Thanks

  • loman
    loman Registered Posts: 4 ✭✭✭✭
    Hello Thomas,


    I decreased the degree of confidence. It works perfectly. I'll look a little more deeply how this algorythm work .

    thanks again
    Merci beaucoup :)
Setup Info
    Tags
      Help me…