Nyoka
Nyoka is a Python library that helps to export ML models into PMML (PMML 4.4.1 Standard).
Install / Use
/learn @SoftwareAG/NyokaREADME
Nyoka
<img src="https://raw.githubusercontent.com/softwareag/nyoka/master/docs/nyoka_logo.PNG" alt="nyoka_logo" height="200" style="float:right"/>
Overview
Nyoka is a Python library for comprehensive support of the latest PMML (PMML 4.4) standard. Using Nyoka, Data Scientists can export a large number of Machine Learning models from popular Python frameworks into PMML by either using any of the numerous included ready-to-use exporters or by creating their own exporter for specialized/individual model types by simply calling a sequence of constructors.
Besides about 500 Python classes which each cover a PMML tag and all constructor parameters/attributes as defined in the standard, Nyoka also provides an increasing number of convenience classes and functions that make the Data Scientist’s life easier for example by reading or writing any PMML file in one line of code from within your favorite Python environment.
Nyoka comes to you with the complete source code in Python, extended HTML documentation for the classes/functions, and a growing number of Jupyter Notebook tutorials that help you familiarize yourself with the way Nyoka supports you in using PMML as your favorite Data Science transport file format.
Read the documentation at Nyoka Documentation.
List of libraries and models supported by Nyoka :
Scikit-Learn (version <= 1.3.0):
Models -
linear_model.LinearRegressionlinear_model.LogisticRegressionlinear_model.RidgeClassifierlinear_model.SGDClassifierdiscriminant_analysis.LinearDiscriminantAnalysistree.DecisionTreeClassifiertree.DecisionTreeRegressorsvm.SVCsvm.SVRsvm.LinearSVCsvm.LinearSVRsvm.OneClassSVMnaive_bayes.GaussianNBensemble.RandomForestRegressorensemble.RandomForestClassifierensemble.GradientBoostingRegressorensemble.GradientBoostingClassifierensemble.IsolationForestneural_network.MLPClassifierneural_network.MLPRegressorneighbors.KNeighborsClassifierneighbors.KNeighborsRegressorcluster.KMeans
Pre-Processing -
preprocessing.StandardScalerpreprocessing.MinMaxScalerpreprocessing.RobustScalerpreprocessing.MaxAbsScalerpreprocessing.LabelEncoderpreprocessing.Imputerpreprocessing.Binarizerpreprocessing.PolynomialFeaturespreprocessing.LabelBinarizerpreprocessing.OneHotEncoderfeature_extraction.text.TfidfVectorizerfeature_extraction.text.CountVectorizerdecomposition.PCAsklearn_pandas.CategoricalImputer( From sklearn_pandas library )
LightGBM:
XGBoost (version <= 1.7.6):
Statsmodels (version <= 0.14.0):
tsa.arima_model.ARIMAtsa.arima.model.ARIMA(Extension of SARIMAX)tsa.statespace.SARIMAXtsa.statespace.VARMAXtsa.statespace.ExponentialSmoothing
Prerequisites
- Python >= 3.6
Dependencies
nyoka requires:
- lxml
Installation
You can install nyoka using:
pip install --upgrade nyoka
Usage
Nyoka contains seperate exporters for each library, e.g., scikit-learn, keras, xgboost etc.
| library | exporter | |--|--| | scikit-learn | skl_to_pmml | | xgboost | xgboost_to_pmml | | lightgbm | lgbm_to_pmml | | statsmodels | StatsmodelsToPmml & ExponentialSmoothingToPmml |
Note - The support of keras is until 4.4.0 release of Nyoka.
The main module of Nyoka is nyoka. To use it for your model, you need to import the specific exporter from nyoka as -
from nyoka import skl_to_pmml, lgb_to_pmml #... so on
