All Projects → SoftwareAG → Nyoka

SoftwareAG / Nyoka

Licence: apache-2.0
Nyoka is a Python library to export ML/DL models into PMML (PMML 4.4.1 Standard).

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Nyoka

Mars
Mars is a tensor-based unified framework for large-scale data computation which scales numpy, pandas, scikit-learn and Python functions.
Stars: ✭ 2,308 (+1717.32%)
Mutual labels:  scikit-learn, xgboost, lightgbm
Hyperparameter hunter
Easy hyperparameter optimization and automatic result saving across machine learning algorithms and libraries
Stars: ✭ 648 (+410.24%)
Mutual labels:  scikit-learn, xgboost, lightgbm
M2cgen
Transform ML models into a native code (Java, C, Python, Go, JavaScript, Visual Basic, C#, R, PowerShell, PHP, Dart, Haskell, Ruby, F#, Rust) with zero dependencies
Stars: ✭ 1,962 (+1444.88%)
Mutual labels:  scikit-learn, xgboost, lightgbm
Openscoring
REST web service for the true real-time scoring (<1 ms) of Scikit-Learn, R and Apache Spark models
Stars: ✭ 536 (+322.05%)
Mutual labels:  scikit-learn, xgboost, lightgbm
ai-deployment
关注AI模型上线、模型部署
Stars: ✭ 149 (+17.32%)
Mutual labels:  scikit-learn, xgboost, lightgbm
Eli5
A library for debugging/inspecting machine learning classifiers and explaining their predictions
Stars: ✭ 2,477 (+1850.39%)
Mutual labels:  scikit-learn, xgboost, lightgbm
Adversarial Robustness Toolbox
Adversarial Robustness Toolbox (ART) - Python Library for Machine Learning Security - Evasion, Poisoning, Extraction, Inference - Red and Blue Teams
Stars: ✭ 2,638 (+1977.17%)
Mutual labels:  scikit-learn, xgboost, lightgbm
Mljar Supervised
Automated Machine Learning Pipeline with Feature Engineering and Hyper-Parameters Tuning 🚀
Stars: ✭ 961 (+656.69%)
Mutual labels:  scikit-learn, xgboost, lightgbm
datascienv
datascienv is package that helps you to setup your environment in single line of code with all dependency and it is also include pyforest that provide single line of import all required ml libraries
Stars: ✭ 53 (-58.27%)
Mutual labels:  scikit-learn, xgboost, lightgbm
AutoTabular
Automatic machine learning for tabular data. ⚡🔥⚡
Stars: ✭ 51 (-59.84%)
Mutual labels:  scikit-learn, xgboost, lightgbm
Arch-Data-Science
Archlinux PKGBUILDs for Data Science, Machine Learning, Deep Learning, NLP and Computer Vision
Stars: ✭ 92 (-27.56%)
Mutual labels:  scikit-learn, xgboost, lightgbm
Auto ml
[UNMAINTAINED] Automated machine learning for analytics & production
Stars: ✭ 1,559 (+1127.56%)
Mutual labels:  scikit-learn, xgboost, lightgbm
My Data Competition Experience
本人多次机器学习与大数据竞赛Top5的经验总结,满满的干货,拿好不谢
Stars: ✭ 271 (+113.39%)
Mutual labels:  xgboost, lightgbm
Leaves
pure Go implementation of prediction part for GBRT (Gradient Boosting Regression Trees) models from popular frameworks
Stars: ✭ 261 (+105.51%)
Mutual labels:  xgboost, lightgbm
Autoviz
Automatically Visualize any dataset, any size with a single line of code. Created by Ram Seshadri. Collaborators Welcome. Permission Granted upon Request.
Stars: ✭ 310 (+144.09%)
Mutual labels:  scikit-learn, xgboost
HousePrice
住房月租金预测大数据赛TOP1
Stars: ✭ 17 (-86.61%)
Mutual labels:  xgboost, lightgbm
Open Solution Home Credit
Open solution to the Home Credit Default Risk challenge 🏡
Stars: ✭ 397 (+212.6%)
Mutual labels:  xgboost, lightgbm
Ai competitions
AI比赛相关信息汇总
Stars: ✭ 443 (+248.82%)
Mutual labels:  xgboost, lightgbm
HyperGBM
A full pipeline AutoML tool for tabular data
Stars: ✭ 172 (+35.43%)
Mutual labels:  xgboost, lightgbm
Awesome Gradient Boosting Papers
A curated list of gradient boosting research papers with implementations.
Stars: ✭ 704 (+454.33%)
Mutual labels:  xgboost, lightgbm

Nyoka

Build Status PyPI version codecov license Python nyoka_logo

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 and Deep 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 <= 0.23.1):

