classifier
¶
The Turi Create classifier toolkit contains models for classification
problems. Currently, we support binary classification using support vector
machines (SVM), logistic regression, boosted trees, and nearest
neighbors. In addition to these models, we provide a smart interface that
selects the right model based on the data. If you are unsure about which model
to use, simply use create()
function.
Training datasets should contain a column for the ‘target’ variable and one or more columns representing feature variables.
# Set up the data
>>> import turicreate as tc
>>> data = tc.SFrame('https://static.turi.com/datasets/regression/houses.csv')
# Create the model
>>> data['is_expensive'] = data['price'] > 30000
>>> model = tc.classifier.create(data, target='is_expensive',
... features=['bath', 'bedroom', 'size'])
# Make predictions and evaluate results.
>>> classification = model.classify(data)
>>> results = model.evaluate(data)
creating a classifier¶
classifier.create |
Automatically create a suitable classifier model based on the provided training data. |
random forest¶
random_forest_classifier.create |
Create a (binary or multi-class) classifier model of type RandomForestClassifier using an ensemble of decision trees trained on subsets of the data. |
random_forest_classifier.RandomForestClassifier |
The random forest model can be used as a classifier for predictive tasks. |
decision tree¶
decision_tree_classifier.create |
Create a (binary or multi-class) classifier model of type DecisionTreeClassifier . |
decision_tree_classifier.DecisionTreeClassifier |
Special case of gradient boosted trees with the number of trees set to 1. |
boosted trees¶
boosted_trees_classifier.create |
Create a (binary or multi-class) classifier model of type BoostedTreesClassifier using gradient boosted trees (sometimes known as GBMs). |
boosted_trees_classifier.BoostedTreesClassifier |
The gradient boosted trees model can be used as a classifier for predictive tasks. |
logistic regression¶
logistic_classifier.create |
Create a LogisticClassifier (using logistic regression as a classifier) to predict the class of a discrete target variable (binary or multiclass) based on a model of class probability as a logistic function of a linear combination of the features. |
logistic_classifier.LogisticClassifier |
Logistic regression models a discrete target variable as a function of several feature variables. |
support vector machines¶
svm_classifier.create |
Create a SVMClassifier to predict the class of a binary target variable based on a model of which side of a hyperplane the example falls on. |
svm_classifier.SVMClassifier |
Support Vector Machines can be used to predict binary target variable using several feature variables. |
nearest neighbor¶
nearest_neighbor_classifier.create |
Create a NearestNeighborClassifier model. |
nearest_neighbor_classifier.NearestNeighborClassifier |
Nearest neighbor classifier model. |