class documentation
class DecisionTreeClassifier(ClassifierI): (source)
Constructor: DecisionTreeClassifier(label, feature_name, decisions, default)
Undocumented
Static Method | best |
Undocumented |
Static Method | best |
Undocumented |
Static Method | binary |
Undocumented |
Static Method | leaf |
Undocumented |
Static Method | stump |
Undocumented |
Static Method | train |
No summary |
Method | __init__ |
No summary |
Method | __str__ |
Undocumented |
Method | classify |
No summary |
Method | error |
Undocumented |
Method | labels |
No summary |
Method | pretty |
Return a string containing a pretty-printed version of this decision tree. Each line in this string corresponds to a single decision tree node or leaf, and indentation is used to display the structure of the decision tree. |
Method | pseudocode |
Return a string representation of this decision tree that expresses the decisions it makes as a nested set of pseudocode if statements. |
Method | refine |
Undocumented |
Instance Variable | _decisions |
Undocumented |
Instance Variable | _default |
Undocumented |
Instance Variable | _fname |
Undocumented |
Instance Variable | _label |
Undocumented |
Inherited from ClassifierI
:
Method | classify |
Apply self.classify() to each element of featuresets. I.e.: |
Method | prob |
No summary |
Method | prob |
Apply self.prob_classify() to each element of featuresets. I.e.: |
@staticmethod
def best_binary_stump(feature_names, labeled_featuresets, feature_values, verbose=False): (source) ¶
def best_binary_stump(feature_names, labeled_featuresets, feature_values, verbose=False): (source) ¶
Undocumented
@staticmethod
def train(labeled_featuresets, entropy_cutoff=0.05, depth_cutoff=100, support_cutoff=10, binary=False, feature_values=None, verbose=False): (source) ¶
def train(labeled_featuresets, entropy_cutoff=0.05, depth_cutoff=100, support_cutoff=10, binary=False, feature_values=None, verbose=False): (source) ¶
Parameters | |
labeled | Undocumented |
entropy | Undocumented |
depth | Undocumented |
support | Undocumented |
binary | If true, then treat all feature/value pairs as individual binary features, rather than using a single n-way branch for each feature. |
feature | Undocumented |
verbose | Undocumented |
Parameters | |
label | The most likely label for tokens that reach this node in the decision tree. If this decision tree has no children, then this label will be assigned to any token that reaches this decision tree. |
feature | The name of the feature that this decision tree selects for. |
decisions | A dictionary mapping from feature values for the feature identified by feature_name to child decision trees. |
default | The child that will be used if the value of feature feature_name does not match any of the keys in decisions. This is used when constructing binary decision trees. |
overrides
nltk.classify.api.ClassifierI.classify
Returns | |
label | the most appropriate label for the given featureset. |
overrides
nltk.classify.api.ClassifierI.labels
Returns | |
list of (immutable) | the list of category labels used by this classifier. |
Return a string containing a pretty-printed version of this decision tree. Each line in this string corresponds to a single decision tree node or leaf, and indentation is used to display the structure of the decision tree.
Return a string representation of this decision tree that expresses the decisions it makes as a nested set of pseudocode if statements.