Skip to content

mfaafm/openscoring-python

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Openscoring-Python

Python client library for the Openscoring REST web service.

Prerequisites

  • Python 2.7, 3.4 or newer.

Installation

Install the latest version from GitHub:

pip install --user --upgrade git+https://github.com/openscoring/openscoring-python.git

Usage

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)

De-installation

Uninstall:

pip uninstall openscoring

License

Openscoring-Python is dual-licensed under the GNU Affero General Public License (AGPL) version 3.0, and a commercial license.

Additional information

Openscoring-Python is developed and maintained by Openscoring Ltd, Estonia.

Interested in using Openscoring software in your application? Please contact [email protected]

About

Python client library for the Openscoring REST web service

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages

  • Python 100.0%