Models -

Pre-Processing -

Keras (version <= 2.2.4):

Models -

Object Detection Model:

LightGBM:

XGBoost (version <= 0.90):

Statsmodels (version <= 0.11.1):

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
keras KerasToPmml
statsmodels StatsmodelsToPmml & ExponentialSmoothingToPmml
retinanet RetinanetToPmml

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

Note - If scikit-learn, xgboost and lightgbm model is used then the model should be used inside sklearn's Pipeline.

The workflow is as follows (For example, a Decision Tree Classifier with StandardScaler) -

  • Create scikit-learn's Pipeline object and populate it with any pre-processing steps and the model object.

     from sklearn.pipeline import Pipeline
     from sklearn.tree import DecisionTreeClassifier
     from sklearn.preprocessing import StandardScaler
     pipeline_obj = Pipeline([
     		("scaler",StandardScaler()),
     		("model",DecisionTreeClassifier())
     ])
    
  • Call Pipeline.fit(X,y) method to train the model.

     from sklearn.dataset import load_iris
     iris_data = load_iris()
     X = iris_data.data
     y = iris_data.target
     features = iris_data.feature_names
     pipeline_obj.fit(X,y)
    
  • Use the specific exporter and pass the pipeline object, feature names of the training dataset, target name and expected name of the PMML to the exporter function. If target name is not given default value target is used. Similarly, for pmml name, default value from_sklearn.pmml/from_xgboost.pmml/from_lighgbm.pmml is used.

     from nyoka import skl_to_pmml
     skl_to_pmml(pipeline=pipeline_obj,col_names=features,target_name="species",pmml_f_name="decision_tree.pmml")
    

For Keras, RetinaNet and Statsmodels, pipeline is not required. The fitted model needs to be passed to the exporter.

import pandas as pd
from statsmodels.tsa.arima_model import ARIMA
from nyoka import StatsmodelsToPmml
sales_data = pd.read_csv('sales-cars.csv', index_col=0, parse_dates = True)
model = ARIMA(sales_data, order = (4, 1, 2))
result = model.fit()
StatsmodelsToPmml(result,"Sales_cars_ARIMA.pmml")

Examples

Example jupyter notebooks can be found in nyoka/examples. These files contain code to showcase how to use different exporters.

Nyoka Submodules

Nyoka contains one submodule called preprocessing. This module contains preprocessing classes implemented by Nyoka. Currently there is only one preprocessing class, which is Lag.

What is Lag? When to use it?

Lag is a preprocessing class implemented by Nyoka. When used inside scikit-learn's pipeline, it simply applies an aggregation function for the given features of the dataset by combining value number of previous records. It takes two arguments- aggregation and value.

The valid aggregation functions are - "min", "max", "sum", "avg", "median", "product" and "stddev".

To use Lag -

  • Import it from nyoka -
      from nyoka.preprocessing import Lag
    
  • Create an instance of Lag -
      lag_obj = Lag(aggregation="sum", value=5)
      '''
      This means taking previous 5 values and perform `sum`. When used inside pipeline, this will be applied to all the columns.
      If used inside DataFrameMapper, the it will be applied to only those columns which are inside DataFrameMapper.
      '''
    
  • Use this object inside scikit-learn's pipeline to train.
      from sklearn.pipeline import Pipeline
      from sklearn.tree import DecisionTreeClassifier
      from nyoka.preprocessing import Lag
      pipeline_obj = Pipeline([
      	("lag",Lag(aggregation="sum",value=5)),
      	("model",DecisionTreeClassifier())
      ])
    

Uninstallation

pip uninstall nyoka

Support

You can ask questions at:


Please note that this project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.

These tools are provided as-is and without warranty or support. They do not constitute part of the Software AG product suite. Users are free to use, fork and modify them, subject to the license agreement. While Software AG welcomes contributions, we cannot guarantee to include every contribution in the master project.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].