If a new iris was found, manually classified, and the appropriate measurements made, the predictor created earlier could be updated to take into account this instance. To do so the instance and its classification would need to be represented as a value that is valid for the predictor’s update schema, which can be obtained from the predictor’s update resource via GET:

GET http://example.org/infer/knn_iris_20130802180742606/update
200 OK
    "/target":    { "$string" { "enum": [ "setosa", "versicolor", "virginica" ] } },
    "/source":    {
        "$array": { "items": [ "$number", "$number", "$number", "$number" ] }

If the new iris was determined to be a “virginica” with sepal length of 6.4, a sepal width of 3.1, a petal length of 6.5, and a petal width of 2.1, this information would be presented to the predictor in the following update request:

POST http://example.org/infer/knn_iris_20130802180742606/update
    "psiType": "value",
    "value": {
        "target":  "virginica",
        "source":  [ 6.4, 3.1, 6.5, 2.1 ]
303 See Other
Location: http://example.org/infer/knn_iris_20130802180742606

The response returns the URI for the updated predictor in the HTTP headers which, in this case, is the same as the original predictor’s URI. A description request to this URI shows how the predictor has been updated:

GET http://example.org/infer/20130315120143263
200 OK
    "psiType":        "transformer",
    "uri":            "http://example.org/infer/knn_iris_20130802180742606",
    "description":    "kNN trained predictor (trained on iris)",
    "accepts":        { "$array": { "items": [ "$number", "$number", "$number", "$number" ] } },
    "emits":          { "$string" { "enum": [ "setosa", "versicolor", "virginica" ] } },
    "provenance":     {
        "learner":    "http://example.org/learn/knn",
        "task": {
            "k": 3,
            "resources": {
                "source":  "$http://example.org/data/iris/array1",
                "target":  "$http://example.org/data/iris/flower/species"
        "created":    "2013-08-02T08:07Z",
        "updated":    "2013-08-15T12:06Z"
    "update":         "http://example.org/infer/knn_iris_20130802180742606/update"

In this case, the only thing that has changed is the addition of the updated property to the provenance part of the response. This is not a requirement of the PSI specification and other predictors may choose to represent changes due to updates in a different manner.

Next steps

Say that a new data source (relation) becomes available that we want to apply this predictor to. Let’s see how we can join this predictor to an appropriate attribute of the new relation to make bulk predictions.

Examining a predictor & making simple predictions Adapting a predictor to a new relation