I am working with the R programming language. I am using the "CORELS" library in R, here is an example (CORELS is a statistical model that is similar to a decision tree):
library(corels)
logdir <- tempdir()
rules_file <- system.file("sample_data", "compas_train.out", package="corels")
labels_file <- system.file("sample_data", "compas_train.label", package="corels")
meta_file <- system.file("sample_data", "compas_train.minor", package="corels")
stopifnot(file.exists(rules_file),
file.exists(labels_file),
file.exists(meta_file),
dir.exists(logdir))
corels(rules_file, labels_file, logdir, meta_file,
verbosity_policy = "silent",
regularization = 0.015,
curiosity_policy = 2, # by lower bound
map_type = 1) # permutation map
cat("See ", logdir, " for result file.")
The output can be viewed here:
OPTIMAL RULE LIST
if ({sex:Male,juvenile-crimes:>0}) then ({recidivate-within-two-years:Yes})
else if ({priors:>3}) then ({recidivate-within-two-years:Yes})
else ({recidivate-within-two-years:No})
My Question: I am still a bit confused as to how the syntax works for the above functions. For example, I am trying to use the above functions on the "iris" dataset:
data(iris)
head(iris)
Sepal.Length Sepal.Width Petal.Length Petal.Width Species
1 5.1 3.5 1.4 0.2 setosa
2 4.9 3.0 1.4 0.2 setosa
3 4.7 3.2 1.3 0.2 setosa
4 4.6 3.1 1.5 0.2 setosa
5 5.0 3.6 1.4 0.2 setosa
6 5.4 3.9 1.7 0.4 setosa
Now, I tried to apply the "corles" function on the iris data set:
logdir <- tempdir()
rules_file <- iris
labels_file <- colnames(iris)
corels(rules_file, labels_file, logdir,
verbosity_policy = "silent",
regularization = 0.015,
curiosity_policy = 2, # by lower bound
map_type = 1) # permutation map
cat("See ", logdir, " for result file.")
But this produces the following error:
Error in corels(rules_file, labels_file, logdir, verbosity_policy = "silent", :
Expecting a single string value: [type=character; extent=5].
Can someone please show me how to fix this error?
Thanks
References: