Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for the isofor package #34

Open
jwveld opened this issue Nov 30, 2017 · 5 comments
Open

Add support for the isofor package #34

jwveld opened this issue Nov 30, 2017 · 5 comments

Comments

@jwveld
Copy link

jwveld commented Nov 30, 2017

When trying to convert an Iforest model I get the following errors.

nov 30, 2017 3:06:55 PM org.jpmml.rexp.Main run
INFO: Parsing RDS..
nov 30, 2017 3:06:56 PM org.jpmml.rexp.Main run
INFO: Parsed RDS in 332 ms.
nov 30, 2017 3:06:56 PM org.jpmml.rexp.Main run
INFO: Initializing default Converter
nov 30, 2017 3:06:56 PM org.jpmml.rexp.Main run
INFO: Initialized org.jpmml.rexp.IForestConverter
nov 30, 2017 3:06:56 PM org.jpmml.rexp.Main run
INFO: Converting..
nov 30, 2017 3:06:56 PM org.jpmml.rexp.Main run
SEVERE: Failed to convert
java.lang.IllegalArgumentException: xcols
at org.jpmml.rexp.RVector.getValue(RVector.java:104)
at org.jpmml.rexp.RVector.getValue(RVector.java:80)
at org.jpmml.rexp.IForestConverter.encodeSchema(IForestConverter.java:59)
at org.jpmml.rexp.ModelConverter.encodePMML(ModelConverter.java:74)
at org.jpmml.rexp.ModelConverter.encodePMML(ModelConverter.java:70)
at org.jpmml.rexp.Main.run(Main.java:149)
at org.jpmml.rexp.Main.main(Main.java:97)

Exception in thread "main" java.lang.IllegalArgumentException: xcols
at org.jpmml.rexp.RVector.getValue(RVector.java:104)
at org.jpmml.rexp.RVector.getValue(RVector.java:80)
at org.jpmml.rexp.IForestConverter.encodeSchema(IForestConverter.java:59)
at org.jpmml.rexp.ModelConverter.encodePMML(ModelConverter.java:74)
at org.jpmml.rexp.ModelConverter.encodePMML(ModelConverter.java:70)
at org.jpmml.rexp.Main.run(Main.java:149)
at org.jpmml.rexp.Main.main(Main.java:97)
Error in .convert(tempfile, file, converter, converter_classpath, verbose) :
1
In addition: Warning message:
running command '"java" -cp "J:/R_werk/R/library/r2pmml/java/guava-20.0.jar;J:/R_werk/R/library/r2pmml/java/istack-commons-runtime-3.0.5.jar;J:/R_werk/R/library/r2pmml/java/jaxb-core-2.3.0.jar;J:/R_werk/R/library/r2pmml/java/jaxb-runtime-2.3.0.jar;J:/R_werk/R/library/r2pmml/java/jcommander-1.48.jar;J:/R_werk/R/library/r2pmml/java/jpmml-converter-1.2.6.jar;J:/R_werk/R/library/r2pmml/java/jpmml-r-1.2.20.jar;J:/R_werk/R/library/r2pmml/java/jpmml-xgboost-1.2.3.jar;J:/R_werk/R/library/r2pmml/java/pmml-agent-1.3.8.jar;J:/R_werk/R/library/r2pmml/java/pmml-model-1.3.8.jar;J:/R_werk/R/library/r2pmml/java/pmml-model-metro-1.3.8.jar;J:/R_werk/R/library/r2pmml/java/pmml-schema-1.3.8.jar;J:/R_werk/R/library/r2pmml/java/slf4j-api-1.7.25.jar;J:/R_werk/R/library/r2pmml/java/slf4j-jdk14-1.7.25.jar" org.jpmml.rexp.Main --rds-input "C:\Users\ADMINV~2\AppData\Local\Temp\3\RtmpKAvfFn\r2pmml-3ee2c512c6347.rds" --pmml-output "text.pmml"' had status 1

@vruusmann
Copy link
Member

Reproducible example?

java.lang.IllegalArgumentException: xcols
at org.jpmml.rexp.RVector.getValue(RVector.java:104)

Your iForest model object does not have the xcols element. I've seen the same (or very similar) exception before, and IIRC, the cause was that the training dataset contained non-numeric features.

Since the iForest model object is incomplete/invalid, you shouldn't be able to use it for prediction in R either. Can you verify, the IsolationForest::AnomalyScore function should fail with an error?

@jwveld
Copy link
Author

jwveld commented Dec 1, 2017 via email

@vruusmann
Copy link
Member

I’m using the isofor package in R. And it scores nicely.

The r2pmml package only knows about isolation forest (IF) models that have been trained using the IsolationForest package: https://r-forge.r-project.org/R/?group_id=479

You're using an alternative IF implementation, and it is no wonder that r2pmml can't understand what's going on (the model type is determined based on its R class name, and looks like both IF implementations are producing iForest classes then?).

For your information, the full list of supported R packages/model types is listed in the README file of the JPMML-R library: https://github.com/jpmml/jpmml-r#features

@vruusmann vruusmann changed the title Error converting Isolation Forest Add support for the isofor package Dec 1, 2017
@vruusmann
Copy link
Member

Will try to look into functional differences between IsolationForest and isofor packages mid-December, when I'm back from my very-very long business trip.

@jwveld
Copy link
Author

jwveld commented Dec 1, 2017 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants