Java library and command-line application for converting Biogeme discrete choice models to PMML.
Enter the project root directory and build using Apache Maven:
mvn clean install
The build produces a library JAR file pmml-biogeme/target/pmml-biogeme-1.0-SNAPSHOT.jar
, and an executable uber-JAR file pmml-biogeme-example/target/pmml-biogeme-example-executable-1.0-SNAPSHOT.jar
.
A typical workflow can be summarized as follows:
- Use Python to conduct a Biogeme experiment.
- Construct a
dict
holding the Biogeme model and the Biogeme estimation results, and save it inpickle
data format to a file in local filesystem. - Use the JPMML-Biogeme command-line application to turn the Pickle file to a PMML file.
Conducting a Biogeme experiment:
from biogeme.biogeme import BIOGEME
from biogeme.models import loglogit
import joblib
V, availability, Choice = scenario()
model = loglogit(V, availability, Choice)
# Save the model component
# The internal state of the model is modified during the BIOGEME.estimate() method call, rendering it un-pickleable later on
joblib.dump(model, "_model.pkl")
biogeme = BIOGEME(database, model)
results = biogeme.estimate()
# Save the estimation results component
joblib.dump(results, "_results.pkl")
Constructing a dict
holding the Biogeme model and the Biogeme estimation results:
import joblib
experiment = {
"model" : joblib.load("_model.pkl"),
"results" : joblib.load("_results.pkl")
}
joblib.dump(experiment, "experiment.pkl")
Converting the Biogeme experiment Pickle file experiment.pkl
to a PMML file experiment.pmml
:
java -jar pmml-biogeme-example/target/pmml-biogeme-example-executable-1.0-SNAPSHOT.jar --pkl-input experiment.pkl --pmml-output experiment.pmml
Getting help:
java -jar pmml-biogeme-example/target/pmml-biogeme-example-executable-1.0-SNAPSHOT.jar --help
JPMML-Biogeme is licensed under the terms and conditions of the GNU Affero General Public License, Version 3.0.
If you would like to use JPMML-Biogeme in a proprietary software project, then it is possible to enter into a licensing agreement which makes JPMML-Biogeme available under the terms and conditions of the BSD 3-Clause License instead.
JPMML-Biogeme is developed and maintained by Openscoring Ltd, Estonia.
Interested in using Java PMML API software in your company? Please contact info@openscoring.io