Skip to content

openscoring/openscoring-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Openscoring-Python

Python client library for the Openscoring REST web service.

Prerequisites

  • Python 2.7, 3.4 or newer.

Installation

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

Usage

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

De-installation

Uninstall:

pip uninstall openscoring

License

Openscoring-Python is licensed under the terms and conditions of the GNU Affero General Public License, Version 3.0.

Additional information

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]

About

Python client library for the Openscoring REST web service

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages