Click or drag to resize
Accord.NET (logo) DecisionTree Class
Decision tree (for both discrete and continuous classification problems).
Inheritance Hierarchy
SystemObject
  Accord.MachineLearningTransformBaseDouble, Int32
    Accord.MachineLearningClassifierBaseDouble, Int32
      Accord.MachineLearningMulticlassClassifierBaseDouble
        Accord.MachineLearningMulticlassClassifierBase
          Accord.MachineLearning.DecisionTreesDecisionTree

Namespace:  Accord.MachineLearning.DecisionTrees
Assembly:  Accord.MachineLearning (in Accord.MachineLearning.dll) Version: 3.4.0
Syntax
[SerializableAttribute]
public class DecisionTree : MulticlassClassifierBase, 
	IEnumerable
Request Example View Source

The DecisionTree type exposes the following members.

Constructors
  NameDescription
Public methodDecisionTree
Creates a new DecisionTree to process the given inputs and the given number of possible classes.
Top
Properties
  NameDescription
Public propertyAttributes
Gets the collection of attributes processed by this tree.
Public propertyInputCount Obsolete.
Deprecated. Please use the NumberOfInputs property.
Public propertyNumberOfInputs
Gets the number of inputs accepted by the model.
(Inherited from TransformBaseTInput, TOutput.)
Public propertyNumberOfOutputs
Gets the number of outputs generated by the model.
(Inherited from TransformBaseTInput, TOutput.)
Public propertyOutputClasses Obsolete.
Deprecated. Please use the NumberOfOutputs property instead.
Public propertyRoot
Gets or sets the root node for this tree.
Top
Methods
  NameDescription
Public methodCompute(Double) Obsolete.
Deprecated. Please use the Decide() method instead.
Public methodCompute(Int32) Obsolete.
Deprecated. Please use the Decide() method instead.
Public methodCompute(Int32) Obsolete.
Deprecated. Please use the Decide() method instead.
Public methodCompute(Double, DecisionNode) Obsolete.
Deprecated. Please use the Decide() method instead.
Public methodDecide(TInput)
Computes class-label decisions for a given set of input vectors.
(Inherited from ClassifierBaseTInput, TClasses.)
Public methodDecide(Int32)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Single)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Single)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Double)
Computes the tree decision for a given input.
(Overrides ClassifierBaseTInput, TClassesDecide(TInput).)
Public methodDecide(Int32)
Computes the tree decision for a given input.
(Overrides MulticlassClassifierBaseDecide(Int32).)
Public methodDecide(TInput, TClasses)
Computes a class-label decision for a given input.
(Inherited from ClassifierBaseTInput, TClasses.)
Public methodDecide(Int32, Boolean)
Computes class-label decisions for the given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Int32, Double)
Computes class-label decisions for the given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Int32, Int32)
Computes class-label decisions for the given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Int32, Boolean)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Int32, Double)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Int32, Double)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Int32, Int32)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Int32, Int32)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Single, Boolean)
Computes class-label decisions for the given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Single, Double)
Computes class-label decisions for the given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Single, Int32)
Computes class-label decisions for the given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Single, Boolean)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Single, Double)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Single, Double)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Single, Int32)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(Single, Int32)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBase.)
Public methodDecide(TInput, Boolean)
Computes class-label decisions for the given input.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodDecide(TInput, Double)
Computes class-label decisions for the given input.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodDecide(TInput, Int32)
Computes class-label decisions for the given input.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodDecide(TInput, Double)
Computes a class-label decision for a given input.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodDecide(Double, DecisionNode)
Computes the tree decision for a given input.
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGetEnumerator
Returns an enumerator that iterates through the tree.
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetHeight
Computes the height of the tree, defined as the greatest distance (in links) between the tree's root node and its leaves.
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodStatic memberLoad(Stream) Obsolete.
Public methodStatic memberLoad(String) Obsolete.
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Public methodSave(Stream) Obsolete.
Public methodSave(String) Obsolete.
Public methodToAssembly(String, String)
Creates a .NET assembly (.dll) containing a static class of the given name implementing the decision tree. The class will contain a single static Compute method implementing the tree.
Public methodToAssembly(String, String, String)
Creates a .NET assembly (.dll) containing a static class of the given name implementing the decision tree. The class will contain a single static Compute method implementing the tree.
Public methodToCode(String)
Generates a C# class implementing the decision tree.
Public methodToCode(TextWriter, String)
Generates a C# class implementing the decision tree.
Public methodToExpression
Creates an Expression Tree representation of this decision tree, which can in turn be compiled into code.
Public methodToMultilabel
Views this instance as a multi-label classifier, giving access to more advanced methods, such as the prediction of one-hot vectors.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodToRules
Transforms the tree into a set of decision rules.
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Public methodTransform(TInput)
Applies the transformation to an input, producing an associated output.
(Inherited from ClassifierBaseTInput, TClasses.)
Public methodTransform(Int32)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(TInput)
Applies the transformation to a set of input vectors, producing an associated set of output vectors.
(Inherited from TransformBaseTInput, TOutput.)
Public methodTransform(TInput, TClasses)
Applies the transformation to an input, producing an associated output.
(Inherited from ClassifierBaseTInput, TClasses.)
Public methodTransform(Int32, Double)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Int32, Int32)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Int32, Boolean)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Int32, Double)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Int32, Double)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Int32, Int32)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Int32, Int32)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single, Boolean)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single, Double)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single, Int32)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single, Int32)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single, Boolean)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single, Double)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single, Double)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single, Int32)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(Single, Int32)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBase.)
Public methodTransform(TInput, Boolean)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodTransform(TInput, Double)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodTransform(TInput, Int32)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodTransform(TInput, Boolean)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodTransform(TInput, Double)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodTransform(TInput, Double)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodTransform(TInput, Int32)
Applies the transformation to an input, producing an associated output.
(Inherited from MulticlassClassifierBaseTInput.)
Public methodTraverse(DecisionTreeTraversalMethod)
Traverse the tree using a tree traversal method. Can be iterated with a foreach loop.
Public methodTraverse(DecisionTreeTraversalMethod, DecisionNode)
Traverse a subtree using a tree traversal method. Can be iterated with a foreach loop.
Top
Extension Methods
  NameDescription
Public Extension MethodHasMethod
Checks whether an object implements a method with the given name.
(Defined by ExtensionMethods.)
Public Extension MethodSetEqualsDecisionNode
Compares two enumerables for set equality. Two enumerables are set equal if they contain the same elements, but not necessarily in the same order.
(Defined by Matrix.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by ExtensionMethods.)
Public Extension MethodToTOverloaded.
Converts an object into another type, irrespective of whether the conversion can be done at compile time or not. This can be used to convert generic types to numeric types during runtime.
(Defined by Matrix.)
Top
Remarks

Represents a decision tree which can be compiled to code at run-time. For sample usage and example of learning, please see the documentation pages for the ID3 and C4.5 learning algorithms.

It is also possible to create random forests using the random forest learning algorithm.

See Also