Python client library for the Openscoring REST web service.
- Python 2.7, 3.4 or newer.
Install the latest version from GitHub:
pip install --user --upgrade git+https://github.com/openscoring/openscoring-python.git
Creating an Openscoring object:
from openscoring import Openscoring
os = Openscoring("http://localhost:8080/openscoring")Deploying a PMML document DecisionTreeIris.pmml as an Iris model:
# A dictionary of user-specified parameters
kwargs = {"auth" : ("admin", "adminadmin")}
os.deployFile("Iris", "DecisionTreeIris.pmml", **kwargs)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
}
result = os.evaluate("Iris", arguments)
print(result)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.result)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", **kwargs)Uninstall:
pip uninstall openscoring
Openscoring-Python is dual-licensed under the GNU Affero General Public License (AGPL) version 3.0, and a commercial license.
Openscoring-Python is developed and maintained by Openscoring Ltd, Estonia.
Interested in using Openscoring software in your application? Please contact [email protected]