• Stars
    star
    184
  • Rank 209,187 (Top 5 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated 10 months ago

Reviews

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

Repository Details

Nyoka is a Python library that helps to export ML models into PMML (PMML 4.4.1 Standard).

Nyoka

Test Master Branch 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 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 -

LightGBM:

XGBoost (version <= 1.5.2):

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
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

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 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.

More Repositories

1

webmethods-api-gateway

Repository hosting developer tutorials, code samples, custom policies, CI/CD scripts and more to enable developers develop faster with API Gateway
47
star
2

sagdevops-templates

Official library of Command Central default templates and Docker support
Shell
34
star
3

webmethods-integrationserver-skyprofiler

SKYProfiler is a performance monitoring tool for Integration Server. SKYProfiler tracks the service invocations and the monitored data can be seen in real time. This helps users track the time each service invocation takes and further drills down to the child service to identify which service contributes to time.
Java
30
star
4

cumulocity-devicemanagement-agent

Cumulocity Reference Agent written in Python to demonstrate most of the Device Management Capabilities of Cumulocity IoT
Python
26
star
5

sagdevops-ci-assets

Software AG DevOps library to support assets CI (continuous integration) with webMethods 9.x and 10.0. Work together with https://github.com/SoftwareAG/webmethods-sample-project-layout
XSLT
25
star
6

ganymed-ssh-2

Ganymed SSH-2 for Java is a library which implements the SSH-2 protocol in pure Java.
Java
24
star
7

webmethods-sample-project-layout

Sample project layout for webMethods assets. This sample also demostrates CI quick set up together with https://github.com/SoftwareAG/sagdevops-ci-assets
HTML
22
star
8

r-pmml

Generate PMML for various machine learning and statistical models.
R
20
star
9

sagdevops-cc-server

Customized Software AG Command Central server setup
Shell
20
star
10

c8y-docs

Cumulocity IoT guides and documentation
HTML
19
star
11

cumulocity-migration-tool

A Cumulocity webapp to migrate applications, dashboards, groups, devices, simulators, smart rules, images, and managed objects between tenants. Developed by Global Presales.
TypeScript
17
star
12

cumulocity-python-api

Python client for the Cumulocity REST API. Created by Global Competency Center IoT
Python
16
star
13

cumulocity-app-builder

The Application Builder for Cumulocity provides a simple, coding-free way to create new applications inside Cumulocity. Application Builder is an open-source tool for you to create web applications in a no-code environment. Created by Global Presales.
TypeScript
16
star
14

adabas-natural-code-samples

Natural Code Samples contributed by the Natural community for Natural developers to implement standard or specific programming pattern
15
star
15

c8yMQTT

Python3 Cumulocity Agent implementation for MQTT and Rasperry PI
Python
14
star
16

wm-is-client

Node.js package for invoking Integration Server services.
JavaScript
14
star
17

webMethods-io-examples

Collection of examples for beginner webMethods.io developers
JavaScript
12
star
18

webmethods-integrationserver-wxgenerate

Generates IS Flows programmatically
11
star
19

webmethods-api-gateway-devops

Repository for hosting and managing the CI/CD scripts, documents and samples for API Gateway
Shell
11
star
20

cumulocity-alarmapp

The Cumulocity IoT Alarm App brings alarms on your mobile phone! You'll see a handy overview about all alarms.
Swift
10
star
21

ethereum-private-chain

Tutorial for setting up an Ethereum private chain, sending transactions, and doing smart contracts ...
Shell
10
star
22

cumulocity-microservice-templates

Collection of templates / examples to give the developer a starting point how common features can be solved by using Cumulocity Microservice SDK for Java. Developed by Global Competency Center IoT
Java
10
star
23

cumulocity-digital-twin-manager

The Digital Twin Manager enables you to create and manage assets around your physical connected devices in Cumulocity IoT.
10
star
24

WxMonitoring

webMethods Monitoring using Open Elastic Stack
CSS
9
star
25

sagdevops-ci-infra

Command Central CI (continuous integration) infrastructure setup
Dockerfile
9
star
26

webmethods-helm-charts

This repository contains a collection of Helm charts for various webMethods components.
Smarty
9
star
27

cumulocity-tenant-option-management-plugin

Easily create, edit and delete tenant options. You can configure an option as encrypted and can decided between text or JSON input.
TypeScript
9
star
28

cumulocity-examples

This repository contains example applications created using Cumulocity SDK.
Java
9
star
29

cumulocity-clients-java-v2

A Java gradle/maven project to work with Cumulocity IoT, generated using the Cumulocity IoT OpenAPI specification.
Java
9
star
30

apama-analytics-builder-block-sdk

Apama Analytics Builder Block SDK
Python
9
star
31

cumulocity-os-repo-overview

This Repository gives a brief overview of all available IoT Open-Source Repositories including additional content at TechCommunity
HTML
9
star
32

cumulocity-dynamic-mapper

The ultimate Mapper for building the bridge between any Message Broker and Cumulocity IoT in a zero-code approach!
Java
9
star
33

awesome-softwareag

A curated list of awesome Software AG open source repositories, tools, libraries and other resources.
9
star
34

cumulocity-lora

LoRa framework including implementations for TTN, Chirpstack, Kerlink Wanesy, Loriot, Actility, Objenious, Live Objects, Orbiwan as well as many codecs and still adding more, and lot of unique features such as user-friendly UI to send device commands, gateway management, codec IDE
Java
9
star
35

cumulocity-clients-java

This repository contains Cumulocity client libraries for Java. This is a read-only mirror
Java
8
star
36

adabas-natural-education-package

Adabas & Natural Education Package
CSS
8
star
37

cumulocity-cypress

Collection of commands and utilities to be used for automating tests for Cumulocity with Cypress.
TypeScript
8
star
38

analytics-builder-blocks-contrib

Unsupported, not productized blocks for use with Apama Analytics Builder
Python
8
star
39

oee-simulators

Set of simulators built for testing and demoing Cumulocity IoT OEE app.
Python
8
star
40

universalmessaging-server-docker-samples

Universal Messaging Docker Samples - Using these files you can build Universal Messaging Docker image
Shell
8
star
41

sagdevops-cc-docker-builder

Command Central docker builder demo
8
star
42

webmethods-io-integration-guidelines

This repository contains various guidelines for webMethods.io Integration.
8
star
43

apama-streaming-analytics-docker-samples

The samples in this repository demonstrate how you can use Docker to deploy and manage entire Apama applications.
Dockerfile
8
star
44

adabas-go-api

This module provides direct access to Adabas database data in a Golang-based application. This contains all transactional operations on the database.
Go
7
star
45

cumulocity-analytics-management

Extends the standard cumulocity administration with dialog to add analytics builder extensions
TypeScript
7
star
46

sagdevops-antcc

Software AG DevOps library to support Infrastructure as Code projects for Command Central
Shell
7
star
47

cumulocity-remote-access-local-proxy

Cumulocity IoT Remote Access Local Proxy
Python
7
star
48

sagdevops-hello-docker

SoftwareAG Command Central basic use of Docker containers for infrastructure setup testing
Shell
7
star
49

webmethods-integration-examples

Collection of examples for using webMethods Integration platform
Java
7
star
50

cumulocity-node-red

This repository contains a node red microservice that runs within cumulocity.
TypeScript
7
star
51

cumulocity-advanced-simulator

A cumulocity-app providing easier access to create and maintain elaborate simulators.
TypeScript
6
star
52

cumulocity-cypress-starter-kit

The Cypress Starter-Kit gives you a playground to start using the end to end test framework in a cockpit clone. Created by Global Competency Center IoT.
TypeScript
6
star
53

webmethods-api-control-plane

webMethods API Control Plane enables centralized platform to manage API Mangement products. It offers functionalities to make decisions based on the performance metrics and patterns. Repository hosting tutorials, code samples, OpenAPI specification files and postman collections.
6
star
54

webmethods-microgateway

Repository hosting developer tutorials, code samples, custom policies, CI/CD scripts and more to enable developers develop faster with webMethods Microgateway
6
star
55

apama-eplapps-tools

Tooling for uploading apps and testing apps within Apama EPL Apps
Python
5
star
56

adabas-rest-webapp

Adabas REST server web application
Vue
5
star
57

webmethods_io_int_cicd

Design and setup an automated CI/CD process and framework for webMethods.io using the inbuilt APIs (or CLI)
Shell
5
star
58

cumulocity-clients-dotnet

A .Net solution project written in CSharp to work with Cumulocity IoT, generated using the Cumulocity IoT OpenAPI specification.
C#
5
star
59

sagdevops-ansible-roles

A collection of ansible roles for automation and configurations of webMethods products
5
star
60

webmethods-microservicesruntime-samples

Contains various samples for webMethods Microservices Runtime
Shell
5
star
61

webmethods-developer-portal

webMethods Developer Portal is a central place for engaging with your developer eco-system better and drive growth to your business. You can find all the code samples and themes for kick starting your API Journey with Developer Portal.
5
star
62

adabas-admin-restful-client

Software AG Adabas RESTful client administration generated using the Adabas RESTful server SWAGGER definition
Go
5
star
63

cumulocity-iot-examples

Collection of examples for beginner Cumulocity developers
Python
5
star
64

adabas-tcp

Access to an Adabas Database from Node.js using the Adabas TCP connection
TypeScript
5
star
65

cumulocity-opcua-gateway-solution

This solution creates a sample OPCServer including the required gateway to connect the OPC server to Cumulocity.
Python
5
star
66

c8y-oee

go-c8y-cli extension to interact with the Cumulocity IoT OEE Application
Shell
5
star
67

cumulocity-layered-map-widget-plugin

Plugin containing the advanced map widget. Displays a map with position markers for selected devices. Support for configuration of additional layers and custom markers.
TypeScript
5
star
68

cumulocity-clients-swift

A Swift package to work with Cumulocity IoT, generated using the Cumulocity IoT OpenAPI specification.
Swift
5
star
69

cumulocity-freezer-solution-example

A collection of code snippets in order to build a solution for remote monitoring of freezers in Cumulocity IoT
Dart
5
star
70

adabas-natural-devops-sample-application

Adabas & Natural sample Application for testing DevOps approaches
NSIS
4
star
71

apama-rxepl

ReactiveX for Apama EPL Created by Global Presales.
Python
4
star
72

webmethods-suite-logfile-archiver

Archive and (after a customizable retention period) delete log files from webMethods Suite products
Shell
4
star
73

cumulocity-acme

ACME client microservice for the Cumulocity IoT Edge to automatically issue and renew valid certificates via e.g. Let's Encrypt.
TypeScript
4
star
74

cumulocity-agents-linux

Cumulocity Linux agent is a generic agent for connecting Linux-powered devices to Cumulocity's IoT platform. It runs on all major Linux distributions (Ubuntu, Debian, Raspberry Pi OS, CentOS, etc.).
HTML
4
star
75

cumulocity-data-grid-samples

Multiple sample projects to showcase how the Cumulocity data-grid from the Web SDK can be used.
TypeScript
4
star
76

hello-dbp

Hello DBP is a demo / tutorial in the spirit of HelloWorld in your favorite programming language. It's purpose is to showcase the simplest use cases across many of Software AG's Digital Business Platform (DBP) capabilities.
Java
4
star
77

apama-industry-analytics-kit

A set of event-based, analytic microservices used to accelerate the development of Industry/IoT applications.
Python
4
star
78

webmethods-integrationserver-pgpencryption

webMethods Integration Server PGP package
Java
4
star
79

apama-streaming-analytics-connectivity-RegExCodec

A Java based connectivity codec for transforming messages with regular expressions
Java
4
star
80

webmethods-microservicesruntime-prometheus

Sample repository for using webMethods Microservices Runtime with Prometheus and Grafana
4
star
81

webMethods-io-integration

Repository hosting developer tutorials, code samples and more to enable a faster learning/integrating with webMethods.io
4
star
82

cumulocity-remote-access-cloud-http-proxy

A Cumulocity IoT microservice that allows to proxy HTTP requests through the cloud to an HTTP server running on a Cumulocity IoT connected device.
TypeScript
4
star
83

apama-streaming-analytics-epl-syntax

EPL Syntax hilighting rules for various editors
Emacs Lisp
4
star
84

apama-cumulocity-raspberrypi

Apama reading temperature data from Raspberry Pi sensehat and sending it to Cumulocity IoT for real-time analysis. Developed by Global Presales.
PowerShell
4
star
85

cumulocity-demo-widget

This Demo Widget created using Angular Library and later deploy it in App Builder as cumulocity widget. runtime Installation available. Created by Global Presales.
TypeScript
3
star
86

cumulocity-datahub-widget

An example widget that pulls data from Cumulocity IoT DataHub (written by Software AG Global Presales)
TypeScript
3
star
87

cumulocity-python-agent

A cumulocity Agent in Python containing the basic functionalities.
Python
3
star
88

cumulocity-mlops

This project outlines the steps required for a complete AI/ML cycle. It involves Cumulocity IoT with the additional components DataHub for offloading the process data.
Jupyter Notebook
3
star
89

webmethods-b2b-examples

Description Collection of examples for beginner webMethods-B2B developers
3
star
90

cumulocity-microservice-archetype

Maven archetype for cumulocity microservice. Developed by Global Competency Center IoT
Groovy
3
star
91

webmethods-helm-collection

Collection of helm charts for Softwareag's webMethods & API product suite
Mustache
3
star
92

cumulocity-note-widget-plugin

Easily manage and share notes for your device and asset
TypeScript
3
star
93

WxSimpleConfig

WxSimpleConfig package is enhancing he configuration automation for Integration Server or MSR.
Java
3
star
94

apama-streaming-analytics-connectivity-FileTransport

A Java based connectivity transport for reading/writing files
Java
3
star
95

cumulocity-subtenant-management

Tool for managing subtenants from a c8y management or enterprise tenant
TypeScript
3
star
96

cumulocity-remote-access-agent

This is a python agent to demonstrate the Cloud Remote Access Feature of Cumulocity.
Python
3
star
97

c8y-releasenotes

Cumulocity Release Notes
SCSS
3
star
98

cumulocity-swagger-openapi

Swagger/OpenAPI RESTful API for Cumulocity
3
star
99

cumulocity-xdk-agent

Device agent for Bosch XDK to connect to Cumulocity
C
3
star
100

cumulocity-devicemanagement-docker-example

Cumulocity Example for a Thin Edge based application on Docker
Python
3
star