Python client library for the Openscoring REST web service.
- Python 2.7, 3.4 or newer.
Installing a release version from PyPI:
pip install openscoring
Alternatively, installing the latest snapshot version from GitHub:
pip install --upgrade git+https://github.com/openscoring/openscoring-python.git
Creating an Openscoring
object:
from openscoring import Openscoring
os = Openscoring(base_url = "http://localhost:8080/openscoring")
Deploying a PMML document DecisionTreeIris.pmml
as an Iris
model:
os.deployFile("Iris", "DecisionTreeIris.pmml")
Evaluating the Iris
model with a data record:
arguments = {
"Sepal.Length" : 5.1,
"Sepal.Width" : 3.5,
"Petal.Length" : 1.4,
"Petal.Width" : 0.2
}
results = os.evaluate("Iris", arguments)
print(results)
The same, but wrapping the data record into an EvaluationRequest
object for request identification purposes:
from openscoring import EvaluationRequest
evaluationRequest = EvaluationRequest("record-001", arguments)
evaluationResponse = os.evaluate("Iris", evaluationRequest)
print(evaluationResponse.results)
Evaluating the Iris
model with data records from the Iris.csv
CSV file, storing the results to the Iris-results
CSV file:
os.evaluateCsvFile("Iris", "Iris.csv", "Iris-results.csv")
Undeploying the Iris
model:
os.undeploy("Iris")
Uninstall:
pip uninstall openscoring
Openscoring-Python is licensed under the terms and conditions of the GNU Affero General Public License, Version 3.0.
Openscoring-Python is developed and maintained by Openscoring Ltd, Estonia.
Interested in using Java PMML API or Openscoring REST API software in your company? Please contact [email protected]