{ "info": { "author": "AutoDeploy AI", "author_email": "autodeploy.ai@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Environment :: Web Environment", "Intended Audience :: Developers", "Intended Audience :: System Administrators", "License :: OSI Approved :: Apache Software License", "Operating System :: OS Independent", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: Artificial Intelligence" ], "description": "# PyPMML\n\n_PyPMML_ is a Python PMML scoring library, it really is the Python API for [PMML4S](https://github.com/autodeployai/pmml4s).\n\n## Prerequisites\n - Java >= 1.8\n - Python 2.7 or >= 3.5\n\n## Dependencies\n - Py4J\n - Pandas (optional)\n \n## Installation\n\n```bash\npip install pypmml\n```\n\nOr install the latest version from github:\n\n```bash\npip install --upgrade git+https://github.com/autodeployai/pypmml.git\n```\n\n## Usage\n1. Load model from various sources, e.g. filename, string, or array of bytes.\n\n ```python\n from pypmml import Model\n \n # The model is from http://dmg.org/pmml/pmml_examples/KNIME_PMML_4.1_Examples/single_iris_dectree.xml\n model = Model.fromFile('single_iris_dectree.xml')\n ```\n\n2. Call `predict(data)` to predict new values that can be in different types, e.g. dict, json, Series or DataFrame of Pandas.\n\n ```python\n # data in dict\n result = model.predict({'sepal_length': 5.1, 'sepal_width': 3.5, 'petal_length': 1.4, 'petal_width': 0.2})\n >>> print(result)\n {'probability': 1.0, 'node_id': '1', 'probability_Iris-virginica': 0.0, 'probability_Iris-setosa': 1.0, 'probability_Iris-versicolor': 0.0, 'predicted_class': 'Iris-setosa'}\n \n # data in 'records' json\n result = model.predict('[{\"sepal_length\": 5.1, \"sepal_width\": 3.5, \"petal_length\": 1.4, \"petal_width\": 0.2}]')\n >>> print(result)\n [{\"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\"}]\n \n # data in 'split' json\n result = model.predict('{\"columns\": [\"sepal_length\", \"sepal_width\", \"petal_length\", \"petal_width\"], \"data\": [[5.1, 3.5, 1.4, 0.2]]}')\n >>> print(result)\n {\"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\"]]}\n ```\n\n How to work with Pandas\n \n ```python\n import pandas as pd\n \n # data in Series\n result = model.predict(pd.Series({'sepal_length': 5.1, 'sepal_width': 3.5, 'petal_length': 1.4, 'petal_width': 0.2}))\n >>> print(result)\n node_id 1\n predicted_class Iris-setosa\n probability 1\n probability_Iris-setosa 1\n probability_Iris-versicolor 0\n probability_Iris-virginica 0\n Name: 0, dtype: object\n \n # The data is from here: http://dmg.org/pmml/pmml_examples/Iris.csv\n data = pd.read_csv('Iris.csv')\n \n # data in DataFrame\n result = model.predict(data)\n >>> print(result)\n node_id predicted_class probability probability_Iris-setosa probability_Iris-versicolor probability_Iris-virginica\n 0 1 Iris-setosa 1.000000 1.0 0.000000 0.000000\n 1 1 Iris-setosa 1.000000 1.0 0.000000 0.000000\n .. ... ... ... ... ... ...\n 148 10 Iris-virginica 0.978261 0.0 0.021739 0.978261\n 149 10 Iris-virginica 0.978261 0.0 0.021739 0.978261\n \n [150 rows x 6 columns]\n ```\n\n## Use PMML in Scala or Java\nSee the [PMML4S](https://github.com/autodeployai/pmml4s) project. _PMML4S_ a PMML scoring library for Scala. It provides both Scala and Java Evaluator API for PMML.\n\n## Use PMML in Spark\nSee the [PMML4S-Spark](https://github.com/autodeployai/pmml4s-spark) project. _PMML4S-Spark_ is a PMML scoring library for Spark as SparkML Transformer.\n\n## Use PMML in PySpark\nSee the [PyPMML-Spark](https://github.com/autodeployai/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.\n\n## Deploy PMML as REST API\nSee the [DaaS](https://www.autodeploy.ai/) system that deploys AI & ML models in production at scale on Kubernetes.\n\n## Support\nIf you have any questions about the _PyPMML_ library, please open issues on this repository.\n\nFeedback and contributions to the project, no matter what kind, are always very welcome. \n\n## License\n_PyPMML_ is licensed under [APL 2.0](http://www.apache.org/licenses/LICENSE-2.0).", "description_content_type": "text/markdown", "docs_url": null, "download_url": "https://github.com/autodeployai/pypmml/archive/v0.9.3.tar.gz", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/autodeployai/pypmml", "keywords": "", "license": "Apache License 2.0", "maintainer": "", "maintainer_email": "", "name": "pypmml", "package_url": "https://pypi.org/project/pypmml/", "platform": "", "project_url": "https://pypi.org/project/pypmml/", "project_urls": { "Download": "https://github.com/autodeployai/pypmml/archive/v0.9.3.tar.gz", "Homepage": "https://github.com/autodeployai/pypmml" }, "release_url": "https://pypi.org/project/pypmml/0.9.3/", "requires_dist": null, "requires_python": "", "summary": "Python PMML scoring library", "version": "0.9.3" }, "last_serial": 5798050, "releases": { "0.9.0": [ { "comment_text": "", "digests": { "md5": "088404bfedf8bda1c3a6257f5cbde916", "sha256": "f77c20843684b8586ad0f912b70f1c4c69035bbc2ecd270e430c07b4789b1a95" }, "downloads": -1, "filename": "pypmml-0.9.0.tar.gz", "has_sig": false, "md5_digest": "088404bfedf8bda1c3a6257f5cbde916", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14716599, "upload_time": "2019-06-03T13:58:49", "url": "https://files.pythonhosted.org/packages/2f/fe/22e754e0528c968296926e0f0a61123e09be4400f889846a492a9fde0295/pypmml-0.9.0.tar.gz" } ], "0.9.1": [ { "comment_text": "", "digests": { "md5": "f6441486146794647ac5b658cdd6f5e1", "sha256": "17c5d4ed02448c4b335a194a9cfdd4d928d9b5ac38eeb41d0c8e80b8d8741028" }, "downloads": -1, "filename": "pypmml-0.9.1.tar.gz", "has_sig": false, "md5_digest": "f6441486146794647ac5b658cdd6f5e1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14717155, "upload_time": "2019-06-19T01:55:34", "url": "https://files.pythonhosted.org/packages/b4/d7/127ecebcf7fdd6f1dd1e8d1c621aed35573fc6f8f8c49a827b4ed22a650c/pypmml-0.9.1.tar.gz" } ], "0.9.2": [ { "comment_text": "", "digests": { "md5": "9a76260292c4a4111ac7a46a9760da13", "sha256": "8eef9e15a09446af422b9bc121ea6934999970de888e144be9fe587c30db9ced" }, "downloads": -1, "filename": "pypmml-0.9.2.tar.gz", "has_sig": false, "md5_digest": "9a76260292c4a4111ac7a46a9760da13", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14942757, "upload_time": "2019-07-13T15:38:27", "url": "https://files.pythonhosted.org/packages/1b/cd/8133c0c54fc9fb5be6d98aa6c04a2f38d4b9382d4d95cf7eb5d4117c0fa5/pypmml-0.9.2.tar.gz" } ], "0.9.3": [ { "comment_text": "", "digests": { "md5": "f45d41621b9a3adaafdd98415190eb6e", "sha256": "64ea25ac37354009210796da78770a6d2040f98a2061de3bc85b71e88fb96de4" }, "downloads": -1, "filename": "pypmml-0.9.3.tar.gz", "has_sig": false, "md5_digest": "f45d41621b9a3adaafdd98415190eb6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15057511, "upload_time": "2019-09-08T02:22:56", "url": "https://files.pythonhosted.org/packages/4a/19/f6b525fbd291c5d8378f6dcd9f95b459fab83e4edb9ca0076c34aaffc355/pypmml-0.9.3.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "f45d41621b9a3adaafdd98415190eb6e", "sha256": "64ea25ac37354009210796da78770a6d2040f98a2061de3bc85b71e88fb96de4" }, "downloads": -1, "filename": "pypmml-0.9.3.tar.gz", "has_sig": false, "md5_digest": "f45d41621b9a3adaafdd98415190eb6e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15057511, "upload_time": "2019-09-08T02:22:56", "url": "https://files.pythonhosted.org/packages/4a/19/f6b525fbd291c5d8378f6dcd9f95b459fab83e4edb9ca0076c34aaffc355/pypmml-0.9.3.tar.gz" } ] }