diff --git a/README.md b/README.md index 8570a7f..1d206ed 100644 --- a/README.md +++ b/README.md @@ -50,6 +50,8 @@ Java library and command-line application for converting [R](https://www.r-proje * `cv.glmnet` - Cross-validated GLMNet regression and calculation * [`IsolationForest`](https://r-forge.r-project.org/R/?group_id=479) package: * `iForest` - Isolation Forest (IF) anomaly detection + * [`lightgbm`](https://cran.r-project.org/package=lightgbm) package: + * `lgb.Booster` - LightGBM regression and classification. * [`mlr`](https://cran.r-project.org/package=mlr) package: * `WrappedModel` - Selected JPMML-R model types. * [`neuralnet`](https://cran.r-project.org/package=neuralnet) package: diff --git a/pmml-rexp-example/pom.xml b/pmml-rexp-example/pom.xml index 9c44dc9..921c901 100644 --- a/pmml-rexp-example/pom.xml +++ b/pmml-rexp-example/pom.xml @@ -28,6 +28,10 @@ org.jpmml pmml-rexp + + org.jpmml + pmml-rexp-lightgbm + org.jpmml pmml-rexp-xgboost diff --git a/pmml-rexp-lightgbm/pom.xml b/pmml-rexp-lightgbm/pom.xml new file mode 100644 index 0000000..8a0b3d8 --- /dev/null +++ b/pmml-rexp-lightgbm/pom.xml @@ -0,0 +1,48 @@ + + + 4.0.0 + + + org.jpmml + jpmml-r + 1.6-SNAPSHOT + + + org.jpmml + pmml-rexp-lightgbm + jar + + JPMML R LightGBM converter + JPMML R LightGBM to PMML converter + + + + GNU Affero General Public License (AGPL) version 3.0 + http://www.gnu.org/licenses/agpl-3.0.html + repo + + + + + + org.jpmml + pmml-rexp + + + + org.jpmml + pmml-evaluator-testing + provided + + + + org.jpmml + pmml-lightgbm + + + + junit + junit + + + diff --git a/pmml-rexp-lightgbm/src/main/java/org/jpmml/rexp/lightgbm/LightGBMConverter.java b/pmml-rexp-lightgbm/src/main/java/org/jpmml/rexp/lightgbm/LightGBMConverter.java new file mode 100644 index 0000000..a52411b --- /dev/null +++ b/pmml-rexp-lightgbm/src/main/java/org/jpmml/rexp/lightgbm/LightGBMConverter.java @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2024 Villu Ruusmann + * + * This file is part of JPMML-R + * + * JPMML-R is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * JPMML-R is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with JPMML-R. If not, see . + */ +package org.jpmml.rexp.lightgbm; + +import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.util.Collections; + +import org.dmg.pmml.PMML; +import org.jpmml.lightgbm.GBDT; +import org.jpmml.lightgbm.LightGBMUtil; +import org.jpmml.rexp.Converter; +import org.jpmml.rexp.REnvironment; +import org.jpmml.rexp.RExpEncoder; +import org.jpmml.rexp.RRaw; + +public class LightGBMConverter extends Converter { + + public LightGBMConverter(REnvironment environment){ + super(environment); + } + + @Override + public PMML encodePMML(RExpEncoder encoder){ + REnvironment environment = getObject(); + + RRaw raw = (RRaw)environment.findVariable("raw"); + if(raw == null){ + throw new IllegalArgumentException(); + } + + GBDT gbdt; + + try(InputStream is = new ByteArrayInputStream(raw.getValue())){ + gbdt = LightGBMUtil.loadGBDT(is); + } catch(IOException ioe){ + throw new IllegalArgumentException(ioe); + } + + return gbdt.encodePMML(Collections.emptyMap(), null, null); + } +} \ No newline at end of file diff --git a/pmml-rexp-lightgbm/src/main/resources/META-INF/r2pmml.properties b/pmml-rexp-lightgbm/src/main/resources/META-INF/r2pmml.properties new file mode 100644 index 0000000..ee90292 --- /dev/null +++ b/pmml-rexp-lightgbm/src/main/resources/META-INF/r2pmml.properties @@ -0,0 +1 @@ +lgb.Booster = org.jpmml.rexp.lightgbm.LightGBMConverter \ No newline at end of file diff --git a/pmml-rexp-lightgbm/src/test/R/lightgbm.R b/pmml-rexp-lightgbm/src/test/R/lightgbm.R new file mode 100644 index 0000000..d34198e --- /dev/null +++ b/pmml-rexp-lightgbm/src/test/R/lightgbm.R @@ -0,0 +1,51 @@ +library("lightgbm") + +source("util.R") + +auto = loadAutoCsv("Auto") + +auto_X = auto[, -ncol(auto)] +auto_y = auto[, ncol(auto)] + +auto.matrix = as.matrix(auto_X) + +auto.dset = lgb.Dataset(auto.matrix, label = auto_y) + +generateLightGBMAuto = function(){ + auto.lgbm = lgb.train(params = list(objective = "regression"), data = auto.dset, nrounds = 31) + + mpg = predict(auto.lgbm, auto.matrix) + + storeRds(auto.lgbm, "LightGBMAuto") + storeCsv(data.frame("_target" = mpg), "LightGBMAuto") +} + +set.seed(42) + +generateLightGBMAuto() + +iris = loadIrisCsv("Iris") + +iris_X = iris[, -ncol(iris)] +iris_y = iris[, ncol(iris)] + +# Convert from factor to integer[0, num_class] +iris_y = (as.integer(iris_y) - 1) + +iris.matrix = as.matrix(iris_X) + +iris.dset = lgb.Dataset(iris.matrix, label = iris_y) + +generateLightGBMIris = function(){ + iris.lgbm = lgb.train(params = list(objective = "multiclass", num_class = 3, max_depth = 3), data = iris.dset, nrounds = 5) + + probabilities = predict(iris.lgbm, iris.matrix) + species = max.col(probabilities) - 1 + + storeRds(iris.lgbm, "LightGBMIris") + storeCsv(data.frame("_target" = species, "probability(0)" = probabilities[, 1], "probability(1)" = probabilities[, 2], "probability(2)" = probabilities[, 3], check.names = FALSE), "LightGBMIris") +} + +set.seed(42) + +generateLightGBMIris() diff --git a/pmml-rexp-lightgbm/src/test/R/util.R b/pmml-rexp-lightgbm/src/test/R/util.R new file mode 100644 index 0000000..599ff82 --- /dev/null +++ b/pmml-rexp-lightgbm/src/test/R/util.R @@ -0,0 +1 @@ +source("../../../../pmml-rexp/src/test/R/util.R") \ No newline at end of file diff --git a/pmml-rexp-lightgbm/src/test/java/org/jpmml/rexp/lightgbm/testing/LightGBMConverterTest.java b/pmml-rexp-lightgbm/src/test/java/org/jpmml/rexp/lightgbm/testing/LightGBMConverterTest.java new file mode 100644 index 0000000..0c5e6b2 --- /dev/null +++ b/pmml-rexp-lightgbm/src/test/java/org/jpmml/rexp/lightgbm/testing/LightGBMConverterTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2024 Villu Ruusmann + * + * This file is part of JPMML-R + * + * JPMML-R is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * JPMML-R is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with JPMML-R. If not, see . + */ +package org.jpmml.rexp.lightgbm.testing; + +import org.jpmml.converter.testing.Datasets; +import org.jpmml.rexp.testing.RExpEncoderBatchTest; +import org.junit.Test; + +public class LightGBMConverterTest extends RExpEncoderBatchTest implements Datasets { + + public LightGBMConverterTest(){ + super(); + } + + @Test + public void evaluateAuto() throws Exception { + evaluate("LightGBM", AUTO); + } + + @Test + public void evaluateIris() throws Exception { + evaluate("LightGBM", IRIS); + } +} \ No newline at end of file diff --git a/pmml-rexp-lightgbm/src/test/resources/csv/Auto.csv b/pmml-rexp-lightgbm/src/test/resources/csv/Auto.csv new file mode 100644 index 0000000..92ec293 --- /dev/null +++ b/pmml-rexp-lightgbm/src/test/resources/csv/Auto.csv @@ -0,0 +1,393 @@ +cylinders,displacement,horsepower,weight,acceleration,model_year,origin,mpg +8,307,130,3504,12,70,1,18 +8,350,165,3693,11.5,70,1,15 +8,318,150,3436,11,70,1,18 +8,304,150,3433,12,70,1,16 +8,302,140,3449,10.5,70,1,17 +8,429,198,4341,10,70,1,15 +8,454,220,4354,9,70,1,14 +8,440,215,4312,8.5,70,1,14 +8,455,225,4425,10,70,1,14 +8,390,190,3850,8.5,70,1,15 +8,383,170,3563,10,70,1,15 +8,340,160,3609,8,70,1,14 +8,400,150,3761,9.5,70,1,15 +8,455,225,3086,10,70,1,14 +4,113,95,2372,15,70,3,24 +6,198,95,2833,15.5,70,1,22 +6,199,97,2774,15.5,70,1,18 +6,200,85,2587,16,70,1,21 +4,97,88,2130,14.5,70,3,27 +4,97,46,1835,20.5,70,2,26 +4,110,87,2672,17.5,70,2,25 +4,107,90,2430,14.5,70,2,24 +4,104,95,2375,17.5,70,2,25 +4,121,113,2234,12.5,70,2,26 +6,199,90,2648,15,70,1,21 +8,360,215,4615,14,70,1,10 +8,307,200,4376,15,70,1,10 +8,318,210,4382,13.5,70,1,11 +8,304,193,4732,18.5,70,1,9 +4,97,88,2130,14.5,71,3,27 +4,140,90,2264,15.5,71,1,28 +4,113,95,2228,14,71,3,25 +6,232,100,2634,13,71,1,19 +6,225,105,3439,15.5,71,1,16 +6,250,100,3329,15.5,71,1,17 +6,250,88,3302,15.5,71,1,19 +6,232,100,3288,15.5,71,1,18 +8,350,165,4209,12,71,1,14 +8,400,175,4464,11.5,71,1,14 +8,351,153,4154,13.5,71,1,14 +8,318,150,4096,13,71,1,14 +8,383,180,4955,11.5,71,1,12 +8,400,170,4746,12,71,1,13 +8,400,175,5140,12,71,1,13 +6,258,110,2962,13.5,71,1,18 +4,140,72,2408,19,71,1,22 +6,250,100,3282,15,71,1,19 +6,250,88,3139,14.5,71,1,18 +4,122,86,2220,14,71,1,23 +4,116,90,2123,14,71,2,28 +4,79,70,2074,19.5,71,2,30 +4,88,76,2065,14.5,71,2,30 +4,71,65,1773,19,71,3,31 +4,72,69,1613,18,71,3,35 +4,97,60,1834,19,71,2,27 +4,91,70,1955,20.5,71,1,26 +4,113,95,2278,15.5,72,3,24 +4,97.5,80,2126,17,72,1,25 +4,97,54,2254,23.5,72,2,23 +4,140,90,2408,19.5,72,1,20 +4,122,86,2226,16.5,72,1,21 +8,350,165,4274,12,72,1,13 +8,400,175,4385,12,72,1,14 +8,318,150,4135,13.5,72,1,15 +8,351,153,4129,13,72,1,14 +8,304,150,3672,11.5,72,1,17 +8,429,208,4633,11,72,1,11 +8,350,155,4502,13.5,72,1,13 +8,350,160,4456,13.5,72,1,12 +8,400,190,4422,12.5,72,1,13 +3,70,97,2330,13.5,72,3,19 +8,304,150,3892,12.5,72,1,15 +8,307,130,4098,14,72,1,13 +8,302,140,4294,16,72,1,13 +8,318,150,4077,14,72,1,14 +4,121,112,2933,14.5,72,2,18 +4,121,76,2511,18,72,2,22 +4,120,87,2979,19.5,72,2,21 +4,96,69,2189,18,72,2,26 +4,122,86,2395,16,72,1,22 +4,97,92,2288,17,72,3,28 +4,120,97,2506,14.5,72,3,23 +4,98,80,2164,15,72,1,28 +4,97,88,2100,16.5,72,3,27 +8,350,175,4100,13,73,1,13 +8,304,150,3672,11.5,73,1,14 +8,350,145,3988,13,73,1,13 +8,302,137,4042,14.5,73,1,14 +8,318,150,3777,12.5,73,1,15 +8,429,198,4952,11.5,73,1,12 +8,400,150,4464,12,73,1,13 +8,351,158,4363,13,73,1,13 +8,318,150,4237,14.5,73,1,14 +8,440,215,4735,11,73,1,13 +8,455,225,4951,11,73,1,12 +8,360,175,3821,11,73,1,13 +6,225,105,3121,16.5,73,1,18 +6,250,100,3278,18,73,1,16 +6,232,100,2945,16,73,1,18 +6,250,88,3021,16.5,73,1,18 +6,198,95,2904,16,73,1,23 +4,97,46,1950,21,73,2,26 +8,400,150,4997,14,73,1,11 +8,400,167,4906,12.5,73,1,12 +8,360,170,4654,13,73,1,13 +8,350,180,4499,12.5,73,1,12 +6,232,100,2789,15,73,1,18 +4,97,88,2279,19,73,3,20 +4,140,72,2401,19.5,73,1,21 +4,108,94,2379,16.5,73,3,22 +3,70,90,2124,13.5,73,3,18 +4,122,85,2310,18.5,73,1,19 +6,155,107,2472,14,73,1,21 +4,98,90,2265,15.5,73,2,26 +8,350,145,4082,13,73,1,15 +8,400,230,4278,9.5,73,1,16 +4,68,49,1867,19.5,73,2,29 +4,116,75,2158,15.5,73,2,24 +4,114,91,2582,14,73,2,20 +4,121,112,2868,15.5,73,2,19 +8,318,150,3399,11,73,1,15 +4,121,110,2660,14,73,2,24 +6,156,122,2807,13.5,73,3,20 +8,350,180,3664,11,73,1,11 +6,198,95,3102,16.5,74,1,20 +6,232,100,2901,16,74,1,19 +6,250,100,3336,17,74,1,15 +4,79,67,1950,19,74,3,31 +4,122,80,2451,16.5,74,1,26 +4,71,65,1836,21,74,3,32 +4,140,75,2542,17,74,1,25 +6,250,100,3781,17,74,1,16 +6,258,110,3632,18,74,1,16 +6,225,105,3613,16.5,74,1,18 +8,302,140,4141,14,74,1,16 +8,350,150,4699,14.5,74,1,13 +8,318,150,4457,13.5,74,1,14 +8,302,140,4638,16,74,1,14 +8,304,150,4257,15.5,74,1,14 +4,98,83,2219,16.5,74,2,29 +4,79,67,1963,15.5,74,2,26 +4,97,78,2300,14.5,74,2,26 +4,76,52,1649,16.5,74,3,31 +4,83,61,2003,19,74,3,32 +4,90,75,2125,14.5,74,1,28 +4,90,75,2108,15.5,74,2,24 +4,116,75,2246,14,74,2,26 +4,120,97,2489,15,74,3,24 +4,108,93,2391,15.5,74,3,26 +4,79,67,2000,16,74,2,31 +6,225,95,3264,16,75,1,19 +6,250,105,3459,16,75,1,18 +6,250,72,3432,21,75,1,15 +6,250,72,3158,19.5,75,1,15 +8,400,170,4668,11.5,75,1,16 +8,350,145,4440,14,75,1,15 +8,318,150,4498,14.5,75,1,16 +8,351,148,4657,13.5,75,1,14 +6,231,110,3907,21,75,1,17 +6,250,105,3897,18.5,75,1,16 +6,258,110,3730,19,75,1,15 +6,225,95,3785,19,75,1,18 +6,231,110,3039,15,75,1,21 +8,262,110,3221,13.5,75,1,20 +8,302,129,3169,12,75,1,13 +4,97,75,2171,16,75,3,29 +4,140,83,2639,17,75,1,23 +6,232,100,2914,16,75,1,20 +4,140,78,2592,18.5,75,1,23 +4,134,96,2702,13.5,75,3,24 +4,90,71,2223,16.5,75,2,25 +4,119,97,2545,17,75,3,24 +6,171,97,2984,14.5,75,1,18 +4,90,70,1937,14,75,2,29 +6,232,90,3211,17,75,1,19 +4,115,95,2694,15,75,2,23 +4,120,88,2957,17,75,2,23 +4,121,98,2945,14.5,75,2,22 +4,121,115,2671,13.5,75,2,25 +4,91,53,1795,17.5,75,3,33 +4,107,86,2464,15.5,76,2,28 +4,116,81,2220,16.9,76,2,25 +4,140,92,2572,14.9,76,1,25 +4,98,79,2255,17.7,76,1,26 +4,101,83,2202,15.3,76,2,27 +8,305,140,4215,13,76,1,17.5 +8,318,150,4190,13,76,1,16 +8,304,120,3962,13.9,76,1,15.5 +8,351,152,4215,12.8,76,1,14.5 +6,225,100,3233,15.4,76,1,22 +6,250,105,3353,14.5,76,1,22 +6,200,81,3012,17.6,76,1,24 +6,232,90,3085,17.6,76,1,22.5 +4,85,52,2035,22.2,76,1,29 +4,98,60,2164,22.1,76,1,24.5 +4,90,70,1937,14.2,76,2,29 +4,91,53,1795,17.4,76,3,33 +6,225,100,3651,17.7,76,1,20 +6,250,78,3574,21,76,1,18 +6,250,110,3645,16.2,76,1,18.5 +6,258,95,3193,17.8,76,1,17.5 +4,97,71,1825,12.2,76,2,29.5 +4,85,70,1990,17,76,3,32 +4,97,75,2155,16.4,76,3,28 +4,140,72,2565,13.6,76,1,26.5 +4,130,102,3150,15.7,76,2,20 +8,318,150,3940,13.2,76,1,13 +4,120,88,3270,21.9,76,2,19 +6,156,108,2930,15.5,76,3,19 +6,168,120,3820,16.7,76,2,16.5 +8,350,180,4380,12.1,76,1,16.5 +8,350,145,4055,12,76,1,13 +8,302,130,3870,15,76,1,13 +8,318,150,3755,14,76,1,13 +4,98,68,2045,18.5,77,3,31.5 +4,111,80,2155,14.8,77,1,30 +4,79,58,1825,18.6,77,2,36 +4,122,96,2300,15.5,77,1,25.5 +4,85,70,1945,16.8,77,3,33.5 +8,305,145,3880,12.5,77,1,17.5 +8,260,110,4060,19,77,1,17 +8,318,145,4140,13.7,77,1,15.5 +8,302,130,4295,14.9,77,1,15 +6,250,110,3520,16.4,77,1,17.5 +6,231,105,3425,16.9,77,1,20.5 +6,225,100,3630,17.7,77,1,19 +6,250,98,3525,19,77,1,18.5 +8,400,180,4220,11.1,77,1,16 +8,350,170,4165,11.4,77,1,15.5 +8,400,190,4325,12.2,77,1,15.5 +8,351,149,4335,14.5,77,1,16 +4,97,78,1940,14.5,77,2,29 +4,151,88,2740,16,77,1,24.5 +4,97,75,2265,18.2,77,3,26 +4,140,89,2755,15.8,77,1,25.5 +4,98,63,2051,17,77,1,30.5 +4,98,83,2075,15.9,77,1,33.5 +4,97,67,1985,16.4,77,3,30 +4,97,78,2190,14.1,77,2,30.5 +6,146,97,2815,14.5,77,3,22 +4,121,110,2600,12.8,77,2,21.5 +3,80,110,2720,13.5,77,3,21.5 +4,90,48,1985,21.5,78,2,43.1 +4,98,66,1800,14.4,78,1,36.1 +4,78,52,1985,19.4,78,3,32.8 +4,85,70,2070,18.6,78,3,39.4 +4,91,60,1800,16.4,78,3,36.1 +8,260,110,3365,15.5,78,1,19.9 +8,318,140,3735,13.2,78,1,19.4 +8,302,139,3570,12.8,78,1,20.2 +6,231,105,3535,19.2,78,1,19.2 +6,200,95,3155,18.2,78,1,20.5 +6,200,85,2965,15.8,78,1,20.2 +4,140,88,2720,15.4,78,1,25.1 +6,225,100,3430,17.2,78,1,20.5 +6,232,90,3210,17.2,78,1,19.4 +6,231,105,3380,15.8,78,1,20.6 +6,200,85,3070,16.7,78,1,20.8 +6,225,110,3620,18.7,78,1,18.6 +6,258,120,3410,15.1,78,1,18.1 +8,305,145,3425,13.2,78,1,19.2 +6,231,165,3445,13.4,78,1,17.7 +8,302,139,3205,11.2,78,1,18.1 +8,318,140,4080,13.7,78,1,17.5 +4,98,68,2155,16.5,78,1,30 +4,134,95,2560,14.2,78,3,27.5 +4,119,97,2300,14.7,78,3,27.2 +4,105,75,2230,14.5,78,1,30.9 +4,134,95,2515,14.8,78,3,21.1 +4,156,105,2745,16.7,78,1,23.2 +4,151,85,2855,17.6,78,1,23.8 +4,119,97,2405,14.9,78,3,23.9 +5,131,103,2830,15.9,78,2,20.3 +6,163,125,3140,13.6,78,2,17 +4,121,115,2795,15.7,78,2,21.6 +6,163,133,3410,15.8,78,2,16.2 +4,89,71,1990,14.9,78,2,31.5 +4,98,68,2135,16.6,78,3,29.5 +6,231,115,3245,15.4,79,1,21.5 +6,200,85,2990,18.2,79,1,19.8 +4,140,88,2890,17.3,79,1,22.3 +6,232,90,3265,18.2,79,1,20.2 +6,225,110,3360,16.6,79,1,20.6 +8,305,130,3840,15.4,79,1,17 +8,302,129,3725,13.4,79,1,17.6 +8,351,138,3955,13.2,79,1,16.5 +8,318,135,3830,15.2,79,1,18.2 +8,350,155,4360,14.9,79,1,16.9 +8,351,142,4054,14.3,79,1,15.5 +8,267,125,3605,15,79,1,19.2 +8,360,150,3940,13,79,1,18.5 +4,89,71,1925,14,79,2,31.9 +4,86,65,1975,15.2,79,3,34.1 +4,98,80,1915,14.4,79,1,35.7 +4,121,80,2670,15,79,1,27.4 +5,183,77,3530,20.1,79,2,25.4 +8,350,125,3900,17.4,79,1,23 +4,141,71,3190,24.8,79,2,27.2 +8,260,90,3420,22.2,79,1,23.9 +4,105,70,2200,13.2,79,1,34.2 +4,105,70,2150,14.9,79,1,34.5 +4,85,65,2020,19.2,79,3,31.8 +4,91,69,2130,14.7,79,2,37.3 +4,151,90,2670,16,79,1,28.4 +6,173,115,2595,11.3,79,1,28.8 +6,173,115,2700,12.9,79,1,26.8 +4,151,90,2556,13.2,79,1,33.5 +4,98,76,2144,14.7,80,2,41.5 +4,89,60,1968,18.8,80,3,38.1 +4,98,70,2120,15.5,80,1,32.1 +4,86,65,2019,16.4,80,3,37.2 +4,151,90,2678,16.5,80,1,28 +4,140,88,2870,18.1,80,1,26.4 +4,151,90,3003,20.1,80,1,24.3 +6,225,90,3381,18.7,80,1,19.1 +4,97,78,2188,15.8,80,2,34.3 +4,134,90,2711,15.5,80,3,29.8 +4,120,75,2542,17.5,80,3,31.3 +4,119,92,2434,15,80,3,37 +4,108,75,2265,15.2,80,3,32.2 +4,86,65,2110,17.9,80,3,46.6 +4,156,105,2800,14.4,80,1,27.9 +4,85,65,2110,19.2,80,3,40.8 +4,90,48,2085,21.7,80,2,44.3 +4,90,48,2335,23.7,80,2,43.4 +5,121,67,2950,19.9,80,2,36.4 +4,146,67,3250,21.8,80,2,30 +4,91,67,1850,13.8,80,3,44.6 +4,97,67,2145,18,80,3,33.8 +4,89,62,1845,15.3,80,2,29.8 +6,168,132,2910,11.4,80,3,32.7 +3,70,100,2420,12.5,80,3,23.7 +4,122,88,2500,15.1,80,2,35 +4,107,72,2290,17,80,3,32.4 +4,135,84,2490,15.7,81,1,27.2 +4,151,84,2635,16.4,81,1,26.6 +4,156,92,2620,14.4,81,1,25.8 +6,173,110,2725,12.6,81,1,23.5 +4,135,84,2385,12.9,81,1,30 +4,79,58,1755,16.9,81,3,39.1 +4,86,64,1875,16.4,81,1,39 +4,81,60,1760,16.1,81,3,35.1 +4,97,67,2065,17.8,81,3,32.3 +4,85,65,1975,19.4,81,3,37 +4,89,62,2050,17.3,81,3,37.7 +4,91,68,1985,16,81,3,34.1 +4,105,63,2215,14.9,81,1,34.7 +4,98,65,2045,16.2,81,1,34.4 +4,98,65,2380,20.7,81,1,29.9 +4,105,74,2190,14.2,81,2,33 +4,107,75,2210,14.4,81,3,33.7 +4,108,75,2350,16.8,81,3,32.4 +4,119,100,2615,14.8,81,3,32.9 +4,120,74,2635,18.3,81,3,31.6 +4,141,80,3230,20.4,81,2,28.1 +6,145,76,3160,19.6,81,2,30.7 +6,168,116,2900,12.6,81,3,25.4 +6,146,120,2930,13.8,81,3,24.2 +6,231,110,3415,15.8,81,1,22.4 +8,350,105,3725,19,81,1,26.6 +6,200,88,3060,17.1,81,1,20.2 +6,225,85,3465,16.6,81,1,17.6 +4,112,88,2605,19.6,82,1,28 +4,112,88,2640,18.6,82,1,27 +4,112,88,2395,18,82,1,34 +4,112,85,2575,16.2,82,1,31 +4,135,84,2525,16,82,1,29 +4,151,90,2735,18,82,1,27 +4,140,92,2865,16.4,82,1,24 +4,105,74,1980,15.3,82,2,36 +4,91,68,2025,18.2,82,3,37 +4,91,68,1970,17.6,82,3,31 +4,105,63,2125,14.7,82,1,38 +4,98,70,2125,17.3,82,1,36 +4,120,88,2160,14.5,82,3,36 +4,107,75,2205,14.5,82,3,36 +4,108,70,2245,16.9,82,3,34 +4,91,67,1965,15,82,3,38 +4,91,67,1965,15.7,82,3,32 +4,91,67,1995,16.2,82,3,38 +6,181,110,2945,16.4,82,1,25 +6,262,85,3015,17,82,1,38 +4,156,92,2585,14.5,82,1,26 +6,232,112,2835,14.7,82,1,22 +4,144,96,2665,13.9,82,3,32 +4,135,84,2370,13,82,1,36 +4,151,90,2950,17.3,82,1,27 +4,140,86,2790,15.6,82,1,27 +4,97,52,2130,24.6,82,2,44 +4,135,84,2295,11.6,82,1,32 +4,120,79,2625,18.6,82,1,28 +4,119,82,2720,19.4,82,1,31 diff --git a/pmml-rexp-lightgbm/src/test/resources/csv/Iris.csv b/pmml-rexp-lightgbm/src/test/resources/csv/Iris.csv new file mode 100644 index 0000000..8b63930 --- /dev/null +++ b/pmml-rexp-lightgbm/src/test/resources/csv/Iris.csv @@ -0,0 +1,151 @@ +Sepal.Length,Sepal.Width,Petal.Length,Petal.Width,Species +5.1,3.5,1.4,0.2,setosa +4.9,3,1.4,0.2,setosa +4.7,3.2,1.3,0.2,setosa +4.6,3.1,1.5,0.2,setosa +5,3.6,1.4,0.2,setosa +5.4,3.9,1.7,0.4,setosa +4.6,3.4,1.4,0.3,setosa +5,3.4,1.5,0.2,setosa +4.4,2.9,1.4,0.2,setosa +4.9,3.1,1.5,0.1,setosa +5.4,3.7,1.5,0.2,setosa +4.8,3.4,1.6,0.2,setosa +4.8,3,1.4,0.1,setosa +4.3,3,1.1,0.1,setosa +5.8,4,1.2,0.2,setosa +5.7,4.4,1.5,0.4,setosa +5.4,3.9,1.3,0.4,setosa +5.1,3.5,1.4,0.3,setosa +5.7,3.8,1.7,0.3,setosa +5.1,3.8,1.5,0.3,setosa +5.4,3.4,1.7,0.2,setosa +5.1,3.7,1.5,0.4,setosa +4.6,3.6,1,0.2,setosa +5.1,3.3,1.7,0.5,setosa +4.8,3.4,1.9,0.2,setosa +5,3,1.6,0.2,setosa +5,3.4,1.6,0.4,setosa +5.2,3.5,1.5,0.2,setosa +5.2,3.4,1.4,0.2,setosa +4.7,3.2,1.6,0.2,setosa +4.8,3.1,1.6,0.2,setosa +5.4,3.4,1.5,0.4,setosa +5.2,4.1,1.5,0.1,setosa +5.5,4.2,1.4,0.2,setosa +4.9,3.1,1.5,0.2,setosa +5,3.2,1.2,0.2,setosa +5.5,3.5,1.3,0.2,setosa +4.9,3.6,1.4,0.1,setosa +4.4,3,1.3,0.2,setosa +5.1,3.4,1.5,0.2,setosa +5,3.5,1.3,0.3,setosa +4.5,2.3,1.3,0.3,setosa +4.4,3.2,1.3,0.2,setosa +5,3.5,1.6,0.6,setosa +5.1,3.8,1.9,0.4,setosa +4.8,3,1.4,0.3,setosa +5.1,3.8,1.6,0.2,setosa +4.6,3.2,1.4,0.2,setosa +5.3,3.7,1.5,0.2,setosa +5,3.3,1.4,0.2,setosa +7,3.2,4.7,1.4,versicolor +6.4,3.2,4.5,1.5,versicolor +6.9,3.1,4.9,1.5,versicolor +5.5,2.3,4,1.3,versicolor +6.5,2.8,4.6,1.5,versicolor +5.7,2.8,4.5,1.3,versicolor +6.3,3.3,4.7,1.6,versicolor +4.9,2.4,3.3,1,versicolor +6.6,2.9,4.6,1.3,versicolor +5.2,2.7,3.9,1.4,versicolor +5,2,3.5,1,versicolor +5.9,3,4.2,1.5,versicolor +6,2.2,4,1,versicolor +6.1,2.9,4.7,1.4,versicolor +5.6,2.9,3.6,1.3,versicolor +6.7,3.1,4.4,1.4,versicolor +5.6,3,4.5,1.5,versicolor +5.8,2.7,4.1,1,versicolor +6.2,2.2,4.5,1.5,versicolor +5.6,2.5,3.9,1.1,versicolor +5.9,3.2,4.8,1.8,versicolor +6.1,2.8,4,1.3,versicolor +6.3,2.5,4.9,1.5,versicolor +6.1,2.8,4.7,1.2,versicolor +6.4,2.9,4.3,1.3,versicolor +6.6,3,4.4,1.4,versicolor +6.8,2.8,4.8,1.4,versicolor +6.7,3,5,1.7,versicolor +6,2.9,4.5,1.5,versicolor +5.7,2.6,3.5,1,versicolor +5.5,2.4,3.8,1.1,versicolor +5.5,2.4,3.7,1,versicolor +5.8,2.7,3.9,1.2,versicolor +6,2.7,5.1,1.6,versicolor +5.4,3,4.5,1.5,versicolor +6,3.4,4.5,1.6,versicolor +6.7,3.1,4.7,1.5,versicolor +6.3,2.3,4.4,1.3,versicolor +5.6,3,4.1,1.3,versicolor +5.5,2.5,4,1.3,versicolor +5.5,2.6,4.4,1.2,versicolor +6.1,3,4.6,1.4,versicolor +5.8,2.6,4,1.2,versicolor +5,2.3,3.3,1,versicolor +5.6,2.7,4.2,1.3,versicolor +5.7,3,4.2,1.2,versicolor +5.7,2.9,4.2,1.3,versicolor +6.2,2.9,4.3,1.3,versicolor +5.1,2.5,3,1.1,versicolor +5.7,2.8,4.1,1.3,versicolor +6.3,3.3,6,2.5,virginica +5.8,2.7,5.1,1.9,virginica +7.1,3,5.9,2.1,virginica +6.3,2.9,5.6,1.8,virginica +6.5,3,5.8,2.2,virginica +7.6,3,6.6,2.1,virginica +4.9,2.5,4.5,1.7,virginica +7.3,2.9,6.3,1.8,virginica +6.7,2.5,5.8,1.8,virginica +7.2,3.6,6.1,2.5,virginica +6.5,3.2,5.1,2,virginica +6.4,2.7,5.3,1.9,virginica +6.8,3,5.5,2.1,virginica +5.7,2.5,5,2,virginica +5.8,2.8,5.1,2.4,virginica +6.4,3.2,5.3,2.3,virginica +6.5,3,5.5,1.8,virginica +7.7,3.8,6.7,2.2,virginica +7.7,2.6,6.9,2.3,virginica +6,2.2,5,1.5,virginica +6.9,3.2,5.7,2.3,virginica +5.6,2.8,4.9,2,virginica +7.7,2.8,6.7,2,virginica +6.3,2.7,4.9,1.8,virginica +6.7,3.3,5.7,2.1,virginica +7.2,3.2,6,1.8,virginica +6.2,2.8,4.8,1.8,virginica +6.1,3,4.9,1.8,virginica +6.4,2.8,5.6,2.1,virginica +7.2,3,5.8,1.6,virginica +7.4,2.8,6.1,1.9,virginica +7.9,3.8,6.4,2,virginica +6.4,2.8,5.6,2.2,virginica +6.3,2.8,5.1,1.5,virginica +6.1,2.6,5.6,1.4,virginica +7.7,3,6.1,2.3,virginica +6.3,3.4,5.6,2.4,virginica +6.4,3.1,5.5,1.8,virginica +6,3,4.8,1.8,virginica +6.9,3.1,5.4,2.1,virginica +6.7,3.1,5.6,2.4,virginica +6.9,3.1,5.1,2.3,virginica +5.8,2.7,5.1,1.9,virginica +6.8,3.2,5.9,2.3,virginica +6.7,3.3,5.7,2.5,virginica +6.7,3,5.2,2.3,virginica +6.3,2.5,5,1.9,virginica +6.5,3,5.2,2,virginica +6.2,3.4,5.4,2.3,virginica +5.9,3,5.1,1.8,virginica diff --git a/pmml-rexp-lightgbm/src/test/resources/csv/LightGBMAuto.csv b/pmml-rexp-lightgbm/src/test/resources/csv/LightGBMAuto.csv new file mode 100644 index 0000000..921e185 --- /dev/null +++ b/pmml-rexp-lightgbm/src/test/resources/csv/LightGBMAuto.csv @@ -0,0 +1,393 @@ +_target +16.7818591527052 +14.9006306033041 +16.5353885849459 +16.4578731304756 +16.4578731304756 +14.2592095802219 +14.2592095802219 +14.2592095802219 +13.1582340410855 +14.2690525651382 +15.5598733320242 +14.9770334323484 +15.1272664008278 +15.5908540627382 +23.6450729986603 +21.6519733022898 +19.5526673787362 +21.7704032422683 +25.682512976102 +28.7108185198035 +23.4617826743134 +24.0127554999152 +23.601198353898 +23.669309389826 +21.9280546899954 +12.1473258578817 +12.2039933555578 +12.5277921727972 +12.1339039732816 +25.682512976102 +25.1039307747116 +24.501735100712 +20.481150142178 +18.0178431382505 +17.3085532208348 +18.7726379188049 +17.9813850745041 +14.4289801340003 +13.3153440329556 +13.8746287335455 +14.9448055901611 +12.9849357806765 +13.3153440329556 +13.3153440329556 +18.8617653002631 +22.2019385162214 +17.6491462662604 +18.8230127809608 +24.8093601696816 +25.594574616783 +29.713866382334 +28.5657715146502 +29.7810999405846 +30.1531197395752 +28.7108185198035 +28.1444775149484 +24.0048365598389 +25.0245692561696 +24.2788332095049 +21.3912027404816 +23.5642037394093 +14.3760128416 +13.4356750009643 +14.3524550787619 +14.3744529733986 +15.7629767938546 +12.9319684882761 +12.7695839599089 +12.6425847059287 +13.1052667486851 +21.9804629115356 +15.3132392594873 +14.2819270767532 +13.8313773310162 +13.994857843157 +19.8281904257817 +22.7581923489091 +20.9965785789919 +25.5044414919061 +23.2453987536275 +23.9609619150766 +21.8714326592644 +25.8236434489083 +25.2902600840098 +13.923631919551 +15.5007063934635 +14.2813671702878 +13.9835637532874 +15.1284843135666 +12.9021159728858 +13.6744615827777 +13.6083289952777 +13.9522488022646 +12.9021159728858 +12.9021159728858 +14.1356553761454 +18.3102715145353 +17.1422689249135 +18.8839438086429 +18.9811846157266 +21.007523105584 +28.0629391361789 +12.6857122622468 +13.2068249195282 +12.954967292687 +12.8074984221612 +19.2037502172668 +23.461269371404 +21.5955458249211 +22.970274802512 +24.8517593324463 +21.2274605303168 +21.2750252742355 +24.2576522591653 +14.405655800635 +14.0939598234144 +29.13322055696 +25.0195360935275 +22.4717919153834 +19.6081157620063 +16.2500034075448 +21.7359037209745 +19.6970465983776 +14.3504216548695 +20.0374038413725 +19.2351176158721 +17.1608800415584 +30.2500727567814 +24.6194517824234 +30.5554390810754 +24.1747008783595 +16.6093582415742 +16.7814848231387 +17.531406940763 +14.7068032615452 +13.846951413457 +14.3795419549828 +13.9996797148844 +14.3616103316225 +26.4834350182273 +29.1026635904123 +26.2748351588932 +30.4815569409714 +30.5554390810754 +27.0647815241699 +26.3389337386145 +26.1100139547544 +23.5301152492405 +24.5837423786933 +30.1761906166774 +19.44191893241 +17.637285566376 +17.1228475791685 +17.30449761475 +15.1295823284337 +14.3616946283999 +14.4987370530722 +14.7037228271278 +17.0053767135314 +16.9953745779864 +16.623424378549 +16.8253754011931 +19.569934535665 +18.1288738002139 +16.7061002832553 +26.9695100906539 +23.7366656903423 +19.7420479133728 +23.0407589760425 +23.5017519829192 +27.0478001887729 +23.7534800336804 +20.7041935331269 +29.641929152589 +18.8364352050204 +23.6348713550494 +21.8222135771888 +21.4997808676784 +23.1664620532824 +31.3280421144436 +25.2520169531608 +25.4769573925814 +24.7882590841996 +26.0101781156496 +26.9620361337914 +16.0588986511722 +15.9262507259372 +16.5563008413348 +15.3549152038192 +20.3771501320176 +19.489311504404 +21.5453547155325 +20.5423925048561 +29.3289195391634 +26.3278681263575 +29.641929152589 +31.3280421144436 +18.8089124545085 +18.4160278508168 +18.0145417193385 +19.2223358877995 +29.0623740608945 +30.8383514885566 +26.9695100906539 +25.6725387687614 +20.9911700566435 +15.2783995396276 +21.1388228661888 +20.1407962733672 +16.681587238989 +14.7302558310667 +15.4057899386433 +14.9805184667427 +14.8628933122594 +31.3246791227942 +29.8210780161375 +33.2209018044435 +25.6875086294969 +32.4844814609529 +17.1068512101182 +17.602595863708 +16.2296072177297 +16.1251667649286 +18.5674977429188 +19.5265782974738 +19.1970629039661 +18.9212884865356 +16.2810947064955 +16.4245526150078 +16.3471148542715 +15.9053493183236 +30.4458915172385 +23.5876299826601 +27.1544938542056 +23.6324997503371 +31.4882060341552 +30.9181038239177 +30.9331852318364 +29.0713732711844 +21.3710741652827 +23.3156687775802 +23.100677275427 +36.3119764123324 +34.1625199890251 +36.3119764123324 +35.1268859075167 +35.4989709829319 +19.6513341032469 +17.5901284139651 +18.3345613228622 +20.1291032425162 +19.7429558137996 +21.9225560934064 +24.6849279703146 +20.3828733608337 +20.3989562168624 +20.4607847703693 +21.0536737576962 +19.3480423595869 +18.9220066018378 +18.169451615045 +18.0481036802306 +18.4287843915038 +17.0251030663353 +32.2640858167741 +25.1971545550863 +26.5595076206506 +30.917150761788 +24.9945444139215 +22.3957599730367 +21.9920585847057 +24.8747725312547 +21.648778555477 +19.0968788659579 +21.2186222159243 +18.7274744302546 +31.7876472580678 +31.8590715828043 +21.2870633510222 +21.8223641011505 +25.1827322546638 +20.6529541754186 +21.1218417744318 +18.1478876230035 +19.1049536628379 +18.0627722378089 +18.1478876230035 +16.8211119936227 +16.9305618565235 +20.6995715301936 +17.3737223054538 +33.3974841078013 +34.8470202205815 +33.6549079479393 +28.6567579692736 +24.2215209159083 +19.284342654461 +25.1827858354815 +20.7673672652945 +33.9260941413117 +33.7234840001469 +36.7089561519589 +34.0995751050303 +27.7071423278051 +26.0788818245103 +25.8474537851271 +29.8773228445574 +35.2656784302521 +38.3017887730656 +33.1824099041118 +37.2969246274818 +27.6853215644497 +26.7054455415289 +26.7054455415289 +21.9078142951931 +34.3188351426002 +30.2077836583319 +32.0208792536517 +31.8979430162346 +33.8975808265068 +38.6269326543313 +26.5440570540012 +38.6269326543313 +38.4484317209138 +38.3699676248624 +32.7762316089964 +30.0950327881463 +37.3578354480446 +36.9563386609055 +37.2969246274818 +25.8494942673442 +30.2471887669967 +31.7932549053308 +33.9107299733662 +29.4584292484658 +28.3883302612826 +27.4490409233468 +25.7678146708193 +30.3391979483787 +37.1456281259641 +35.3849458697754 +36.7798691987762 +36.1141393509343 +37.78473334436 +37.3536793251634 +34.491324186896 +34.9552574567863 +34.6998718019874 +31.1570787104729 +34.7486230015465 +34.7486230015465 +33.1856233454613 +28.9810249728821 +30.764989780045 +27.9529598150762 +27.234050609364 +25.6743430732585 +26.4532342009712 +22.2610175631858 +22.2957304282346 +22.7647535452832 +22.3697355632193 +28.7755792155234 +28.7755792155234 +30.6993618234715 +30.1100503343499 +29.863902089863 +27.9394586168737 +27.5022940105672 +34.0276276401983 +35.6188610007073 +35.237600710785 +35.8203054688172 +33.971027955446 +33.5177451681741 +34.9210893990483 +34.5399146816858 +36.8106362756761 +36.0664031291889 +36.0664031291889 +25.2342027637157 +24.7458420782569 +27.854513764744 +23.7554590232925 +30.0091339659313 +32.2687625823026 +27.8531267508086 +27.8363962668662 +37.5474758260652 +32.2687625823026 +29.3233455240934 +29.2869369629784 diff --git a/pmml-rexp-lightgbm/src/test/resources/csv/LightGBMIris.csv b/pmml-rexp-lightgbm/src/test/resources/csv/LightGBMIris.csv new file mode 100644 index 0000000..acec8a6 --- /dev/null +++ b/pmml-rexp-lightgbm/src/test/resources/csv/LightGBMIris.csv @@ -0,0 +1,151 @@ +_target,probability(0),probability(1),probability(2) +0,0.622633282295476,0.188648242913814,0.18871847479071 +0,0.615197477194297,0.189575692988895,0.195226829816808 +0,0.615197477194297,0.189575692988895,0.195226829816808 +0,0.61562785952295,0.189008733088411,0.195363407388639 +0,0.627804126644017,0.186063301913541,0.186132571442442 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.624284860237993,0.185020291362912,0.190694848399095 +0,0.628235185422274,0.185504442002041,0.186260372575685 +0,0.615197477194297,0.189575692988895,0.195226829816808 +0,0.61562785952295,0.189008733088411,0.195363407388639 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.624711098169576,0.184463854249958,0.190825047580466 +0,0.615197477194297,0.189575692988895,0.195226829816808 +0,0.615197477194297,0.189575692988895,0.195226829816808 +0,0.622633282295476,0.188648242913814,0.18871847479071 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.622633282295476,0.188648242913814,0.18871847479071 +0,0.622633282295476,0.188648242913814,0.18871847479071 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.624284860237993,0.185020291362912,0.190694848399095 +0,0.524918987703595,0.309654193787851,0.165426818508554 +0,0.55967501529161,0.269365941823531,0.170959042884858 +0,0.619183778101388,0.190100463514641,0.190715758383971 +0,0.628235185422274,0.185504442002041,0.186260372575685 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.622633282295476,0.188648242913814,0.18871847479071 +0,0.61562785952295,0.189008733088411,0.195363407388639 +0,0.61562785952295,0.189008733088411,0.195363407388639 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.622633282295476,0.188648242913814,0.18871847479071 +0,0.61562785952295,0.189008733088411,0.195363407388639 +0,0.618748411322396,0.190669928292268,0.190581660385336 +0,0.622633282295476,0.188648242913814,0.18871847479071 +0,0.624284860237993,0.185020291362912,0.190694848399095 +0,0.615197477194297,0.189575692988895,0.195226829816808 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.627804126644017,0.186063301913541,0.186132571442442 +0,0.6135115014687,0.189056152469971,0.197432346061329 +0,0.615197477194297,0.189575692988895,0.195226829816808 +0,0.54011673811946,0.299748415550859,0.160134846329681 +0,0.557063885690191,0.274091547439145,0.168844566870663 +0,0.615197477194297,0.189575692988895,0.195226829816808 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.615197477194297,0.189575692988895,0.195226829816808 +0,0.623066734127513,0.188083412996212,0.188849852876275 +0,0.618649889819595,0.190639568476339,0.190710541704066 +1,0.198863029412316,0.582475679978554,0.21866129060913 +1,0.198737373205117,0.582567039742763,0.21869558705212 +1,0.187740699545955,0.461171376848219,0.351087923605826 +1,0.197131641943226,0.602711106042645,0.200157252014129 +1,0.198737373205117,0.582567039742763,0.21869558705212 +1,0.200743591066014,0.578527333078483,0.220729075855502 +1,0.198737373205117,0.582567039742763,0.21869558705212 +1,0.195943824022636,0.599079466567426,0.204976709409937 +1,0.198863029412316,0.582475679978554,0.21866129060913 +1,0.197131641943226,0.602711106042645,0.200157252014129 +1,0.197131641943226,0.602711106042645,0.200157252014129 +1,0.193050787903228,0.61384115164144,0.193108060455331 +1,0.19258441955892,0.61187534235616,0.19554023808492 +1,0.198863029412316,0.582475679978554,0.21866129060913 +1,0.19768087218682,0.604390324885067,0.197928802928113 +1,0.193349005805454,0.614304570392521,0.192346423802025 +1,0.203200062484201,0.573193495318618,0.223606442197182 +1,0.19258441955892,0.61187534235616,0.19554023808492 +1,0.19805094523542,0.580554885189978,0.221394169574602 +1,0.197131641943226,0.602711106042645,0.200157252014129 +2,0.185897905124093,0.308902629466207,0.5051994654097 +1,0.19310857023872,0.613540663348292,0.193350766412987 +1,0.187740699545955,0.461171376848219,0.351087923605826 +1,0.198863029412316,0.582475679978554,0.21866129060913 +1,0.193349005805454,0.614304570392521,0.192346423802025 +1,0.193349005805454,0.614304570392521,0.192346423802025 +1,0.172510987661764,0.505136096660039,0.322352915678197 +2,0.204217617879074,0.240796938304973,0.554985443815953 +1,0.198737373205117,0.582567039742763,0.21869558705212 +1,0.194498442640323,0.608017919440571,0.197483637919106 +1,0.197131641943226,0.602711106042645,0.200157252014129 +1,0.197131641943226,0.602711106042645,0.200157252014129 +1,0.19258441955892,0.61187534235616,0.19554023808492 +1,0.202040563722795,0.420129790531035,0.37782964574617 +1,0.203200062484201,0.573193495318618,0.223606442197182 +1,0.198737373205117,0.582567039742763,0.21869558705212 +1,0.198737373205117,0.582567039742763,0.21869558705212 +1,0.192761405203854,0.612437657585681,0.194800937210465 +1,0.19768087218682,0.604390324885067,0.197928802928113 +1,0.197131641943226,0.602711106042645,0.200157252014129 +1,0.197317088104206,0.603278089910347,0.199404821985447 +1,0.198863029412316,0.582475679978554,0.21866129060913 +1,0.19258441955892,0.61187534235616,0.19554023808492 +1,0.197131641943226,0.602711106042645,0.200157252014129 +1,0.197131641943226,0.602711106042645,0.200157252014129 +1,0.195099528602406,0.609896962949143,0.19500350844845 +1,0.195099528602406,0.609896962949143,0.19500350844845 +1,0.193349005805454,0.614304570392521,0.192346423802025 +0,0.438435157590645,0.42156520914886,0.139999633260495 +1,0.195033078222709,0.609689233668327,0.195277688108964 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.204217617879074,0.240796938304973,0.554985443815953 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.187343701859718,0.186429056181168,0.626227241959113 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.233583729024925,0.373622353878959,0.392793917096116 +2,0.187343701859718,0.186429056181168,0.626227241959113 +2,0.187343701859718,0.186429056181168,0.626227241959113 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.204217617879074,0.240796938304973,0.554985443815953 +2,0.184501867033402,0.216928772348764,0.598569360617834 +2,0.184961303446186,0.189140699966861,0.625897996586953 +2,0.204217617879074,0.240796938304973,0.554985443815953 +2,0.202827649050771,0.239157999208186,0.558014351741043 +2,0.183148195061159,0.215337187375542,0.601514617563299 +2,0.18638421919467,0.190595768003514,0.623020012801816 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.18590615491454,0.184998527598967,0.629095317486493 +1,0.202040563722795,0.420129790531035,0.37782964574617 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.196853989229713,0.268172095619219,0.534973915151068 +2,0.187343701859718,0.186429056181168,0.626227241959113 +2,0.195675276561637,0.272554098875139,0.531770624563225 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.187343701859718,0.186429056181168,0.626227241959113 +2,0.185897905124093,0.308902629466207,0.5051994654097 +2,0.195675276561637,0.272554098875139,0.531770624563225 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.194311231905447,0.371897610269691,0.433791157824861 +2,0.187343701859718,0.186429056181168,0.626227241959113 +2,0.187343701859718,0.186429056181168,0.626227241959113 +2,0.18590615491454,0.184998527598967,0.629095317486493 +1,0.202040563722795,0.420129790531035,0.37782964574617 +2,0.194311231905447,0.371897610269691,0.433791157824861 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.18638421919467,0.190595768003514,0.623020012801816 +2,0.185897905124093,0.308902629466207,0.5051994654097 +2,0.184961303446186,0.189140699966861,0.625897996586953 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.202827649050771,0.239157999208186,0.558014351741043 +2,0.204217617879074,0.240796938304973,0.554985443815953 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.18590615491454,0.184998527598967,0.629095317486493 +2,0.183148195061159,0.215337187375542,0.601514617563299 +2,0.204217617879074,0.240796938304973,0.554985443815953 +2,0.184501867033402,0.216928772348764,0.598569360617834 +2,0.184961303446186,0.189140699966861,0.625897996586953 +2,0.204217617879074,0.240796938304973,0.554985443815953 diff --git a/pmml-rexp-lightgbm/src/test/resources/rds/LightGBMAuto.rds b/pmml-rexp-lightgbm/src/test/resources/rds/LightGBMAuto.rds new file mode 100644 index 0000000..73455f9 Binary files /dev/null and b/pmml-rexp-lightgbm/src/test/resources/rds/LightGBMAuto.rds differ diff --git a/pmml-rexp-lightgbm/src/test/resources/rds/LightGBMIris.rds b/pmml-rexp-lightgbm/src/test/resources/rds/LightGBMIris.rds new file mode 100644 index 0000000..46f63d5 Binary files /dev/null and b/pmml-rexp-lightgbm/src/test/resources/rds/LightGBMIris.rds differ diff --git a/pmml-rexp/src/main/java/org/jpmml/rexp/ConverterFactory.java b/pmml-rexp/src/main/java/org/jpmml/rexp/ConverterFactory.java index 99c3e15..1582885 100644 --- a/pmml-rexp/src/main/java/org/jpmml/rexp/ConverterFactory.java +++ b/pmml-rexp/src/main/java/org/jpmml/rexp/ConverterFactory.java @@ -53,7 +53,13 @@ public Converter newConverter(R rexp){ public Converter newConverter(Class> clazz, R rexp){ try { - Constructor constructor = clazz.getDeclaredConstructor(rexp.getClass()); + Class rexpClazz = rexp.getClass(); + + while(rexpClazz.isAnonymousClass()){ + rexpClazz = (Class)rexpClazz.getSuperclass(); + } + + Constructor constructor = clazz.getDeclaredConstructor(rexpClazz); return (Converter)constructor.newInstance(rexp); } catch(Exception e){ diff --git a/pom.xml b/pom.xml index 60fa281..00b9ef6 100644 --- a/pom.xml +++ b/pom.xml @@ -35,6 +35,7 @@ pmml-rexp pmml-rexp-example + pmml-rexp-lightgbm pmml-rexp-xgboost @@ -65,6 +66,11 @@ pmml-rexp-example 1.6-SNAPSHOT + + org.jpmml + pmml-rexp-lightgbm + 1.6-SNAPSHOT + org.jpmml pmml-rexp-xgboost @@ -88,6 +94,12 @@ 1.6.5 + + org.jpmml + pmml-lightgbm + 1.5.4 + + org.jpmml pmml-xgboost