turicreate.decision_tree_classifier.DecisionTreeClassifier.classify

DecisionTreeClassifier.classify(dataset, missing_value_action='auto')

Return a classification, for each example in the dataset, using the trained model. The output SFrame contains predictions as class labels (0 or 1) and probabilities associated with the the example.

Parameters:
dataset : SFrame

Dataset of new observations. Must include columns with the same names as the features used for model training, but does not require a target column. Additional columns are ignored.

missing_value_action : str, optional

Action to perform when missing values are encountered. Can be one of:

  • ‘auto’: By default the model will treat missing value as is.
  • ‘impute’: Proceed with evaluation by filling in the missing values with the mean of the training data. Missing values are also imputed if an entire column of data is missing during evaluation.
  • ‘error’: Do not proceed with evaluation and terminate with an error message.
Returns:
out : SFrame

An SFrame with model predictions i.e class labels and probabilities associated with each of the class labels.

See also

create, evaluate, predict

Examples

>>> data =  turicreate.SFrame('https://static.turi.com/datasets/regression/houses.csv')
>>> data['is_expensive'] = data['price'] > 30000
>>> model = turicreate.decision_tree_classifier.create(data,
>>>                                                  target='is_expensive',
>>>                                                  features=['bath', 'bedroom', 'size'])
>>> classes = model.classify(data)