turicreate.logistic_classifier.LogisticClassifier.classify

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

Return a classification, for each example in the dataset, using the trained logistic regression model. The output SFrame contains predictions as both class labels (0 or 1) as well as probabilities that the predicted value is the associated label.

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. This can be one of:

  • ‘auto’: Default to ‘impute’
  • ‘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.

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.logistic_classifier.create(data,
                                     target='is_expensive',
                                     features=['bath', 'bedroom', 'size'])
>>> classes = model.classify(data)