• Stars
    star
    160
  • Rank 234,703 (Top 5 %)
  • Language
    Java
  • License
    GNU Affero Genera...
  • Created almost 8 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Java library and command-line application for converting LightGBM models to PMML

JPMML-LightGBM Build Status

Java library and command-line application for converting LightGBM models to PMML.

Prerequisites

  • LightGBM 2.0.0 or newer.
  • Java 1.8 or newer.

Installation

Enter the project root directory and build using Apache Maven:

mvn clean install

The build produces a library JAR file pmml-lightgbm/target/pmml-lightgbm-1.4-SNAPSHOT.jar, and an executable uber-JAR file pmml-lightgbm-example/target/pmml-lightgbm-example-executable-1.4-SNAPSHOT.jar.

Usage

A typical workflow can be summarized as follows:

  1. Use LightGBM to train a model.
  2. Save the model to a text file in a local filesystem.
  3. Use the JPMML-LightGBM command-line converter application to turn this text file to a PMML file.

The LightGBM side of operations

Training a binary classification model using the `Audit.csv dataset.

R language

library("lightgbm")

df = read.csv("Audit.csv", stringsAsFactors = TRUE)

# Three continuous features, followed by five categorical features
X = df[c("Age", "Hours", "Income", "Education", "Employment", "Gender", "Marital", "Occupation")]
y = df[["Adjusted"]]

cat_cols = c("Education", "Employment", "Gender", "Marital", "Occupation")
for(cat_col in cat_cols){
	X[[cat_col]] = as.numeric(X[[cat_col]])
}

audit.matrix = as.matrix(X)
audit.ds = lgb.Dataset(data = audit.matrix, label = y, categorical_feature = cat_cols)

audit.lgbm = lgb.train(params = list(objective = "binary"), data = audit.ds, nrounds = 131)
lgb.save(audit.lgbm, "LightGBMAudit.txt")

Python language

import lightgbm
import pandas

df = pandas.read_csv("Audit.csv")

# Three continuous features, followed by five categorical features
X = df[["Age", "Hours", "Income", "Education", "Employment", "Gender", "Marital", "Occupation"]]
y = df["Adjusted"]

cat_cols = ["Education", "Employment", "Gender", "Marital", "Occupation"]

for cat_col in cat_cols:
	X[cat_col] = X[cat_col].astype("category")

audit_ds = lightgbm.Dataset(data = X, label = y, categorical_feature = cat_cols)

audit_booster = lightgbm.train({"objective" : "binary", "num_iterations" : 131}, audit_ds)
audit_booster.save_model("LightGBMAudit.txt")

The JPMML-LightGBM side of operations

Converting the text file LightGBMAudit.txt to a PMML file LightGBMAudit.pmml:

java -jar pmml-lightgbm-example/target/pmml-lightgbm-example-executable-1.4-SNAPSHOT.jar --lgbm-input LightGBMAudit.txt --pmml-output LightGBMAudit.pmml

Getting help:

java -jar pmml-lightgbm-example/target/pmml-lightgbm-example-executable-1.4-SNAPSHOT.jar  --help

Documentation

License

JPMML-LightGBM is licensed under the terms and conditions of the GNU Affero General Public License, Version 3.0.

If you would like to use JPMML-LightGBM in a proprietary software project, then it is possible to enter into a licensing agreement which makes JPMML-LightGBM available under the terms and conditions of the BSD 3-Clause License instead.

Additional information

JPMML-LightGBM is developed and maintained by Openscoring Ltd, Estonia.

Interested in using Java PMML API software in your company? Please contact [email protected]

More Repositories

1

jpmml-evaluator

Java Evaluator API for PMML
Java
864
star
2

sklearn2pmml

Python library for converting Scikit-Learn pipelines to PMML
Python
666
star
3

jpmml-sklearn

Java library and command-line application for converting Scikit-Learn pipelines to PMML
Java
517
star
4

jpmml-sparkml

Java library and command-line application for converting Apache Spark ML pipelines to PMML
Java
265
star
5

jpmml-model

Java Class Model API for PMML
Java
147
star
6

jpmml-xgboost

Java library and command-line application for converting XGBoost models to PMML
Java
122
star
7

jpmml-evaluator-spark

PMML evaluator library for the Apache Spark cluster computing system (http://spark.apache.org/)
Java
94
star
8

pyspark2pmml

Python library for converting Apache Spark ML pipelines to PMML
Python
92
star
9

jpmml

Java PMML API (legacy codebase)
Java
81
star
10

jpmml-tensorflow

Java library and command-line application for converting TensorFlow models to PMML
Java
75
star
11

r2pmml

R library for converting R models to PMML
R
71
star
12

jpmml-sparkml-xgboost

JPMML-SparkML plugin for converting XGBoost4J-Spark models to PMML
Java
36
star
13

jpmml-r

Java library and command-line application for converting R models to PMML
Java
32
star
14

jpmml-android

PMML evaluator library for the Android operating system (http://www.android.com/)
Java
27
star
15

jpmml-transpiler

Java Transpiler (Translator + Compiler) API for PMML
Java
23
star
16

jpmml-h2o

Java library and command-line application for converting H2O.ai models to PMML
Java
20
star
17

sklearn2pmml-plugin

The simplest way to extend sklearn2pmml package with custom transformation and model types
Java
19
star
18

jpmml-evaluator-python

PMML evaluator library for Python
Python
19
star
19

jpmml-converter

Java library for authoring PMML
Java
15
star
20

jpmml-cascading

PMML evaluator library for the Cascading application framework (http://www.cascading.org/)
Java
13
star
21

jpmml-hive

PMML evaluator library for the Apache Hive data warehouse software (legacy codebase)
Java
13
star
22

jpmml-postgresql

PMML evaluator library for the PostgreSQL database (http://www.postgresql.org/)
Java
11
star
23

jpmml-catboost

Java library and command-line application for converting CatBoost models to PMML
Java
7
star
24

jpmml-evaluator-hive

PMML evaluator library for the Apache Hive data warehouse software (http://hive.apache.org/)
Java
6
star
25

sparklyr2pmml

R library for converting Apache Spark ML pipelines to PMML
R
6
star
26

jpmml-statsmodels

Java library and command-line application for converting StatsModels models to PMML
Java
5
star
27

jpmml-storm

PMML evaluator library for the Apache Storm distributed realtime computation system (https://storm.apache.org/)
Java
5
star
28

jpmml-pig

PMML evaluator library for the Apache Pig platform (legacy codebase)
Java
4
star
29

jpmml-sparkml-bootstrap

The simplest way to get started with a JPMML-SparkML powered software project (legacy codebase)
Java
3
star
30

jpmml-python

Java library for converting Python models to PMML
Java
3
star
31

jpmml-example

Example JPMML-enabled software development project (legacy codebase)
Java
2
star
32

jpmml-codevault

Java utilities for protecting Java application code
Java
1
star
33

jpmml-codemodel

Java utilities for generating, compiling and packaging Java application code
Java
1
star