turicreate.drawing_classifier.DrawingClassifier.predict

DrawingClassifier.predict(dataset, output_type='class')

Predict on an SFrame or SArray of drawings, or on a single drawing.

Parameters:
data : SFrame | SArray | tc.Image

The drawing(s) on which to perform drawing classification. If dataset is an SFrame, it must have a column with the same name as the feature column during training. Additional columns are ignored. If the data is a single drawing, it can be either of type tc.Image, in which case it is a bitmap-based drawing input, or of type list, in which case it is a stroke-based drawing input.

output_type : {‘probability’, ‘class’, ‘probability_vector’}, optional

Form of the predictions which are one of:

  • ‘class’: Class prediction. For multi-class classification, this returns the class with maximum probability.
  • ‘probability’: Prediction probability associated with the True class (not applicable for multi-class classification)
  • ‘probability_vector’: Prediction probability associated with each class as a vector. Label ordering is dictated by the classes member variable.
batch_size : int, optional

If you are getting memory errors, try decreasing this value. If you have a powerful computer, increasing this value may improve performance.

verbose : bool, optional

If True, prints prediction progress.

Returns:
out : SArray

An SArray with model predictions. Each element corresponds to a drawing and contains a single value corresponding to the predicted label. Each prediction will have type integer or string depending on the type of the classes the model was trained on. If data is a single drawing, the return value will be a single prediction.

See also

evaluate

Examples

# Make predictions
>>> pred = model.predict(data)

# Print predictions, for a better overview
>>> print(pred)
dtype: int
Rows: 10
[3, 4, 3, 3, 4, 5, 8, 8, 8, 4]