Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 205372

Package SBRL in R

$
0
0

I'm trying to use the Scalable Bayesian Rule Lists Model for creating some rule lists in R. I read data into a list, split into train and test and plug into the function with the below code:

adult <- read.csv("E:/adult_csv.csv")
for (name in names(adult)) {adult[name] <- as.factor(adult[,name])}
b = round(2*nrow(adult)/3, digit=0)
data_train <- adult[1:b, ]
data_test <- adult[(b+1):nrow(adult), ]
sbrl_model <- sbrl(data_train, iters=20000,pos_sign="1", neg_sign="2")

but it gives me the following error:

Error in tapply(p, x, eval, simplify = FALSE) :arguments must have same length .

besides that when I use the adult dataset which is defined in R similar to the below code:

data("Adult")
for (name in names(Adult)) {Adult[name] <- as.factor(Adult[,name])}
    b = round(2*nrow(Adult)/3, digit=0)
data_train <- Adult[1:b, ]
data_test <- Adult[(b+1):nrow(Adult), ]
sbrl_model <- sbrl(data_train, iters=20000, pos_sign="1",
               neg_sign="0", rule_minlen=1, rule_maxlen=3, 
               minsupport_pos=0.10, minsupport_neg=0.10, 
               lambda=10.0, eta=1.0, nchain=25)enter code here

I give the following error:

Error in tdata$label : $ operator not defined for this S4 class

I appreciate you if you help me in solving this error.


Viewing all articles
Browse latest Browse all 205372

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>