0

this is under package arules.

so when i use unsupervised discretization of continuous variables function

df2 <- discretizeDF(df, default = list(method = "cluster", breaks = 4, labels=c("-1", "-0.5","0","0.5")))

i was able to get output of my variables in the aforementioned labels -1, -0.5, 0, 0.5.

but for supervised discretization function under arulesCBA package

df2 <- discretizeDF.supervised(df1, default = list(method = "caim", breaks = 3, labels=c("-1", "0","+1")))

the output of my continuous variables are intervals. e.g [1,18] [18,97] [97,infinite] . how can i convert the intervals to discrete values like -1, 0, +1?

thank you very much in advance. i just started using r and learning ml this recent mth. am msc finance student and am doing this for my master thesis. pls help . <3

danny guy
  • 1
  • 1
  • welcome to stack overflow. To increase your chances of getting help please provide some reproducible example. I would suggest [this](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) post to help you do it. We need some data to play with to understand your issue. I don't know the package your are using but consider [this](https://github.com/ianjjohnson/arulesCBA) resource as well as [this](https://journal.r-project.org/archive/2019/RJ-2019-048/) one. – DJJ Jul 09 '20 at 20:40

1 Answers1

0

It looks like you do not use discretizeDF.supervised as described in the manual page:

discretizeDF.supervised(formula, data, method = "mdlp", dig.lab = 3, ...)

You need a formula. Also, this function can not set labels since some methods create a different number of categories.

Michael Hahsler
  • 2,965
  • 1
  • 12
  • 16