Back when we were discovering the resources available at http://example.org we found that the collection of learners is located at http://example.org/learn. A GET request to this collection URI returns the following list of available learner resources:

GET http://example.org/learn
200 OK
{
    "psiType":    "resource-list",
    "resources":  [
        "http://example.org/learn/c45",
        "http://example.org/learn/imageclass",
        "http://example.org/learn/knn",
        "http://example.org/learn/naivebayes"
    ]
}

The learner available at http://example.org/learn/knn is a simple k-nearest neighbour learning algorithm. A GET request to this URI gives the following response:

GET http://example.org/learn/knn
200 OK
{
    "psiType":      "learner",
    "uri":          "http://example.org/learn/knn",
    "description":  "A k-nearest neighbour algorithm that takes feature vectors as input",
    "taskSchema":   {
        "?k": { "$integer": { "default": 1, "min": 1,
                "description": "The number of nearest neighbours to examine" } },
        "/resources": {
            "/target":   { "$nominalAttribute": { "allItems": "$string" },
            "/source":   { "$arrayAttribute": { "allItems": "$atomicValueSchema" } }
        }
    }
}

The above description shows (with reference to the predefined schema in the specification) that the learner requires a target attribute that returns string values to be interpreted as nominal values, and a source attribute that returns arrays of atomic values (i.e., feature vectors). The learner can also take an optional parameter k which controls the number of nearest neighbours to consider. By default, this is set to 1.

Next step: training

Now we know what the learner needs, it’s time to construct a learning task and train a predictor.

Querying a relation Learning tasks & training