Closed jaroslav-kuchar closed 7 years ago
The IsolationForest
algorithm doesn't support categorical (ie. R's factor
data type) variables. If you want to train an isolation forest model for the Iris dataset, then you can use only the first four columns:
data(iris)
iris_vars = iris[, -ncol(iris)]
iForest = IsolationForest::IsolationForest(iris_vars)
Admittedly, the above IllegalArgumentException
should provide an appropriate message.
Also, this is the R script that is used for generating JPMML-R integration tests: https://github.com/jpmml/jpmml-r/blob/master/src/test/R/IsolationForest.R
Thanks for your prompt reply. I did not know about the issues with categorical variables. It works!
I was not able to properly use a conversion of 'IsolationForest::iForest' objects to PMML. For the following code:
I got errors:
Java 1.8 R 3.3.0