This function applies a classifier model previously trained by a classifier.train
procedure type to a feature vector, producing a classification
score.
A new function of type classifier
named <id>
can be created as follows:
mldb.put("/v1/functions/"+<id>, {
"type": "classifier",
"params": {
"modelFileUrl": <Url>
}
})
with the following key-value definitions for params
:
Field, Type, Default | Description |
---|---|
modelFileUrl | URL of the model file (with extension '.cls') to load. This file is created by the |
Functions of this type have a single input value called features
which is a row. The columns that
are expected in this row depend on the features that were trained into the classifier.
For example, if in the training the input was "select": "x,y"
, then the function will
expect two columns called x
and y
.
These functions output a single value where the name depends on the classifier mode:
regression
mode, the name is score
and it gives the output of the regression.boolean
mode, the name is score
and it gives the classifier's score. Depending on the classifier type,
this could have any range, but normally the higher the score, the more
likely the "true" response. A probabilizer.train
procedure type can be used to transform the output into a probability.categorical
mode, the name is scores
and it outputs a row of values with one column for each category, the value of which
is the score the classifier has assigned to that category. Again, the
higher the score, the more likely that the category is true, and a
probabilizer.train
procedure type can be used.To allow introspection into a trained model, the following routes of a Classifier function will return status information:
/status
: overview of the trained model/details
: parameters of the trained model, such as weightsclassifier.train
procedure type trains a classifier.classifier.test
procedure type allows the accuracy of a predictor to be tested against
held-out data.probabilizer.train
procedure type trains a probabilizer.classifier
function type applies a classifier to a feature vector, producing a classification score.classifier.explain
function type explains how a classifier produced its output.probabilizer
function type works with classifier.apply to convert scores to probabilities.