All Projects → autodeployai → pypmml

autodeployai / pypmml

Licence: Apache-2.0 license
Python PMML scoring library

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to pypmml

pmml4s
PMML scoring library for Scala
Stars: ✭ 49 (-24.62%)
Mutual labels:  ml, pmml, pmml-scoring-library
pmml4s-spark
PMML scoring library for Spark as SparkML Transformer
Stars: ✭ 16 (-75.38%)
Mutual labels:  ml, pmml, pmml-scoring-library
mindsdb server
MindsDB server allows you to consume and expose MindsDB workflows, through http.
Stars: ✭ 3 (-95.38%)
Mutual labels:  ml
VickyBytes
Subscribe to this GitHub repo to access the latest tech talks, tech demos, learning materials & modules, and developer community updates!
Stars: ✭ 48 (-26.15%)
Mutual labels:  ml
djl
An Engine-Agnostic Deep Learning Framework in Java
Stars: ✭ 3,080 (+4638.46%)
Mutual labels:  ml
php-chess
A chess library for PHP.
Stars: ✭ 42 (-35.38%)
Mutual labels:  ml
fdp-modelserver
An umbrella project for multiple implementations of model serving
Stars: ✭ 47 (-27.69%)
Mutual labels:  pmml
Tensorflow
An Open Source Machine Learning Framework for Everyone
Stars: ✭ 161,335 (+248107.69%)
Mutual labels:  ml
SENet-for-Weakly-Supervised-Relation-Extraction
No description or website provided.
Stars: ✭ 39 (-40%)
Mutual labels:  ml
managed ml systems and iot
Managed Machine Learning Systems and Internet of Things Live Lesson
Stars: ✭ 35 (-46.15%)
Mutual labels:  ml
industrial-ml-datasets
A curated list of datasets, publically available for machine learning research in the area of manufacturing
Stars: ✭ 45 (-30.77%)
Mutual labels:  ml
GIMLeT
GIMLeT – Gestural Interaction Machine Learning Toolkit
Stars: ✭ 33 (-49.23%)
Mutual labels:  ml
mindsdb native
Machine Learning in one line of code
Stars: ✭ 34 (-47.69%)
Mutual labels:  ml
osdg-tool
OSDG is an open-source tool that maps and connects activities to the UN Sustainable Development Goals (SDGs) by identifying SDG-relevant content in any text. The tool is available online at www.osdg.ai. API access available for research purposes.
Stars: ✭ 22 (-66.15%)
Mutual labels:  ml
hi-ml
HI-ML toolbox for deep learning for medical imaging and Azure integration
Stars: ✭ 150 (+130.77%)
Mutual labels:  ml
project-code-py
Leetcode using AI
Stars: ✭ 100 (+53.85%)
Mutual labels:  ml
COVID-Net
Launched in March 2020 in response to the coronavirus disease 2019 (COVID-19) pandemic, COVID-Net is a global open source, open access initiative dedicated to accelerating advancement in machine learning to aid front-line healthcare workers and clinical institutions around the world fighting the continuing pandemic. Towards this goal, our global…
Stars: ✭ 41 (-36.92%)
Mutual labels:  ml
metaflowbot
Slack bot for monitoring your Metaflow flows!
Stars: ✭ 22 (-66.15%)
Mutual labels:  ml
sharpmask
TensorFlow implementation of DeepMask and SharpMask
Stars: ✭ 31 (-52.31%)
Mutual labels:  ml
TrackMania AI
Racing game AI
Stars: ✭ 65 (+0%)
Mutual labels:  ml

PyPMML

PyPMML is a Python PMML scoring library, it really is the Python API for PMML4S.

Prerequisites

  • Java >= 8 and < 16
  • Python 2.7 or >= 3.5

Dependencies

Installation

pip install pypmml

Or install the latest version from github:

pip install --upgrade git+https://github.com/autodeployai/pypmml.git

Usage

  1. Load model from various sources, e.g. readable, file path, string, or an array of bytes.

    from pypmml import Model
    
    # The model is from http://dmg.org/pmml/pmml_examples/KNIME_PMML_4.1_Examples/single_iris_dectree.xml
    model = Model.load('single_iris_dectree.xml')
  2. Call predict(data) to predict new values that can be in different types, e.g. dict, list, json, ndarray of NumPy, Series or DataFrame of Pandas.

    • data in dict:
    >>> model.predict({'sepal_length': 5.1, 'sepal_width': 3.5, 'petal_length': 1.4, 'petal_width': 0.2})
    {'probability_Iris-setosa': 1.0, 'probability_Iris-versicolor': 0.0, 'probability': 1.0, 'predicted_class': 'Iris-setosa', 'probability_Iris-virginica': 0.0, 'node_id': '1'}
    • data in list:

    NOTE: the order of values must match the input names, and the order of results always matches the output names.

    >>> model.inputNames
    ['sepal_length', 'sepal_width', 'petal_length', 'petal_width']
    >>> model.predict([5.1, 3.5, 1.4, 0.2])
    ['Iris-setosa', 1.0, 1.0, 0.0, 0.0, '1']
    >>> model.outputNames
    ['predicted_class', 'probability', 'probability_Iris-setosa', 'probability_Iris-versicolor', 'probability_Iris-virginica', 'node_id']
    • data in records json:
    >>> model.predict('[{"sepal_length": 5.1, "sepal_width": 3.5, "petal_length": 1.4, "petal_width": 0.2}]')
    [{"probability":1.0,"probability_Iris-versicolor":0.0,"probability_Iris-setosa":1.0,"probability_Iris-virginica":0.0,"predicted_class":"Iris-setosa","node_id":"1"}]
    • data in split json:
    >>> model.predict('{"columns": ["sepal_length", "sepal_width", "petal_length", "petal_width"], "data": [[5.1, 3.5, 1.4, 0.2]]}')
    {"columns":["predicted_class","probability","probability_Iris-setosa","probability_Iris-versicolor","probability_Iris-virginica","node_id"],"data":[["Iris-setosa",1.0,1.0,0.0,0.0,"1"]]}
    • data in ndarray of NumPy:

    NOTE: as the list above, the order of ndarray values must match the input names, and the order of results always matches the output names.

    >>> import numpy as np
    >>> model.predict(np.array([5.1, 3.5, 1.4, 0.2]))
    ['Iris-setosa', 1.0, 1.0, 0.0, 0.0, '1']
    >>> 
    >>> model.predict(np.array([[5.1, 3.5, 1.4, 0.2], [7, 3.2, 4.7, 1.4]]))
    [['Iris-setosa', 1.0, 1.0, 0.0, 0.0, '1'], ['Iris-versicolor', 0.9074074074074074, 0.0, 0.9074074074074074, 0.09259259259259259, '3']]
    • data in Series of Pandas:
    >>> import pandas as pd
    >>> model.predict(pd.Series({'sepal_length': 5.1, 'sepal_width': 3.5, 'petal_length': 1.4, 'petal_width': 0.2}))
    node_id                                  1
    predicted_class                Iris-setosa
    probability                              1
    probability_Iris-setosa                  1
    probability_Iris-versicolor              0
    probability_Iris-virginica               0
    Name: 0, dtype: object
    • data in DataFrame of Pandas:
    >>> import pandas as pd
    >>> data = pd.read_csv('Iris.csv') # The data is from here: http://dmg.org/pmml/pmml_examples/Iris.csv
    >>> model.predict(data)
    node_id predicted_class  probability  probability_Iris-setosa  probability_Iris-versicolor  probability_Iris-virginica
    0         1     Iris-setosa     1.000000                      1.0                     0.000000                    0.000000
    1         1     Iris-setosa     1.000000                      1.0                     0.000000                    0.000000
    2         1     Iris-setosa     1.000000                      1.0                     0.000000                    0.000000
    3         1     Iris-setosa     1.000000                      1.0                     0.000000                    0.000000
    4         1     Iris-setosa     1.000000                      1.0                     0.000000                    0.000000
    ..      ...             ...          ...                      ...                          ...                         ...
    145      10  Iris-virginica     0.978261                      0.0                     0.021739                    0.978261
    146      10  Iris-virginica     0.978261                      0.0                     0.021739                    0.978261
    147      10  Iris-virginica     0.978261                      0.0                     0.021739                    0.978261
    148      10  Iris-virginica     0.978261                      0.0                     0.021739                    0.978261
    149      10  Iris-virginica     0.978261                      0.0                     0.021739                    0.978261

Use PMML in Scala or Java

See the PMML4S project. PMML4S is a PMML scoring library for Scala. It provides both Scala and Java Evaluator API for PMML.

Use PMML in Spark

See the PMML4S-Spark project. PMML4S-Spark is a PMML scoring library for Spark as SparkML Transformer.

Use PMML in PySpark

See the PyPMML-Spark project. PyPMML-Spark is a Python PMML scoring library for PySpark as SparkML Transformer, it really is the Python API for PMML4s-Spark.

Deploy PMML as REST API

See the AI-Serving project. AI-Serving is serving AI/ML models in the open standard formats PMML and ONNX with both HTTP (REST API) and gRPC endpoints.

Deploy and Manage AI/ML models at scale

See the DaaS system that deploys AI/ML models in production at scale on Kubernetes.

Support

If you have any questions about the PyPMML library, please open issues on this repository.

Feedback and contributions to the project, no matter what kind, are always very welcome.

License

PyPMML is licensed under APL 2.0.

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